You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2015/03/12 14:56:23 UTC

git commit: updated refs/heads/4.4 to a3069ac

Repository: cloudstack
Updated Branches:
  refs/heads/4.4 258058772 -> a3069ac02


CLOUDSTACK-7534: ResetVM for VM with attached datadisk fails when enable.ha.storage.migration is false

Separate global config to enable/disable Storage Migration during normal deployment
Introduced a configuration parameter named enable.storage.migration


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a3069ac0
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a3069ac0
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a3069ac0

Branch: refs/heads/4.4
Commit: a3069ac02a15f7f118ef963511f28aa54e66dd2a
Parents: 2580587
Author: Harikrishna Patnala <ha...@citrix.com>
Authored: Thu Sep 11 11:07:43 2014 +0530
Committer: Daan Hoogland <dh...@schubergphilis.com>
Committed: Thu Mar 12 14:54:02 2015 +0100

----------------------------------------------------------------------
 api/src/com/cloud/vm/VirtualMachineProfile.java     |  1 +
 .../engine/orchestration/VolumeOrchestrator.java    | 16 +++++++++++++---
 .../com/cloud/ha/HighAvailabilityManagerImpl.java   |  4 ++++
 3 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3069ac0/api/src/com/cloud/vm/VirtualMachineProfile.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/vm/VirtualMachineProfile.java b/api/src/com/cloud/vm/VirtualMachineProfile.java
index 29f3164..d0fea49 100644
--- a/api/src/com/cloud/vm/VirtualMachineProfile.java
+++ b/api/src/com/cloud/vm/VirtualMachineProfile.java
@@ -41,6 +41,7 @@ public interface VirtualMachineProfile {
         public static final Param ReProgramGuestNetworks = new Param("RestartNetwork");
         public static final Param PxeSeverType = new Param("PxeSeverType");
         public static final Param HaTag = new Param("HaTag");
+        public static final Param HaOperation = new Param("HaOperation");
 
         private String name;
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3069ac0/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
----------------------------------------------------------------------
diff --git a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
index 95b4cc0..12908ba 100644
--- a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -1051,7 +1051,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
         }
     }
 
-    private List<VolumeTask> getTasks(List<VolumeVO> vols, Map<Volume, StoragePool> destVols) throws StorageUnavailableException {
+    private List<VolumeTask> getTasks(List<VolumeVO> vols, Map<Volume, StoragePool> destVols, VirtualMachineProfile vm) throws StorageUnavailableException {
         boolean recreate = RecreatableSystemVmEnabled.value();
         List<VolumeTask> tasks = new ArrayList<VolumeTask>();
         for (VolumeVO vol : vols) {
@@ -1091,7 +1091,14 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
                                 throw new CloudRuntimeException("Local volume " + vol + " cannot be recreated on storagepool " + assignedPool + " assigned by deploymentPlanner");
                             } else {
                                 //Check if storage migration is enabled in config
-                                if (StorageHAMigrationEnabled.value()) {
+                                Boolean isHAOperation = (Boolean)vm.getParameter(VirtualMachineProfile.Param.HaOperation);
+                                Boolean storageMigrationEnabled = true;
+                                if (isHAOperation != null && isHAOperation) {
+                                    storageMigrationEnabled = StorageHAMigrationEnabled.value();
+                                } else {
+                                    storageMigrationEnabled = StorageMigrationEnabled.value();
+                                }
+                                if(storageMigrationEnabled){
                                     if (s_logger.isDebugEnabled()) {
                                         s_logger.debug("Shared volume " + vol + " will be migrated on storage pool " + assignedPool + " assigned by deploymentPlanner");
                                     }
@@ -1243,7 +1250,7 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
             s_logger.debug("Checking if we need to prepare " + vols.size() + " volumes for " + vm);
         }
 
-        List<VolumeTask> tasks = getTasks(vols, dest.getStorageForDisks());
+        List<VolumeTask> tasks = getTasks(vols, dest.getStorageForDisks(), vm);
         Volume vol = null;
         StoragePool pool = null;
         for (VolumeTask task : tasks) {
@@ -1294,6 +1301,9 @@ public class VolumeOrchestrator extends ManagerBase implements VolumeOrchestrati
     public static final ConfigKey<Boolean> StorageHAMigrationEnabled = new ConfigKey<Boolean>(Boolean.class, "enable.ha.storage.migration", "Storage", "true",
             "Enable/disable storage migration across primary storage during HA", true);
 
+    public static final ConfigKey<Boolean> StorageMigrationEnabled = new ConfigKey<Boolean>(Boolean.class, "enable.storage.migration", "Storage", "true",
+            "Enable/disable storage migration across primary storage", true);
+
     @Override
     public ConfigKey<?>[] getConfigKeys() {
         return new ConfigKey<?>[] {RecreatableSystemVmEnabled, MaxVolumeSize, StorageHAMigrationEnabled, CustomDiskOfferingMaxSize, CustomDiskOfferingMinSize};

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a3069ac0/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
index 1318d9b..20f3a7f 100755
--- a/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
+++ b/server/src/com/cloud/ha/HighAvailabilityManagerImpl.java
@@ -577,6 +577,10 @@ public class HighAvailabilityManagerImpl extends ManagerBase implements HighAvai
             if (_haTag != null) {
                 params.put(VirtualMachineProfile.Param.HaTag, _haTag);
             }
+            WorkType wt = work.getWorkType();
+            if (wt.equals(WorkType.HA)) {
+                params.put(VirtualMachineProfile.Param.HaOperation, true);
+            }
 
             try{
                 // First try starting the vm with its original planner, if it doesn't succeed send HAPlanner as its an emergency.