cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/4.4 to 0b31732
Date Thu, 09 Oct 2014 08:50:31 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 63fbd16dd -> 0b31732bb


CLOUDSTACK-6023: Non windows instances are created on XenServer with a vcpu-max above supported
xenserver limits

Changed the VCPU max limit to 16 and provided a cluster level configuration parameter for
this max limit named xen.vm.vcpu.max
(cherry picked from commit 95e41fdf0da50c165a9317847058fce4efeddbcf)

Signed-off-by: Animesh Chaturvedi <animesh@apache.org>


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

Branch: refs/heads/4.4
Commit: 0b31732bb18983db6cdd747a6c2f6056cf81a85e
Parents: 63fbd16
Author: Harikrishna Patnala <harikrishna.patnala@citrix.com>
Authored: Fri Feb 7 16:44:11 2014 +0530
Committer: Wei Zhou <w.zhou@tech.leaseweb.com>
Committed: Thu Oct 2 12:18:13 2014 +0200

----------------------------------------------------------------------
 .../cloud/agent/api/to/VirtualMachineTO.java    |  9 ++++++
 .../src/com/cloud/hypervisor/XenServerGuru.java | 30 +++++++++++++++++++-
 .../xen/resource/CitrixResourceBase.java        | 23 ++++++++-------
 3 files changed, 50 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0b31732b/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 45bad79..04943c8 100644
--- a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
+++ b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
@@ -62,6 +62,7 @@ public class VirtualMachineTO {
     DiskTO[] disks;
     NicTO[] nics;
     GPUDeviceTO gpuDevice;
+    Integer vcpuMaxLimit;
 
     public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus,
Integer speed, long minRam, long maxRam, BootloaderType bootloader,
             String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
@@ -284,4 +285,12 @@ public class VirtualMachineTO {
         this.platformEmulator = platformEmulator;
     }
 
+    public Integer getVcpuMaxLimit() {
+        return vcpuMaxLimit;
+    }
+
+    public void setVcpuMaxLimit(Integer vcpuMaxLimit) {
+        this.vcpuMaxLimit = vcpuMaxLimit;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0b31732b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
index 5f8b031..63e7989 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
@@ -26,11 +26,13 @@ import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
 import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
 import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
+import org.apache.cloudstack.framework.config.Configurable;
 import org.apache.cloudstack.hypervisor.xenserver.XenserverConfigs;
 import org.apache.cloudstack.storage.command.CopyCommand;
 import org.apache.cloudstack.storage.command.DettachCommand;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.cloudstack.framework.config.ConfigKey;
 
 import com.cloud.agent.api.Command;
 import com.cloud.agent.api.to.DataObjectType;
@@ -50,11 +52,14 @@ import com.cloud.storage.dao.GuestOSHypervisorDao;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.template.VirtualMachineTemplate.BootloaderType;
 import com.cloud.utils.Pair;
+import com.cloud.vm.UserVmVO;
 import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachineProfile;
+import com.cloud.vm.dao.UserVmDao;
+
 
 @Local(value = HypervisorGuru.class)
-public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru {
+public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru, Configurable{
     @Inject
     GuestOSDao _guestOsDao;
     @Inject
@@ -69,6 +74,11 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
     PrimaryDataStoreDao _storagePoolDao;
     @Inject
     VolumeDataFactory _volFactory;
+    @Inject
+    UserVmDao _userVmDao;
+
+    static final ConfigKey<Integer> MaxNumberOfVCPUSPerVM = new ConfigKey<Integer>("Advanced",
Integer.class, "xen.vm.vcpu.max", "16",
+            "Maximum number of VCPUs that VM can get in XenServer.", true, ConfigKey.Scope.Cluster);
 
     protected XenServerGuru() {
         super();
@@ -86,6 +96,14 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
             bt = vm.getBootLoaderType();
         }
         VirtualMachineTO to = toVirtualMachineTO(vm);
+        UserVmVO userVmVO = _userVmDao.findById(vm.getId());
+        if (userVmVO != null) {
+            HostVO host = hostDao.findById(userVmVO.getHostId());
+            if (host != null) {
+                to.setVcpuMaxLimit(MaxNumberOfVCPUSPerVM.valueIn(host.getClusterId()));
+            }
+        }
+
         to.setBootloader(bt);
 
         // Determine the VM's OS description
@@ -171,4 +189,14 @@ public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru
         }
         return new Pair<Boolean, Long>(Boolean.FALSE, new Long(hostId));
     }
+
+    @Override
+    public String getConfigComponentName() {
+        return XenServerGuru.class.getSimpleName();
+    }
+
+    @Override
+    public ConfigKey<?>[] getConfigKeys() {
+        return new ConfigKey<?>[] {MaxNumberOfVCPUSPerVM};
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0b31732b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
index a399c98..26cb8ba 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/xen/resource/CitrixResourceBase.java
@@ -1314,6 +1314,8 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
         vmr.nameLabel = vmSpec.getName();
         vmr.actionsAfterCrash = Types.OnCrashBehaviour.DESTROY;
         vmr.actionsAfterShutdown = Types.OnNormalExit.DESTROY;
+        vmr.VCPUsMax = (long) vmSpec.getCpus(); // FIX ME: In case of dynamic scaling this
VCPU max should be the minumum of
+                                                // recommended value for that template and
capacity remaining on host
 
         if (isDmcEnabled(conn, host) && vmSpec.isEnableDynamicallyScaleVm()) {
             //scaling is allowed
@@ -1321,6 +1323,14 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
             vmr.memoryStaticMax = getStaticMax(vmSpec.getOs(), vmSpec.getBootloader() ==
BootloaderType.CD, vmSpec.getMinRam(), vmSpec.getMaxRam());
             vmr.memoryDynamicMin = vmSpec.getMinRam();
             vmr.memoryDynamicMax = vmSpec.getMaxRam();
+
+            if (guestOsTypeName.toLowerCase().contains("windows")) {
+                vmr.VCPUsMax = (long) vmSpec.getCpus();
+            } else {
+                if (vmSpec.getVcpuMaxLimit() != null) {
+                    vmr.VCPUsMax = (long) vmSpec.getVcpuMaxLimit();
+                }
+            }
         } else {
             //scaling disallowed, set static memory target
             if (vmSpec.isEnableDynamicallyScaleVm() && !isDmcEnabled(conn, host))
{
@@ -1330,20 +1340,11 @@ public abstract class CitrixResourceBase implements ServerResource,
HypervisorRe
             vmr.memoryStaticMax = vmSpec.getMaxRam();
             vmr.memoryDynamicMin = vmSpec.getMinRam();
             vmr.memoryDynamicMax = vmSpec.getMaxRam();
-        }
 
-        if (guestOsTypeName.toLowerCase().contains("windows")) {
-            vmr.VCPUsMax = (long)vmSpec.getCpus();
-        } else {
-            // XenServer has a documented limit of 16 vcpus per vm
-            vmr.VCPUsMax = 2L * vmSpec.getCpus();
-            if (vmr.VCPUsMax > 16)
-            {
-                vmr.VCPUsMax = 16L;
-            }
+            vmr.VCPUsMax = (long) vmSpec.getCpus();
         }
 
-        vmr.VCPUsAtStartup = (long)vmSpec.getCpus();
+        vmr.VCPUsAtStartup = (long) vmSpec.getCpus();
         vmr.consoles.clear();
 
         VM vm = VM.create(conn, vmr);


Mime
View raw message