sureshanaparti commented on code in PR #12617:
URL: https://github.com/apache/cloudstack/pull/12617#discussion_r3154363590
##########
engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java:
##########
@@ -3274,6 +3287,26 @@ protected void migrate(final VMInstanceVO vm, final long
srcHostId, final Deploy
logger.warn("Error while checking the vm {} on host {}", vm,
dest.getHost(), e);
}
migrated = true;
+ if (vm.getHypervisorType() == HypervisorType.KVM &&
hasClvmVolumes(vm.getId())) {
+ try {
+ logger.info("Executing post-migration tasks for VM {} with
CLVM volumes on destination host {}", vm.getInstanceName(), dstHostId);
+ final PostMigrationCommand postMigrationCommand = new
PostMigrationCommand(to, vm.getInstanceName());
+ final Answer postMigrationAnswer =
_agentMgr.send(dstHostId, postMigrationCommand);
+
+ if (postMigrationAnswer == null ||
!postMigrationAnswer.getResult()) {
+ final String details = postMigrationAnswer != null ?
postMigrationAnswer.getDetails() : "null answer returned";
+ logger.warn("Post-migration tasks failed for VM {} on
destination host {}: {}. Migration completed but some cleanup may be needed.",
+ vm.getInstanceName(), dstHostId, details);
+ } else {
+ logger.info("Successfully completed post-migration
tasks for VM {} on destination host {}", vm.getInstanceName(), dstHostId);
+ }
+ } catch (Exception e) {
+ logger.warn("Exception during post-migration tasks for VM
{} on destination host {}: {}. Migration completed but some cleanup may be
needed.",
+ vm.getInstanceName(), dstHostId, e.getMessage(), e);
+ }
Review Comment:
can move this ^^^ to separate method - _executePostMigrationCommand()_ ?
--
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]