Pearl1594 commented on code in PR #12617:
URL: https://github.com/apache/cloudstack/pull/12617#discussion_r3382812573
##########
engine/storage/datamotion/src/main/java/org/apache/cloudstack/storage/motion/StorageSystemDataMotionStrategy.java:
##########
@@ -2211,19 +2253,56 @@ public void copyAsync(Map<VolumeInfo, DataStore>
volumeDataStoreMap, VirtualMach
}
}
+ private void prepareDisksForMigrationForClvm(VirtualMachineTO vmTO,
Map<VolumeInfo, DataStore> volumeDataStoreMap, Host srcHost) {
+ // For CLVM/CLVM_NG source pools, convert volumes from exclusive to
shared mode
+ // on the source host BEFORE PrepareForMigrationCommand on the
destination.
+ boolean hasClvmSource = volumeDataStoreMap.keySet().stream()
+ .map(v -> _storagePoolDao.findById(v.getPoolId()))
+ .anyMatch(p -> p != null && (p.getPoolType() ==
StoragePoolType.CLVM || p.getPoolType() == StoragePoolType.CLVM_NG));
+ if (hasClvmSource && srcHost.getHypervisorType() ==
HypervisorType.KVM) {
+ logger.info("CLVM/CLVM_NG source pool detected for VM [{}],
sending PreMigrationCommand to source host [{}] to convert volumes to shared
mode.", vmTO.getName(), srcHost.getId());
+ PreMigrationCommand preMigCmd = new PreMigrationCommand(vmTO,
vmTO.getName());
+ try {
+ Answer preMigAnswer = agentManager.send(srcHost.getId(),
preMigCmd);
+ if (preMigAnswer == null || !preMigAnswer.getResult()) {
+ String details = preMigAnswer != null ?
preMigAnswer.getDetails() : "null answer returned";
+ logger.warn("PreMigrationCommand failed for CLVM/CLVM_NG
VM [{}] on source host [{}]: {}. Migration will continue but may fail if
volumes are exclusively locked.", vmTO.getName(), srcHost.getId(), details);
Review Comment:
No - if it fails, it will behave like any VM migration failure. The source
VM / volume goes back to original state.
--
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]