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

This commit is contained in:
Min Chen 2013-10-11 15:34:22 -07:00
parent b7dbe04499
commit d4928d3797
3 changed files with 23 additions and 10 deletions

View File

@ -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),

View File

@ -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;
}

View File

@ -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");