From 15a8c015eaeff003a02fae01ddce8b525a3e5a61 Mon Sep 17 00:00:00 2001 From: Abhinandan Prateek Date: Wed, 2 Nov 2011 17:47:08 +0530 Subject: [PATCH] bug 11678: added vm.destory.forcestop config var to set force when destroying a vm --- server/src/com/cloud/configuration/Config.java | 3 ++- server/src/com/cloud/vm/VirtualMachineManagerImpl.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java index aee5fd1be72..190de310710 100755 --- a/server/src/com/cloud/configuration/Config.java +++ b/server/src/com/cloud/configuration/Config.java @@ -194,7 +194,8 @@ 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), UseUserConcentratedPodAllocation("Advanced", ManagementServer.class, Boolean.class, "use.user.concentrated.pod.allocation", "true", "If true, deployment planner applies the user concentration heuristic during VM resource allocation", "true,false"), diff --git a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java index 2506606e8c8..b89574351dd 100755 --- a/server/src/com/cloud/vm/VirtualMachineManagerImpl.java +++ b/server/src/com/cloud/vm/VirtualMachineManagerImpl.java @@ -215,6 +215,8 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene protected StoragePoolDao _storagePoolDao; @Inject protected HypervisorGuruManager _hvGuruMgr; + @Inject + protected ConfigurationDao _configDao; @Inject(adapter = DeploymentPlanner.class) protected Adapters _planners; @@ -1138,8 +1140,8 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Listene } return true; } - - if (!advanceStop(vm, false, user, caller)) { + boolean forceStop = Boolean.parseBoolean(_configDao.getValue("vm.destory.forcestop")); + if (!advanceStop(vm, forceStop, user, caller)) { s_logger.debug("Unable to stop " + vm); return false; }