You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/10/12 00:39:44 UTC

git commit: updated refs/heads/4.2 to d4928d3

Updated Branches:
  refs/heads/4.2 b7dbe0449 -> d4928d379


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/d4928d37
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/d4928d37
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/d4928d37

Branch: refs/heads/4.2
Commit: d4928d37970c2fa89f82c1ae2dcbe7b5d8f8471e
Parents: b7dbe04
Author: Min Chen <mi...@citrix.com>
Authored: Fri Oct 11 15:34:22 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Fri Oct 11 15:39:30 2013 -0700

----------------------------------------------------------------------
 server/src/com/cloud/configuration/Config.java  |  3 ++-
 .../com/cloud/storage/VolumeManagerImpl.java    | 28 +++++++++++++-------
 setup/db/db/schema-420to421.sql                 |  2 ++
 3 files changed, 23 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d4928d37/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 613a882..eac3b75 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -86,7 +86,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/d4928d37/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeManagerImpl.java b/server/src/com/cloud/storage/VolumeManagerImpl.java
index 232b640..f3e1d9f 100644
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@ -331,6 +331,7 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
     private final int _customDiskOfferingMaxSize = 1024;
     private long _maxVolumeSizeInGb;
     private boolean _recreateSystemVmEnabled;
+    private boolean _storageHAMigrationEnabled;    
 
     public VolumeManagerImpl() {
         _volStateMachine = Volume.State.getStateMachine();
@@ -2461,15 +2462,20 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
                                 }
                                 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) {
+                                    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
@@ -2682,9 +2688,13 @@ public class VolumeManagerImpl extends ManagerBase implements VolumeManager {
 
         String value = _configDao.getValue(Config.RecreateSystemVmEnabled.key());
         _recreateSystemVmEnabled = Boolean.parseBoolean(value);
+        
+        String storageMigrationEnabled = _configDao.getValue(Config.HAStorageMigration.key());
+        _storageHAMigrationEnabled = (storageMigrationEnabled == null) ? true : Boolean.parseBoolean(storageMigrationEnabled);       
+        
         _copyvolumewait = NumbersUtil.parseInt(value,
                 Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
-
+        
         return true;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d4928d37/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"); 
+