bug 11678: added vm.destory.forcestop config var to set force when destroying a vm

This commit is contained in:
Abhinandan Prateek 2011-11-03 15:51:02 +05:30
parent 267b12d015
commit fab2d1f880
3 changed files with 6 additions and 2 deletions

View File

@ -203,6 +203,7 @@ public enum Config {
CapacitySkipcountingHours("Advanced", ManagementServer.class, Integer.class, "capacity.skipcounting.hours", "3600", "Time (in seconds) to wait before release VM's cpu and memory when VM in stopped state", null),
VmStatsInterval("Advanced", ManagementServer.class, Integer.class, "vm.stats.interval", "60000", "The interval (in milliseconds) when vm stats are retrieved from agents.", null),
VmTransitionWaitInterval("Advanced", ManagementServer.class, Integer.class, "vm.tranisition.wait.interval", "3600", "Time (in seconds) to wait before taking over a VM in transition state", null),
VmDestroyForcestop("Advanced", ManagementServer.class, Boolean.class, "vm.destory.forcestop", "false", "On destory, force-stop takes this value ", null),
ControlCidr("Advanced", ManagementServer.class, String.class, "control.cidr", "169.254.0.0/16", "Changes the cidr for the control network traffic. Defaults to using link local. Must be unique within pods", null),
ControlGateway("Advanced", ManagementServer.class, String.class, "control.gateway", "169.254.0.1", "gateway for the control network traffic", null),

View File

@ -243,6 +243,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
protected long _cancelWait;
protected long _opWaitInterval;
protected int _lockStateRetry;
protected boolean _forceStop;
@Override
public <T extends VMInstanceVO> void registerGuru(VirtualMachine.Type type, VirtualMachineGuru<T> guru) {
@ -432,7 +433,8 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
_opWaitInterval = NumbersUtil.parseLong(params.get(Config.VmOpWaitInterval.key()), 120) * 1000;
_lockStateRetry = NumbersUtil.parseInt(params.get(Config.VmOpLockStateRetry.key()), 5);
_operationTimeout = NumbersUtil.parseInt(params.get(Config.Wait.key()), 1800) * 2;
_forceStop = Boolean.parseBoolean(params.get(Config.VmDestroyForcestop.key()));
_executor = Executors.newScheduledThreadPool(1, new NamedThreadFactory("Vm-Operations-Cleanup"));
_nodeId = _clusterMgr.getManagementNodeId();
@ -1151,7 +1153,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene
return true;
}
if (!advanceStop(vm, false, user, caller)) {
if (!advanceStop(vm, _forceStop, user, caller)) {
s_logger.debug("Unable to stop " + vm);
return false;
}

View File

@ -60,4 +60,5 @@ update host_details set name='memory' where host_id in (select id from host wher
update host_details set name='privateip' where host_id in (select id from host where hypervisor_type='BareMetal') and name='agentIp';
INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'management-server', 'vmware.root.disk.controller', 'ide', 'Specify the default disk controller for root volumes, valid values are scsi, ide');
INSERT IGNORE INTO configuration VALUES ('Advanced', 'DEFAULT', 'management-server', 'vm.destory.forcestop', 'false', 'On destory, force-stop takes this value');