You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2018/01/21 10:20:02 UTC

[cloudstack] branch 4.11 updated: CLOUDSTACK-10244: Cache whether to migrate storage (#2416)

This is an automated email from the ASF dual-hosted git repository.

rohit pushed a commit to branch 4.11
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.11 by this push:
     new 2ca264c  CLOUDSTACK-10244: Cache whether to migrate storage (#2416)
2ca264c is described below

commit 2ca264ca4d78d89f7f190d6e4c6af81f5f3d7569
Author: Mike Tutkowski <mi...@netapp.com>
AuthorDate: Sun Jan 21 03:19:54 2018 -0700

    CLOUDSTACK-10244: Cache whether to migrate storage (#2416)
    
    KVM online storage migration fails, this fixes use of whether to migrate storage using a cached variable.
---
 .../kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java         | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java
index 6ed56fb..30f0e20 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtMigrateCommandWrapper.java
@@ -132,8 +132,11 @@ public final class LibvirtMigrateCommandWrapper extends CommandWrapper<MigrateCo
             vmsnapshots = libvirtComputingResource.cleanVMSnapshotMetadata(dm);
 
             Map<String, MigrateCommand.MigrateDiskInfo> mapMigrateStorage = command.getMigrateStorage();
+            // migrateStorage is declared as final because the replaceStorage method may mutate mapMigrateStorage, but
+            // migrateStorage's value should always only be associated with the initial state of mapMigrateStorage.
+            final boolean migrateStorage = MapUtils.isNotEmpty(mapMigrateStorage);
 
-            if (MapUtils.isNotEmpty(mapMigrateStorage)) {
+            if (migrateStorage) {
                 xmlDesc = replaceStorage(xmlDesc, mapMigrateStorage);
             }
 
@@ -142,7 +145,7 @@ public final class LibvirtMigrateCommandWrapper extends CommandWrapper<MigrateCo
             //run migration in thread so we can monitor it
             s_logger.info("Live migration of instance " + vmName + " initiated");
             final ExecutorService executor = Executors.newFixedThreadPool(1);
-            final Callable<Domain> worker = new MigrateKVMAsync(libvirtComputingResource, dm, dconn, xmlDesc, MapUtils.isNotEmpty(mapMigrateStorage),
+            final Callable<Domain> worker = new MigrateKVMAsync(libvirtComputingResource, dm, dconn, xmlDesc, migrateStorage,
                     command.isAutoConvergence(), vmName, command.getDestinationIp());
             final Future<Domain> migrateThread = executor.submit(worker);
             executor.shutdown();

-- 
To stop receiving notification emails like this one, please contact
['"commits@cloudstack.apache.org" <co...@cloudstack.apache.org>'].