Skip to content

Commit 481aae1

Browse files
committed
add recreate.systemvm.enabled parameter to control recreating systemvm
1 parent ba2b0c3 commit 481aae1

12 files changed

Lines changed: 12 additions & 77 deletions

File tree

‎plugins/network-elements/elastic-loadbalancer/src/com/cloud/network/lb/ElasticLoadBalancerManagerImpl.java‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,14 +1025,6 @@ public boolean unplugNic(Network network, NicTO nic, VirtualMachineTO vm,
10251025
throw new UnsupportedOperationException("Unplug nic is not supported for vm of type " + vm.getType());
10261026
}
10271027

1028-
1029-
@Override
1030-
public boolean recreateNeeded(
1031-
VirtualMachineProfile<DomainRouterVO> profile, long hostId, Commands cmds, ReservationContext context) {
1032-
// TODO Auto-generated method stub
1033-
return false;
1034-
}
1035-
10361028
@Override
10371029
public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile) {
10381030
}

‎server/src/com/cloud/configuration/Config.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,7 @@ public enum Config {
230230
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),
231231
EnableEC2API("Advanced", ManagementServer.class, Boolean.class, "enable.ec2.api", "false", "enable EC2 API on CloudStack", null),
232232
EnableS3API("Advanced", ManagementServer.class, Boolean.class, "enable.s3.api", "false", "enable Amazon S3 API on CloudStack", null),
233+
RecreateSystemVmEnabled("Advanced", ManagementServer.class, Boolean.class, "recreate.systemvm.enabled", "false", "If true, will recreate system vm root disk whenever starting system vm", "true,false"),
233234

234235
// Ovm
235236
OvmPublicNetwork("Hidden", ManagementServer.class, String.class, "ovm.public.network.device", null, "Specify the public bridge on host for public network", null),

‎server/src/com/cloud/consoleproxy/AgentBasedConsoleProxyManager.java‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,14 +368,6 @@ public boolean unplugNic(Network network, NicTO nic, VirtualMachineTO vm,
368368
throw new UnsupportedOperationException("Unplug nic is not supported for vm of type " + vm.getType());
369369
}
370370

371-
@Override
372-
public boolean recreateNeeded(
373-
VirtualMachineProfile<ConsoleProxyVO> profile, long hostId,
374-
Commands cmds, ReservationContext context) {
375-
// TODO Auto-generated method stub
376-
return false;
377-
}
378-
379371
@Override
380372
public void prepareStop(VirtualMachineProfile<ConsoleProxyVO> profile) {
381373
}

‎server/src/com/cloud/consoleproxy/ConsoleProxyManagerImpl.java‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2023,15 +2023,6 @@ public boolean unplugNic(Network network, NicTO nic, VirtualMachineTO vm,
20232023
//not supported
20242024
throw new UnsupportedOperationException("Unplug nic is not supported for vm of type " + vm.getType());
20252025
}
2026-
2027-
2028-
@Override
2029-
public boolean recreateNeeded(
2030-
VirtualMachineProfile<ConsoleProxyVO> profile, long hostId,
2031-
Commands cmds, ReservationContext context) {
2032-
// TODO Auto-generated method stub
2033-
return false;
2034-
}
20352026

20362027
@Override
20372028
public void prepareStop(VirtualMachineProfile<ConsoleProxyVO> profile) {

‎server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3386,17 +3386,4 @@ public void prepareStop(VirtualMachineProfile<DomainRouterVO> profile){
33863386
}
33873387
}
33883388
}
3389-
3390-
@Override
3391-
public boolean recreateNeeded(
3392-
VirtualMachineProfile<DomainRouterVO> profile, long hostId,
3393-
Commands cmds, ReservationContext context) {
3394-
//asssume that if failed to ssh into router, meaning router is crashed
3395-
CheckSshAnswer answer = (CheckSshAnswer) cmds.getAnswer("checkSsh");
3396-
if (answer == null || !answer.getResult()) {
3397-
return true;
3398-
}
3399-
3400-
return false;
3401-
}
34023389
}

‎server/src/com/cloud/storage/StorageManager.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ VolumeVO createVolume(VolumeVO volume, VMInstanceVO vm, VMTemplateVO template, D
180180
void createCapacityEntry(StoragePoolVO storagePool, short capacityType, long allocated);
181181

182182

183-
void prepare(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, boolean recreate) throws StorageUnavailableException, InsufficientStorageCapacityException, ConcurrentOperationException;
183+
void prepare(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest) throws StorageUnavailableException, InsufficientStorageCapacityException, ConcurrentOperationException;
184184

185185
void release(VirtualMachineProfile<? extends VMInstanceVO> profile);
186186

‎server/src/com/cloud/storage/StorageManagerImpl.java‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
358358
private double _storageAllocatedThreshold = 1.0d;
359359
protected BigDecimal _storageOverprovisioningFactor = new BigDecimal(1);
360360

361+
private boolean _recreateSystemVmEnabled;
362+
361363
public boolean share(VMInstanceVO vm, List<VolumeVO> vols, HostVO host, boolean cancelPreviousShare) throws StorageUnavailableException {
362364

363365
// if pool is in maintenance and it is the ONLY pool available; reject
@@ -958,6 +960,9 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
958960
value = configDao.getValue(Config.CopyVolumeWait.toString());
959961
_copyvolumewait = NumbersUtil.parseInt(value, Integer.parseInt(Config.CopyVolumeWait.getDefaultValue()));
960962

963+
value = configDao.getValue(Config.RecreateSystemVmEnabled.key());
964+
_recreateSystemVmEnabled = Boolean.parseBoolean(value);
965+
961966
value = configDao.getValue(Config.StorageTemplateCleanupEnabled.key());
962967
_templateCleanupEnabled = (value == null ? true : Boolean.parseBoolean(value));
963968

@@ -3217,7 +3222,7 @@ public boolean StorageMigration(VirtualMachineProfile<? extends VirtualMachine>
32173222
}
32183223

32193224
@Override
3220-
public void prepare(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, boolean recreate) throws StorageUnavailableException, InsufficientStorageCapacityException {
3225+
public void prepare(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest) throws StorageUnavailableException, InsufficientStorageCapacityException {
32213226

32223227
if (dest == null) {
32233228
if (s_logger.isDebugEnabled()) {
@@ -3229,6 +3234,8 @@ public void prepare(VirtualMachineProfile<? extends VirtualMachine> vm, DeployDe
32293234
if (s_logger.isDebugEnabled()) {
32303235
s_logger.debug("Checking if we need to prepare " + vols.size() + " volumes for " + vm);
32313236
}
3237+
3238+
boolean recreate = _recreateSystemVmEnabled;
32323239

32333240
List<VolumeVO> recreateVols = new ArrayList<VolumeVO>(vols.size());
32343241

‎server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,15 +1469,6 @@ public boolean unplugNic(Network network, NicTO nic, VirtualMachineTO vm,
14691469
throw new UnsupportedOperationException("Unplug nic is not supported for vm of type " + vm.getType());
14701470
}
14711471

1472-
1473-
@Override
1474-
public boolean recreateNeeded(
1475-
VirtualMachineProfile<SecondaryStorageVmVO> profile, long hostId,
1476-
Commands cmds, ReservationContext context) {
1477-
// TODO Auto-generated method stub
1478-
return false;
1479-
}
1480-
14811472
@Override
14821473
public void prepareStop(VirtualMachineProfile<SecondaryStorageVmVO> profile) {
14831474

‎server/src/com/cloud/vm/UserVmManagerImpl.java‎

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3620,15 +3620,6 @@ public UserVm moveVMToUser(AssignVMCmd cmd) throws ResourceAllocationException,
36203620
return vm;
36213621
}
36223622

3623-
3624-
@Override
3625-
public boolean recreateNeeded(VirtualMachineProfile<UserVmVO> profile,
3626-
long hostId, Commands cmds, ReservationContext context) {
3627-
// TODO Auto-generated method stub
3628-
return false;
3629-
}
3630-
3631-
36323623
@Override
36333624
public UserVm restoreVM(RestoreVMCmd cmd) {
36343625
// Input validation

‎server/src/com/cloud/vm/VirtualMachineGuru.java‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ public interface VirtualMachineGuru<T extends VirtualMachine> {
6969

7070
void finalizeExpunge(T vm);
7171

72-
boolean recreateNeeded(VirtualMachineProfile<T> profile, long hostId, Commands cmds, ReservationContext context);
73-
7472
/**
7573
* Returns the id parsed from the name. If it cannot parse the name,
7674
* then return null. This method is used to determine if this is
@@ -82,7 +80,6 @@ public interface VirtualMachineGuru<T extends VirtualMachine> {
8280
Long convertToId(String vmName);
8381

8482
/**
85-
<<<<<<< HEAD
8683
* Prepare for a nic to be plugged into the network.
8784
* @param network
8885
* @param nic

0 commit comments

Comments
 (0)