Updated Branches:
  refs/heads/master ac02987db -> f451a8113

CLOUDSTACK-4859:Add global config to disable storage migration during HA


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

Branch: refs/heads/master
Commit: f451a8113e9f2ee24bc22022fb030e09ffc3f3ac
Parents: ac02987
Author: Min Chen <min.c...@citrix.com>
Authored: Mon Oct 14 22:12:56 2013 -0700
Committer: Min Chen <min.c...@citrix.com>
Committed: Mon Oct 14 22:12:56 2013 -0700

----------------------------------------------------------------------
 .../orchestration/VolumeOrchestrator.java       | 25 +++++++++++++++-----
 server/src/com/cloud/configuration/Config.java  |  3 ++-
 setup/db/db/schema-420to421.sql                 |  2 ++
 3 files changed, 23 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f451a811/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 7258e25..0817393 100644
--- 
a/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
+++ 
b/engine/orchestration/src/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
@@ -944,11 +944,16 @@ public class VolumeOrchestrator extends ManagerBase 
implements VolumeOrchestrati
                                 }
                                 throw new CloudRuntimeException("Local volume 
" + vol + " cannot be recreated on storagepool " + assignedPool + " assigned by 
deploymentPlanner");
                             } else {
-                                if (s_logger.isDebugEnabled()) {
-                                    s_logger.debug("Shared volume " + vol + " 
will be migrated on storage pool " + assignedPool + " assigned by 
deploymentPlanner");
+                                //Check if storage migration is enabled in 
config
+                                if (StorageHAMigrationEnabled.value()) {
+                                    if (s_logger.isDebugEnabled()) {
+                                        s_logger.debug("Shared volume " + vol 
+ " will be migrated on storage pool " + assignedPool + " assigned by 
deploymentPlanner");
+                                    }
+                                    VolumeTask task = new 
VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
+                                    tasks.add(task);
+                                } else {
+                                    throw new CloudRuntimeException("Cannot 
migrate volumes. Volume Migration is disabled");
                                 }
-                                VolumeTask task = new 
VolumeTask(VolumeTaskType.MIGRATE, vol, assignedPool);
-                                tasks.add(task);
                             }
                         } else {
                             StoragePoolVO pool = 
_storagePoolDao.findById(vol.getPoolId());
@@ -1106,9 +1111,16 @@ public class VolumeOrchestrator extends ManagerBase 
implements VolumeOrchestrati
         "If true, will recreate system vm root disk whenever starting system 
vm",
         true);
 
+    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);
+
     @Override
     public ConfigKey<?>[] getConfigKeys() {
-        return new ConfigKey<?>[] {RecreatableSystemVmEnabled, MaxVolumeSize};
+        return new ConfigKey<?>[] {RecreatableSystemVmEnabled, MaxVolumeSize, 
StorageHAMigrationEnabled};
     }
 
     @Override
@@ -1164,6 +1176,7 @@ public class VolumeOrchestrator extends ManagerBase 
implements VolumeOrchestrati
         return dataStoreMgr.getPrimaryDataStore(vol.getPoolId()).getUuid();
     }
     
+    @Override
     public void updateVolumeDiskChain(long volumeId, String path, String 
chainInfo) {
         VolumeVO vol = _volsDao.findById(volumeId);
         boolean needUpdate = false;
@@ -1174,7 +1187,7 @@ public class VolumeOrchestrator extends ManagerBase 
implements VolumeOrchestrati
                needUpdate = true;
         
         if(needUpdate) {
-               s_logger.info("Update volume disk chain info. vol: " + 
vol.getId() + ", " + vol.getPath() + " -> " + path 
+               s_logger.info("Update volume disk chain info. vol: " + 
vol.getId() + ", " + vol.getPath() + " -> " + path
                        + ", " + vol.getChainInfo() + " -> " + chainInfo);
                vol.setPath(path);
                vol.setChainInfo(chainInfo);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f451a811/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java 
b/server/src/com/cloud/configuration/Config.java
index 1377bf7..9d94bba 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -79,7 +79,8 @@ public enum Config {
        CreatePrivateTemplateFromSnapshotWait("Storage", UserVmManager.class, 
Integer.class, "create.private.template.from.snapshot.wait", "10800", "In 
second, timeout for CreatePrivateTemplateFromSnapshotCommand", null),
        BackupSnapshotWait(
             "Storage", StorageManager.class, Integer.class, 
"backup.snapshot.wait", "21600", "In second, timeout for 
BackupSnapshotCommand", null),
-
+    HAStorageMigration("Storage", ManagementServer.class, Boolean.class, 
"enable.ha.storage.migration", "true", "Enable/disable storage migration across 
primary storage during HA", null), 
+            
        // Network
        NetworkLBHaproxyStatsVisbility("Network", ManagementServer.class, 
String.class, "network.loadbalancer.haproxy.stats.visibility", "global", "Load 
Balancer(haproxy) stats visibilty, the value can be one of the following six 
parameters : global,guest-network,link-local,disabled,all,default", null),
        NetworkLBHaproxyStatsUri("Network", ManagementServer.class, 
String.class, "network.loadbalancer.haproxy.stats.uri","/admin?stats","Load 
Balancer(haproxy) uri.",null),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f451a811/setup/db/db/schema-420to421.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-420to421.sql b/setup/db/db/schema-420to421.sql
index 1e6341e..fc43fe5 100644
--- a/setup/db/db/schema-420to421.sql
+++ b/setup/db/db/schema-420to421.sql
@@ -22,3 +22,5 @@
 
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 
'management-server', 's3.multipart.enabled', 'true', 'enable s3 multipart 
upload');
 
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ("Storage", 'DEFAULT', 
'management-server', "enable.ha.storage.migration", "true", "Enable/disable 
storage migration across primary storage during HA"); 
+

Reply via email to