cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ni...@apache.org
Subject git commit: updated refs/heads/4.3-forward to 95e41fd
Date Fri, 07 Feb 2014 21:12:35 GMT
Updated Branches:
  refs/heads/4.3-forward f0b861fed -> 95e41fdf0


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


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

Branch: refs/heads/4.3-forward
Commit: 95e41fdf0da50c165a9317847058fce4efeddbcf
Parents: f0b861f
Author: Harikrishna Patnala <harikrishna.patnala@citrix.com>
Authored: Fri Feb 7 16:44:11 2014 +0530
Committer: Nitin Mehta <nitin.mehta@citrix.com>
Committed: Fri Feb 7 12:50:55 2014 -0800

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/95e41fdf/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 e6240ff..a5860d7 100644
--- a/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
+++ b/api/src/com/cloud/agent/api/to/VirtualMachineTO.java
@@ -60,6 +60,7 @@ public class VirtualMachineTO {
 
     DiskTO[] disks;
     NicTO[] nics;
+    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) {
         this.id = id;
@@ -263,5 +264,13 @@ public class VirtualMachineTO {
         this.uuid = uuid;
     }
 
+    public Integer getVcpuMaxLimit() {
+        return vcpuMaxLimit;
+    }
+
+    public void setVcpuMaxLimit(Integer vcpuMaxLimit) {
+        this.vcpuMaxLimit = vcpuMaxLimit;
+    }
+
 
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/95e41fdf/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 28bd724..47ab90a 100644
--- a/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
+++ b/plugins/hypervisors/xen/src/com/cloud/hypervisor/XenServerGuru.java
@@ -35,19 +35,24 @@ import com.cloud.storage.dao.GuestOSDao;
 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;
 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.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;
+
 
 @Local(value=HypervisorGuru.class)
-public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru {
+public class XenServerGuru extends HypervisorGuruBase implements HypervisorGuru, Configurable{
     @Inject GuestOSDao _guestOsDao;
     @Inject
     EndPointSelector endPointSelector;
@@ -59,6 +64,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();
@@ -76,6 +86,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
@@ -151,4 +169,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/95e41fdf/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 aa1ef83..b398ca5 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
@@ -1265,6 +1265,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
@@ -1272,6 +1274,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))
{
@@ -1281,12 +1291,8 @@ 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 {
-            vmr.VCPUsMax = 32L;
         }
 
         vmr.VCPUsAtStartup = (long) vmSpec.getCpus();


Mime
View raw message