mirror of https://github.com/apache/cloudstack.git
add recreate.systemvm.enabled parameter to control recreating systemvm
This commit is contained in:
parent
94c5727b12
commit
ef02d1ae87
|
|
@ -225,6 +225,7 @@ public enum Config {
|
|||
SortKeyAlgorithm("Advanced", ManagementServer.class, Boolean.class, "sortkey.algorithm", "false", "Sort algorithm for those who use sort key(template, disk offering, service offering, network offering), true means ascending sort while false means descending sort", null),
|
||||
EnableEC2API("Advanced", ManagementServer.class, Boolean.class, "enable.ec2.api", "false", "enable EC2 API on CloudStack", null),
|
||||
EnableS3API("Advanced", ManagementServer.class, Boolean.class, "enable.s3.api", "false", "enable Amazon S3 API on CloudStack", null),
|
||||
RecreateSystemVmEnabled("Advanced", ManagementServer.class, Boolean.class, "recreate.systemvm.enabled", "false", "If true, will recreate system vm root disk whenever starting system vm", "true,false"),
|
||||
|
||||
// Ovm
|
||||
OvmPublicNetwork("Hidden", ManagementServer.class, String.class, "ovm.public.network.device", null, "Specify the public bridge on host for public network", null),
|
||||
|
|
|
|||
|
|
@ -367,12 +367,4 @@ public class AgentBasedConsoleProxyManager implements ConsoleProxyManager, Virtu
|
|||
@Override
|
||||
public void prepareStop(VirtualMachineProfile<ConsoleProxyVO> profile) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recreateNeeded(
|
||||
VirtualMachineProfile<ConsoleProxyVO> profile, long hostId,
|
||||
Commands cmds, ReservationContext context) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2010,12 +2010,4 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
|
|||
@Override
|
||||
public void prepareStop(VirtualMachineProfile<ConsoleProxyVO> profile) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recreateNeeded(
|
||||
VirtualMachineProfile<ConsoleProxyVO> profile, long hostId,
|
||||
Commands cmds, ReservationContext context) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1003,12 +1003,4 @@ public class ElasticLoadBalancerManagerImpl implements
|
|||
public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recreateNeeded(
|
||||
VirtualMachineProfile<DomainRouterVO> profile, long hostId,
|
||||
Commands cmds, ReservationContext context) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3477,17 +3477,4 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recreateNeeded(
|
||||
VirtualMachineProfile<DomainRouterVO> profile, long hostId,
|
||||
Commands cmds, ReservationContext context) {
|
||||
// asssume that if failed to ssh into router, meaning router is crashed
|
||||
CheckSshAnswer answer = (CheckSshAnswer) cmds.getAnswer("checkSsh");
|
||||
if (answer == null || !answer.getResult()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -176,7 +176,7 @@ public interface StorageManager extends StorageService, Manager {
|
|||
void createCapacityEntry(StoragePoolVO storagePool, short capacityType, long allocated);
|
||||
|
||||
|
||||
void prepare(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, boolean recreate) throws StorageUnavailableException, InsufficientStorageCapacityException, ConcurrentOperationException;
|
||||
void prepare(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest) throws StorageUnavailableException, InsufficientStorageCapacityException, ConcurrentOperationException;
|
||||
|
||||
void release(VirtualMachineProfile<? extends VMInstanceVO> profile);
|
||||
|
||||
|
|
|
|||
|
|
@ -348,6 +348,8 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
|
|||
private int _customDiskOfferingMinSize = 1;
|
||||
private int _customDiskOfferingMaxSize = 1024;
|
||||
|
||||
private boolean _recreateSystemVmEnabled;
|
||||
|
||||
public boolean share(VMInstanceVO vm, List<VolumeVO> vols, HostVO host, boolean cancelPreviousShare) throws StorageUnavailableException {
|
||||
|
||||
// if pool is in maintenance and it is the ONLY pool available; reject
|
||||
|
|
@ -954,6 +956,9 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
|
|||
String time = configs.get("storage.cleanup.interval");
|
||||
_storageCleanupInterval = NumbersUtil.parseInt(time, 86400);
|
||||
|
||||
value = configDao.getValue(Config.RecreateSystemVmEnabled.key());
|
||||
_recreateSystemVmEnabled = Boolean.parseBoolean(value);
|
||||
|
||||
s_logger.info("Storage cleanup enabled: " + _storageCleanupEnabled + ", interval: " + _storageCleanupInterval + ", template cleanup enabled: " + _templateCleanupEnabled);
|
||||
|
||||
String workers = configs.get("expunge.workers");
|
||||
|
|
@ -3192,7 +3197,7 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
|
|||
}
|
||||
|
||||
@Override
|
||||
public void prepare(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, boolean recreate) throws StorageUnavailableException, InsufficientStorageCapacityException {
|
||||
public void prepare(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest) throws StorageUnavailableException, InsufficientStorageCapacityException {
|
||||
|
||||
if (dest == null) {
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
|
@ -3204,7 +3209,7 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
|
|||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Checking if we need to prepare " + vols.size() + " volumes for " + vm);
|
||||
}
|
||||
|
||||
boolean recreate = _recreateSystemVmEnabled;
|
||||
List<VolumeVO> recreateVols = new ArrayList<VolumeVO>(vols.size());
|
||||
|
||||
for (VolumeVO vol : vols) {
|
||||
|
|
|
|||
|
|
@ -1467,13 +1467,4 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
|
|||
public void prepareStop(VirtualMachineProfile<SecondaryStorageVmVO> profile) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean recreateNeeded(
|
||||
VirtualMachineProfile<SecondaryStorageVmVO> profile, long hostId,
|
||||
Commands cmds, ReservationContext context) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3796,11 +3796,4 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
|
|||
@Override
|
||||
public void prepareStop(VirtualMachineProfile<UserVmVO> profile) {
|
||||
}
|
||||
@Override
|
||||
public boolean recreateNeeded(VirtualMachineProfile<UserVmVO> profile,
|
||||
long hostId, Commands cmds, ReservationContext context) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,8 +65,6 @@ public interface VirtualMachineGuru<T extends VirtualMachine> {
|
|||
|
||||
void finalizeExpunge(T vm);
|
||||
|
||||
boolean recreateNeeded(VirtualMachineProfile<T> profile, long hostId, Commands cmds, ReservationContext context);
|
||||
|
||||
/**
|
||||
* Returns the id parsed from the name. If it cannot parse the name,
|
||||
* then return null. This method is used to determine if this is
|
||||
|
|
|
|||
|
|
@ -652,7 +652,6 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||
DataCenterDeployment originalPlan = plan;
|
||||
|
||||
int retry = _retry;
|
||||
boolean recreate = false;
|
||||
while (retry-- != 0) { // It's != so that it can match -1.
|
||||
|
||||
if(reuseVolume){
|
||||
|
|
@ -747,8 +746,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||
}
|
||||
_networkMgr.prepare(vmProfile, dest, ctx);
|
||||
if (vm.getHypervisorType() != HypervisorType.BareMetal) {
|
||||
_storageMgr.prepare(vmProfile, dest, recreate);
|
||||
recreate = false;
|
||||
_storageMgr.prepare(vmProfile, dest);
|
||||
}
|
||||
//since StorageMgr succeeded in volume creation, reuse Volume for further tries until current cluster has capacity
|
||||
if(!reuseVolume){
|
||||
|
|
@ -808,11 +806,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
|
|||
_haMgr.scheduleStop(vm, destHostId, WorkType.ForceStop);
|
||||
throw new ExecutionException("Unable to stop " + vm + " so we are unable to retry the start operation");
|
||||
}
|
||||
if (vmGuru.recreateNeeded(vmProfile, destHostId, cmds, ctx)) {
|
||||
recreate = true;
|
||||
} else {
|
||||
throw new ExecutionException("Unable to start " + vm + " due to error in finalizeStart, not retrying");
|
||||
}
|
||||
throw new ExecutionException("Unable to start " + vm + " due to error in finalizeStart, not retrying");
|
||||
}
|
||||
}
|
||||
s_logger.info("Unable to start VM on " + dest.getHost() + " due to " + (startAnswer == null ? " no start answer" : startAnswer.getDetails()));
|
||||
|
|
|
|||
|
|
@ -288,14 +288,6 @@ public class MockUserVmManagerImpl implements UserVmManager, UserVmService, Mana
|
|||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean recreateNeeded(VirtualMachineProfile<UserVmVO> profile,
|
||||
long hostId, Commands cmds, ReservationContext context) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UserVm startVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException {
|
||||
// TODO Auto-generated method stub
|
||||
|
|
|
|||
Loading…
Reference in New Issue