mirror of https://github.com/apache/cloudstack.git
fix creation of volume on destination host during migration to clvm/clvm-ng
This commit is contained in:
parent
01aa259eff
commit
7e5e1e70e3
|
|
@ -208,6 +208,8 @@ public class StorageSystemDataMotionStrategy implements DataMotionStrategy {
|
|||
private VolumeDataFactory _volFactory;
|
||||
@Inject
|
||||
ResourceManager resourceManager;
|
||||
@Inject
|
||||
private ClvmLockManager clvmLockManager;
|
||||
|
||||
@Override
|
||||
public StrategyPriority canHandle(DataObject srcData, DataObject destData) {
|
||||
|
|
@ -2073,6 +2075,13 @@ public class StorageSystemDataMotionStrategy implements DataMotionStrategy {
|
|||
|
||||
setVolumeMigrationOptions(srcVolumeInfo, destVolumeInfo, vmTO, srcHost, destStoragePool, migrationType);
|
||||
|
||||
if (ClvmLockManager.isClvmPoolType(destStoragePool.getPoolType())) {
|
||||
destVolumeInfo.setDestinationHostId(destHost.getId());
|
||||
clvmLockManager.setClvmLockHostId(destVolume.getId(), destHost.getId());
|
||||
logger.info("Set CLVM lock host {} for volume {} during migration to ensure creation on destination host",
|
||||
destHost.getId(), destVolumeInfo.getUuid());
|
||||
}
|
||||
|
||||
// create a volume on the destination storage
|
||||
destDataStore.getDriver().createAsync(destDataStore, destVolumeInfo, null);
|
||||
|
||||
|
|
|
|||
|
|
@ -2652,10 +2652,11 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
|
|||
throw new CloudRuntimeException("Failed to create QCOW2 on CLVM_NG volume: " + result);
|
||||
}
|
||||
|
||||
long actualSize = getClvmVolumeSize(volumePath);
|
||||
KVMPhysicalDisk disk = new KVMPhysicalDisk(volumePath, volumeUuid, pool);
|
||||
disk.setFormat(PhysicalDiskFormat.QCOW2);
|
||||
disk.setSize(lvSize);
|
||||
disk.setVirtualSize(virtualSize);
|
||||
disk.setSize(actualSize);
|
||||
disk.setVirtualSize(actualSize);
|
||||
|
||||
logger.info("Successfully created CLVM_NG volume {} with backing file (LV size: {}, virtual size: {}, provisioning: {}, preallocation: {})",
|
||||
volumeUuid, lvSize, virtualSize, provisioningType, preallocation);
|
||||
|
|
|
|||
Loading…
Reference in New Issue