cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h...@apache.org
Subject git commit: updated refs/heads/master to accfccd
Date Fri, 12 Apr 2013 11:49:53 GMT
Updated Branches:
  refs/heads/master c0419791e -> accfccd83


Summary: Add support for nested hypervisors to the VmWare resource.

Add a flag VmDetailConstants.NESTED_VIRTUALIZATION_FLAG
Add an advanced config uption VmwareEnableNestedVirtualization

Depending on the settings of the flags and the capabilities of the target hypervisor the nested
virtualization option will be set on guest VMs. It's a global setting intended only for developers
to support cloud-in-a-cloud deployments.


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

Branch: refs/heads/master
Commit: accfccd83e11d0b12eccebde940c705e49eec913
Parents: c041979
Author: Hugo Trippaers <trippie@gmail.com>
Authored: Fri Apr 12 12:54:57 2013 +0200
Committer: Hugo Trippaers <trippie@gmail.com>
Committed: Fri Apr 12 13:49:42 2013 +0200

----------------------------------------------------------------------
 core/src/com/cloud/vm/VmDetailConstants.java       |    1 +
 .../src/com/cloud/hypervisor/guru/VMwareGuru.java  |   19 ++++++++++++++-
 .../hypervisor/vmware/resource/VmwareResource.java |   18 ++++++++++++++
 server/src/com/cloud/configuration/Config.java     |    1 +
 4 files changed, 38 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/accfccd8/core/src/com/cloud/vm/VmDetailConstants.java
----------------------------------------------------------------------
diff --git a/core/src/com/cloud/vm/VmDetailConstants.java b/core/src/com/cloud/vm/VmDetailConstants.java
index 90068d1..5ff3ce0 100644
--- a/core/src/com/cloud/vm/VmDetailConstants.java
+++ b/core/src/com/cloud/vm/VmDetailConstants.java
@@ -20,4 +20,5 @@ public interface VmDetailConstants {
 	public static final String KEYBOARD = "keyboard";
 	public static final String NIC_ADAPTER = "nicAdapter";
 	public static final String ROOK_DISK_CONTROLLER = "rootDiskController";
+	public static final String NESTED_VIRTUALIZATION_FLAG = "nestedVirtualizationFlag";
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/accfccd8/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
index 2014697..f6f0923 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/guru/VMwareGuru.java
@@ -27,6 +27,7 @@ import java.util.Map;
 import javax.ejb.Local;
 import javax.inject.Inject;
 
+import org.apache.cloudstack.api.ApiConstants.VMDetails;
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
 
@@ -40,6 +41,8 @@ import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
 import com.cloud.agent.api.to.NicTO;
 import com.cloud.agent.api.to.VirtualMachineTO;
 import com.cloud.cluster.ClusterManager;
+import com.cloud.configuration.Config;
+import com.cloud.configuration.dao.ConfigurationDao;
 import com.cloud.exception.InsufficientAddressCapacityException;
 import com.cloud.host.HostVO;
 import com.cloud.host.dao.HostDao;
@@ -84,6 +87,7 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru
{
     @Inject VmwareManager _vmwareMgr;
     @Inject SecondaryStorageVmManager _secStorageMgr;
     @Inject NetworkModel _networkMgr;
+    @Inject ConfigurationDao _configDao;
 
     protected VMwareGuru() {
         super();
@@ -212,8 +216,21 @@ public class VMwareGuru extends HypervisorGuruBase implements HypervisorGuru
{
             sbMacSequence.deleteCharAt(sbMacSequence.length() - 1);
             String bootArgs = to.getBootArgs();
             to.setBootArgs(bootArgs + " nic_macs=" + sbMacSequence.toString());
+            
+        }
+        
+        // Don't do this if the virtual machine is one of the special types
+        // Should only be done on user machines
+        if(!(vm.getVirtualMachine() instanceof DomainRouterVO || vm.getVirtualMachine() instanceof
ConsoleProxyVO 
+                || vm.getVirtualMachine() instanceof SecondaryStorageVmVO)) {
+            String nestedVirt = _configDao.getValue(Config.VmwareEnableNestedVirtualization.key());
+            if (nestedVirt != null) {
+                s_logger.debug("Nested virtualization requested, adding flag to vm configuration");
+                details.put(VmDetailConstants.NESTED_VIRTUALIZATION_FLAG, nestedVirt);
+                to.setDetails(details);
+                
+            }
         }
-
         // Determine the VM's OS description
         GuestOSVO guestOS = _guestOsDao.findById(vm.getVirtualMachine().getGuestOSId());
         to.setOs(guestOS.getDisplayName());

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/accfccd8/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
index 634827b..f569595 100755
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/resource/VmwareResource.java
@@ -232,6 +232,7 @@ import com.vmware.vim25.ClusterDasConfigInfo;
 import com.vmware.vim25.ComputeResourceSummary;
 import com.vmware.vim25.DatastoreSummary;
 import com.vmware.vim25.DynamicProperty;
+import com.vmware.vim25.HostCapability;
 import com.vmware.vim25.HostFirewallInfo;
 import com.vmware.vim25.HostFirewallRuleset;
 import com.vmware.vim25.HostNetworkTrafficShapingPolicy;
@@ -2147,6 +2148,23 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
             VmwareHelper.setBasicVmConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(),
             vmSpec.getMinSpeed(),(int) (vmSpec.getMaxRam()/(1024*1024)), ramMb,
             translateGuestOsIdentifier(vmSpec.getArch(), vmSpec.getOs()).value(), vmSpec.getLimitCpuUse());
+           
+            if ("true".equals(vmSpec.getDetails().get(VmDetailConstants.NESTED_VIRTUALIZATION_FLAG)))
{
+                s_logger.debug("Nested Virtualization enabled in configuration, checking
hypervisor capability");
+                ManagedObjectReference hostMor = vmMo.getRunningHost().getMor();
+                ManagedObjectReference computeMor = context.getVimClient().getMoRefProp(hostMor,
"parent");
+                ManagedObjectReference environmentBrowser = 
+                        context.getVimClient().getMoRefProp(computeMor, "environmentBrowser");
+                HostCapability hostCapability = context.getService().queryTargetCapabilities(environmentBrowser,
hostMor);
+                if (hostCapability.isNestedHVSupported()) {
+                    s_logger.debug("Hypervisor supports nested virtualization, enabling for
VM " + vmSpec.getName());
+                    vmConfigSpec.setNestedHVEnabled(true);                   
+                }
+                else {
+                	s_logger.warn("Hypervisor doesn't support nested virtualization, unable
to set config for VM " +vmSpec.getName());
+                	vmConfigSpec.setNestedHVEnabled(false);
+                }
+            }
 
             VirtualDeviceConfigSpec[] deviceConfigSpecArray = new VirtualDeviceConfigSpec[totalChangeDevices];
             int i = 0;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/accfccd8/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 2137c00..e3e3053 100755
--- a/server/src/com/cloud/configuration/Config.java
+++ b/server/src/com/cloud/configuration/Config.java
@@ -276,6 +276,7 @@ public enum Config {
     VmwareRootDiskControllerType("Advanced", ManagementServer.class, String.class, "vmware.root.disk.controller",
"ide", "Specify the default disk controller for root volumes, valid values are scsi, ide",
null),
     VmwareSystemVmNicDeviceType("Advanced", ManagementServer.class, String.class, "vmware.systemvm.nic.device.type",
"E1000", "Specify the default network device type for system VMs, valid values are E1000,
PCNet32, Vmxnet2, Vmxnet3", null),
     VmwareRecycleHungWorker("Advanced", ManagementServer.class, Boolean.class, "vmware.recycle.hung.wokervm",
"false", "Specify whether or not to recycle hung worker VMs", null),
+    VmwareEnableNestedVirtualization("Advanced", ManagementServer.class, Boolean.class, "vmware.nested.virtualization",
"false", "When set to true this will enable nested virtualization when this is supported by
the hypervisor", null),
 
     // Midonet
     MidoNetAPIServerAddress("Network", ManagementServer.class, String.class, "midonet.apiserver.address",
"http://localhost:8081", "Specify the address at which the Midonet API server can be contacted
(if using Midonet)", null),


Mime
View raw message