mirror of https://github.com/apache/cloudstack.git
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
(cherry picked from commit c55bc0b2d1)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
bf8db0c743
commit
9cf05dc842
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -1101,7 +1101,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) {
|
||||
|
|
@ -1141,7 +1141,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");
|
||||
}
|
||||
|
|
@ -1299,7 +1306,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) {
|
||||
|
|
@ -1350,6 +1357,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};
|
||||
|
|
|
|||
|
|
@ -578,6 +578,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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue