prashanthr2 opened a new issue, #13390:
URL: https://github.com/apache/cloudstack/issues/13390
### problem
Live migrating a VM with storage to a SharedMountPoint target pool fails
with:
`LibvirtException: Operation not supported: pre-creation of storage target
for incremental storage migration of disk 'sda' is not supported`
StorageSystemDataMotionStrategy.decideMigrationTypeAndCopyTemplateIfNeeded()
uses supportStoragePoolType() to decide whether to use LinkedClone
(incremental) or FullClone migration. supportStoragePoolType() always includes
SharedMountPoint in its accepted types , the same as NFS. So any volume with a
template_id and a backing file on a SharedMountPoint destination is incorrectly
routed to LinkedClone migration. This sets the libvirt flag
VIR_MIGRATE_NON_SHARED_INC (128), which requires QEMU to pre-create the
destination disk with a backing chain. QEMU does not support this pre-creation
step on SharedMountPoint storage, causing the migration to fail. NFS works
because QEMU can freely create QCOW2 files with backing chains on a flat
filesystem.
The bug does not trigger if template_id is null in the volumes table,
because getVolumeBackingFile() returns null in that case, causing
decideMigrationTypeAndCopyTemplateIfNeeded() to fall through to FullClone,
which uses VIR_MIGRATE_NON_SHARED_DISK (64), a flag QEMU supports on
SharedMountPoint storage.
### versions
4.22.0/4.22.1
### The steps to reproduce the bug
1. Set up a CloudStack KVM environment with a SharedMountPoint primary
storage pool.
2. Deploy a VM from a standard template (ensure the volume has a non-null
template_id and a QCOW2 backing file on the source pool).
3. Add a second SharedMountPoint primary storage pool as the migration
target.
4. Trigger a live migration of the VM with storage to the target pool
(migrateVirtualMachineWithVolume).
5. Observe the migration fails with the error above.
Workaround: Set template_id = NULL in the volumes table for the affected
volumes before migrating. This forces FullClone migration.
### What to do about it?
In
StorageSystemDataMotionStrategy.decideMigrationTypeAndCopyTemplateIfNeeded(),
exclude SharedMountPoint from the LinkedClone path by adding one condition:
```
//engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java
if (StringUtils.isNotBlank(srcVolumeBackingFile) &&
supportStoragePoolType(destStoragePool.getPoolType(),
StoragePoolType.Filesystem) &&
+ destStoragePool.getPoolType() != StoragePoolType.SharedMountPoint &&
srcVolumeInfo.getTemplateId() != null &&
Objects.nonNull(vmTemplate) &&
!Arrays.asList(KVM_VM_IMPORT_DEFAULT_TEMPLATE_NAME,
VM_IMPORT_DEFAULT_TEMPLATE_NAME)
.contains(vmTemplate.getName())) {
```
This forces SharedMountPoint destinations to always use FullClone →
VIR_MIGRATE_NON_SHARED_DISK, which QEMU supports. The template pre-copy step is
also correctly skipped, as it is not needed for a full disk migration.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]