You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by GitBox <gi...@apache.org> on 2021/08/30 12:06:07 UTC

[GitHub] [cloudstack] sureshanaparti commented on a change in pull request #5388: kvm: honor migrate.wait and abort vm migration job

sureshanaparti commented on a change in pull request #5388:
URL: https://github.com/apache/cloudstack/pull/5388#discussion_r698429089



##########
File path: plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java
##########
@@ -219,6 +220,29 @@ Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0.
                     s_logger.info("Waiting for migration of " + vmName + " to complete, waited " + sleeptime + "ms");
                 }
 
+                // abort the vm migration if the job is executed more than vm.migrate.wait
+                final int migrateWait = libvirtComputingResource.getMigrateWait();
+                if (migrateWait > 0 && sleeptime > migrateWait * 1000) {
+                    DomainState state = null;
+                    try {
+                        state = dm.getInfo().state;
+                    } catch (final LibvirtException e) {
+                        s_logger.info("Couldn't get VM domain state after " + sleeptime + "ms: " + e.getMessage());
+                    }
+                    if (state != null && state == DomainState.VIR_DOMAIN_RUNNING) {
+                        try {
+                            DomainJobInfo job = dm.getJobInfo();
+                            s_logger.info("Aborting domain job: " + job);
+                            dm.abortJob();
+                            result = "Migration was cancelled by cloudstack due to time out";

Review comment:
       vmName (and time out), might be useful in the log here




-- 
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: commits-unsubscribe@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org