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

This commit is contained in:
Min Chen 2013-10-14 22:12:56 -07:00
parent ac02987db2
commit f451a8113e
3 changed files with 23 additions and 7 deletions

View File

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

View File

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

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