cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sate...@apache.org
Subject [08/50] [abbrv] git commit: updated refs/heads/vmware-datamodel to 6a8c2bd
Date Fri, 31 May 2013 07:49:06 GMT
CLOUDSTACK-2060
Global config to turn off dynamically scale vm functionality


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/8d1189c2
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/8d1189c2
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/8d1189c2

Branch: refs/heads/vmware-datamodel
Commit: 8d1189c2ae87216bc1c4a1443f75e9a8629abdc2
Parents: cea9e39
Author: Nitin Mehta <nitin.mehta@citrix.com>
Authored: Wed May 29 19:01:23 2013 +0530
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Wed May 29 19:02:06 2013 +0530

----------------------------------------------------------------------
 .../com/cloud/agent/api/to/VirtualMachineTO.java   |    9 +++++++++
 .../xen/resource/XenServer56FP1Resource.java       |    2 +-
 server/src/com/cloud/configuration/Config.java     |    3 ++-
 .../com/cloud/hypervisor/HypervisorGuruBase.java   |    9 ++++++++-
 server/src/com/cloud/vm/UserVmManagerImpl.java     |    8 ++++++++
 setup/db/db/schema-410to420.sql                    |    4 ++++
 6 files changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d1189c2/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
----------------------------------------------------------------------
diff --git a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
index b84d20a..46ee01b 100644
--- a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
+++ b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
@@ -52,6 +52,7 @@ public class VirtualMachineTO {
     boolean rebootOnCrash;
     boolean enableHA;
     boolean limitCpuUse;
+    boolean enableDynamicallyScaleVm;
     String vncPassword;
     String vncAddr;
     Map<String, String> params;
@@ -102,6 +103,14 @@ public class VirtualMachineTO {
         this.id = id;
     }
 
+    public boolean isEnableDynamicallyScaleVm() {
+        return enableDynamicallyScaleVm;
+    }
+
+    public void setEnableDynamicallyScaleVm(boolean enableDynamicallyScaleVm) {
+        this.enableDynamicallyScaleVm = enableDynamicallyScaleVm;
+    }
+
     public String getName() {
         return name;
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d1189c2/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
index 54aeef5..8e37809 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/XenServer56FP1Resource.java
@@ -137,7 +137,7 @@ public class XenServer56FP1Resource extends XenServer56Resource {
         vmr.actionsAfterCrash = Types.OnCrashBehaviour.DESTROY;
         vmr.actionsAfterShutdown = Types.OnNormalExit.DESTROY;
 
-        if (isDmcEnabled(conn, host)) {
+        if (isDmcEnabled(conn, host) && vmSpec.isEnableDynamicallyScaleVm()) {
             //scaling is allowed
             vmr.memoryStaticMin = mem_128m; //128MB
             //TODO: Remove hardcoded 8GB and assign proportionate to ServiceOffering and
mem overcommit ratio

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d1189c2/server/src/com/cloud/configuration/Config.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/configuration/Config.java b/server/src/com/cloud/configuration/Config.java
index 7c88aae..929d56b 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -180,7 +180,8 @@ public enum Config {
     RouterTemplateLXC("Advanced", NetworkManager.class, String.class, "router.template.lxc",
"SystemVM Template (LXC)", "Name of the default router template on LXC.", null, ConfigurationParameterScope.zone.toString()),
     RouterExtraPublicNics("Advanced", NetworkManager.class, Integer.class, "router.extra.public.nics",
"2", "specify extra public nics used for virtual router(up to 5)", "0-5"),
 	StartRetry("Advanced", AgentManager.class, Integer.class, "start.retry", "10", "Number of
times to retry create and start commands", null),
-    ScaleRetry("Advanced", AgentManager.class, Integer.class, "scale.retry", "2", "Number
of times to retry scaling up the vm", null),
+    EnableDynamicallyScaleVm("Advanced", ManagementServer.class, Boolean.class, "enable.dynamic.scale.vm",
"false", "Enables/Diables dynamically scaling a vm", null, ConfigurationParameterScope.zone.toString()),
+    ScaleRetry("Advanced", ManagementServer.class, Integer.class, "scale.retry", "2", "Number
of times to retry scaling up the vm", null),
     StopRetryInterval("Advanced", HighAvailabilityManager.class, Integer.class, "stop.retry.interval",
"600", "Time in seconds between retries to stop or destroy a vm" , null),
 	StorageCleanupInterval("Advanced", StorageManager.class, Integer.class, "storage.cleanup.interval",
"86400", "The interval (in seconds) to wait before running the storage cleanup thread.", null),
 	StorageCleanupEnabled("Advanced", StorageManager.class, Boolean.class, "storage.cleanup.enabled",
"true", "Enables/disables the storage cleanup thread.", null),

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d1189c2/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
index ea4fcc1..d8945af 100644
--- a/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
+++ b/server/src/com/cloud/hypervisor/HypervisorGuruBase.java
@@ -25,7 +25,9 @@ import com.cloud.agent.api.Command;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.agent.api.to.VolumeTO;
+import com.cloud.configuration.Config;
 import com.cloud.offering.ServiceOffering;
+import com.cloud.server.ConfigurationServer;
 import com.cloud.storage.dao.VMTemplateDetailsDao;
 import com.cloud.utils.component.AdapterBase;
 import com.cloud.vm.NicProfile;
@@ -43,6 +45,8 @@ public abstract class HypervisorGuruBase extends AdapterBase implements
Hypervis
     @Inject NicDao _nicDao;
     @Inject VMInstanceDao _virtualMachineDao;
     @Inject NicSecondaryIpDao _nicSecIpDao;
+    @Inject ConfigurationServer _configServer;
+
 
     protected HypervisorGuruBase() {
         super();
@@ -121,7 +125,10 @@ public abstract class HypervisorGuruBase extends AdapterBase implements
Hypervis
         // Workaround to make sure the TO has the UUID we need for Niciri integration
         VMInstanceVO vmInstance = _virtualMachineDao.findById(to.getId());
         to.setUuid(vmInstance.getUuid());
-        
+
+        //
+        to.setEnableDynamicallyScaleVm(Boolean.parseBoolean(_configServer.getConfigValue(Config.EnableDynamicallyScaleVm.key(),
Config.ConfigurationParameterScope.zone.toString(), vm.getDataCenterId())));
+
         return to;
     }
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d1189c2/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/UserVmManagerImpl.java b/server/src/com/cloud/vm/UserVmManagerImpl.java
index 5657877..a734d44 100755
--- a/server/src/com/cloud/vm/UserVmManagerImpl.java
+++ b/server/src/com/cloud/vm/UserVmManagerImpl.java
@@ -32,6 +32,7 @@ import javax.ejb.Local;
 import javax.inject.Inject;
 import javax.naming.ConfigurationException;
 
+import com.cloud.server.ConfigurationServer;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.acl.SecurityChecker.AccessType;
 import org.apache.cloudstack.affinity.AffinityGroupVO;
@@ -400,6 +401,8 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
     AffinityGroupVMMapDao _affinityGroupVMMapDao;
     @Inject
     AffinityGroupDao _affinityGroupDao;
+    @Inject
+    ConfigurationServer _configServer;
 
     protected ScheduledExecutorService _executor = null;
     protected int _expungeInterval;
@@ -1141,6 +1144,11 @@ public class UserVmManagerImpl extends ManagerBase implements UserVmManager,
Use
         boolean success = false;
         if(vmInstance.getState().equals(State.Running)){
             int retry = _scaleRetry;
+            boolean enableDynamicallyScaleVm = Boolean.parseBoolean(_configServer.getConfigValue(Config.EnableDynamicallyScaleVm.key(),
Config.ConfigurationParameterScope.zone.toString(), vmInstance.getDataCenterId()));
+            if(!enableDynamicallyScaleVm){
+               throw new PermissionDeniedException("Dynamically scaling virtual machines
is disabled for this zone, please contact your admin");
+            }
+
             // Increment CPU and Memory count accordingly.
             if (newCpu > currentCpu) {
                 _resourceLimitMgr.incrementResourceCount(caller.getAccountId(), ResourceType.cpu,
new Long (newCpu - currentCpu));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8d1189c2/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------
diff --git a/setup/db/db/schema-410to420.sql b/setup/db/db/schema-410to420.sql
index ec79237..e081a25 100644
--- a/setup/db/db/schema-410to420.sql
+++ b/setup/db/db/schema-410to420.sql
@@ -1712,6 +1712,10 @@ update `cloud`.`vpc_gateways` set network_acl_id = 2;
 
 INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'VpcManager', 'blacklisted.routes',
NULL, 'Routes that are blacklisted, can not be used for Static Routes creation for the VPC
Private Gateway');
 
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server',
'enable.dynamic.scale.vm', 'false', 'Enables/Diables dynamically scaling a vm');
+
+INSERT IGNORE INTO `cloud`.`configuration` VALUES ('Advanced', 'DEFAULT', 'management-server',
'scale.retry', '2', 'Number of times to retry scaling up the vm');
+
 UPDATE `cloud`.`snapshots` set swift_id=null where swift_id=0;
 
 


Mime
View raw message