Add xenserver.create.full.clone global setting#13114
Add xenserver.create.full.clone global setting#13114erma07 wants to merge 2 commits intoapache:mainfrom
Conversation
Adds a StoragePool-scoped boolean ConfigKey mirroring vmware.create.full.clone so XenServer-backed VMs can be deployed as full VDI copies (VDI.copy) instead of always using linked clones (VDI.clone). Default false preserves today's behavior. The per-pool flag flows into the existing PrimaryDataStoreTO.fullCloneFlag through a new dispatch method addFullCloneAndDiskprovisiongStrictnessFlagOnDest that switches on hypervisor type.
|
Congratulations on your first Pull Request and welcome to the Apache CloudStack community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/cloudstack/blob/main/CONTRIBUTING.md)
|
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #13114 +/- ##
=============================================
- Coverage 18.08% 3.52% -14.57%
=============================================
Files 6037 464 -5573
Lines 542546 40151 -502395
Branches 66431 7557 -58874
=============================================
- Hits 98126 1415 -96711
+ Misses 433404 38548 -394856
+ Partials 11016 188 -10828
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@blueorangutan package |
|
@DaanHoogland a [SL] Jenkins job has been kicked to build packages. It will be bundled with no SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✖️ el8 ✖️ el9 ✖️ debian ✖️ suse15. SL-JID 17760 |
Description
This PR adds a new global setting
xenserver.create.full.clonethat mirrors the existingvmware.create.full.clonebehaviour for the XenServer/XCP-ng hypervisor.Until now, XenServer-backed VMs created from a template have always been provisioned as linked clones (
VDI.clone()), which on file-backed SRs (NFS/EXT/XFS) produces a copy-on-write disk that depends on the cached template VDI. This has two practical drawbacks:When the new setting is enabled (per-pool or globally), the XenServer storage processor instead issues
VDI.copy(conn, sr)for the template→volume operation, producing a fully-independent VDI with no parent VHD relationship. Deleting the template afterwards is harmless to existing VMs, and the per-chain clone ceiling no longer applies.Default value is
false, so existing deployments are unaffected unless an operator opts in.How it's wired up:
ConfigKey<Boolean> XenserverCreateCloneFullinStorageManager(StoragePool scope, dynamic, default"false"), registered viaStorageManagerImpl.getConfigKeys().AncientDataMotionStrategykeepsaddFullCloneAndDiskprovisiongStrictnessFlagOnVMwareDestbyte-for-byte unchanged. A new sibling helperaddFullCloneAndDiskprovisiongStrictnessFlagOnXenServerDestwrites the per-pool XenServer value ontoPrimaryDataStoreTO.fullCloneFlag, and a new dispatcheraddFullCloneAndDiskprovisiongStrictnessFlagOnDestswitches ondataTO.getHypervisorType()to call the right per-hypervisor helper. All seven existing call sites that used to call the VMware helper now call the dispatcher instead — VMware behaviour is preserved exactly.PrimaryDataStoreTO.fullCloneFlagalready exists and is hypervisor-agnostic; no TO change required.XenServerStorageProcessor.cloneVolumeFromBaseTemplatereads((PrimaryDataStoreTO) destStore).isFullCloneFlag()and, when true, callstmpltvdi.copy(conn, tmpltvdi.getSR(conn))instead oftmpltvdi.createClone(conn, new HashMap<>()).Xenserver625StorageProcessordoes not override the method, so all XenServer versions are covered with a single edit.The legacy
CitrixCreateCommandWrapper.CreateCommandpath is intentionally left untouched —new CreateCommand(...)is only constructed by test code in this repository, so the wrapper is unreachable in production today.Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Screenshots (if appropriate):
Global Settings UI showing the new
xenserver.create.full.clonekey — TODO: attach screenshot.How Has This Been Tested?
Unit tests
AncientDataMotionStrategyTest.testAddFullCloneFlagOnXenServerDest, mirroring the existing VMware test, which overrides theXenserverCreateCloneFulldefault, setsdataTO.getHypervisorType()toHypervisorType.XenServer, calls the new XenServer helper, and verifies thatsetFullCloneFlag(true)is invoked on the destinationPrimaryDataStoreTO.testAddFullCloneFlagOnVMwareDestandtestAddFullCloneFlagOnNotVmwareDestcontinue to pass — the VMware helper was not modified.Manual test environment (fill in)
<version><version><NFS / EXT / LVM / iSCSI><format / size>Manual scenarios (fill in results)
With
xenserver.create.full.clone=false(default), deploy a VM from a template and run on the XenServer host:Expect
sm-config:vhd-parentto be present (linked clone, today's behaviour). Result: ☐Set
xenserver.create.full.clone=trueon the pool (Infrastructure → Primary Storage → Settings) and deploy another VM from the same template. Re-run the command above and expectsm-config:vhd-parentto be absent, andphysical-utilisationto be on the same order of magnitude asvirtual-size. Result: ☐Delete the cached template VDI on the primary storage. The full-clone-backed VM keeps running normally; a linked-clone-backed VM would lose data. Restore the template afterwards. Result: ☐
Repeat (1)–(3) on a VMware pool to confirm the
vmware.create.full.clonepath is unaffected by the helper refactor. Result: ☐How did you try to break this feature and the system with this change?
switchonly triggers whendataTO.getHypervisorType()isXenServer; pools withKVM,Hyperv, etc. fall through andfullCloneFlagis left untouched (linked-clone behaviour preserved).Volume.getHypervisorType()returnsHypervisorType.None(storage pool not bound to a cluster with a known hypervisor), the dispatch falls through to the default branch and the volume is linked-cloned — safe default, no regression.addFullCloneAndDiskprovisiongStrictnessFlagOnVMwareDestis byte-for-byte unchanged; the seven call sites that previously called it now go through the dispatcher, which routes VMware traffic back into the same method.StorageSystemDataMotionStrategy(e.g. SolidFire) bypass the dispatcher — same VMware-side limitation today, behaviour preserved.CreateCommandpath (out of scope, documented):CitrixCreateCommandWrapper.execute(CreateCommand)still always linked-clones, butnew CreateCommand(...)has no production callers in this repository (only test code).false, so the change is a no-op on upgrade until an operator opts in.