cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sate...@apache.org
Subject git commit: updated refs/heads/master-6-17-stable to 12b39cf
Date Mon, 08 Jul 2013 15:39:22 GMT
Updated Branches:
  refs/heads/master-6-17-stable d01afe0cd -> 12b39cfd2


CLOUDSTACK-3304 [Vmware][Dynamic Scaling] - Enforce checks for maximum hotadd memory limit
& memory increment size in CS

Retrieve maximum hotadd memory limit & hotadd memory increment size from running VM's
configuration to validate dynamic scale memory limit while scaling up a VM.

Signed-off-by: Sateesh Chodapuneedi <sateesh@apache.org>


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

Branch: refs/heads/master-6-17-stable
Commit: 12b39cfd2a6d4fd23a8e2782d46cb54447ba60b5
Parents: d01afe0
Author: Sateesh Chodapuneedi <sateesh@apache.org>
Authored: Mon Jul 8 21:05:09 2013 +0530
Committer: Sateesh Chodapuneedi <sateesh@apache.org>
Committed: Mon Jul 8 21:05:09 2013 +0530

----------------------------------------------------------------------
 .../vmware/resource/VmwareResource.java         | 182 +++++++++++--------
 .../hypervisor/vmware/mo/VirtualMachineMO.java  |  41 +++--
 2 files changed, 127 insertions(+), 96 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b39cfd/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 28aa551..b10ec76 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
@@ -31,9 +31,12 @@ import java.util.Comparator;
 import java.util.Date;
 import java.util.GregorianCalendar;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Random;
+import java.util.Set;
 import java.util.TimeZone;
 import java.util.UUID;
 
@@ -43,6 +46,49 @@ import javax.naming.ConfigurationException;
 import org.apache.log4j.Logger;
 import org.apache.log4j.NDC;
 
+import com.google.gson.Gson;
+import com.vmware.vim25.AboutInfo;
+import com.vmware.vim25.ClusterDasConfigInfo;
+import com.vmware.vim25.ComputeResourceSummary;
+import com.vmware.vim25.DatastoreSummary;
+import com.vmware.vim25.DynamicProperty;
+import com.vmware.vim25.GuestInfo;
+import com.vmware.vim25.GuestOsDescriptor;
+import com.vmware.vim25.HostCapability;
+import com.vmware.vim25.HostFirewallInfo;
+import com.vmware.vim25.HostFirewallRuleset;
+import com.vmware.vim25.HostNetworkTrafficShapingPolicy;
+import com.vmware.vim25.HostPortGroupSpec;
+import com.vmware.vim25.ManagedObjectReference;
+import com.vmware.vim25.ObjectContent;
+import com.vmware.vim25.OptionValue;
+import com.vmware.vim25.PerfCounterInfo;
+import com.vmware.vim25.PerfEntityMetric;
+import com.vmware.vim25.PerfEntityMetricBase;
+import com.vmware.vim25.PerfMetricId;
+import com.vmware.vim25.PerfMetricIntSeries;
+import com.vmware.vim25.PerfMetricSeries;
+import com.vmware.vim25.PerfQuerySpec;
+import com.vmware.vim25.PerfSampleInfo;
+import com.vmware.vim25.RuntimeFaultFaultMsg;
+import com.vmware.vim25.ToolsUnavailableFaultMsg;
+import com.vmware.vim25.VimPortType;
+import com.vmware.vim25.VirtualDevice;
+import com.vmware.vim25.VirtualDeviceConfigSpec;
+import com.vmware.vim25.VirtualDeviceConfigSpecOperation;
+import com.vmware.vim25.VirtualDisk;
+import com.vmware.vim25.VirtualEthernetCard;
+import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo;
+import com.vmware.vim25.VirtualLsiLogicController;
+import com.vmware.vim25.VirtualMachineConfigSpec;
+import com.vmware.vim25.VirtualMachineFileInfo;
+import com.vmware.vim25.VirtualMachineGuestOsIdentifier;
+import com.vmware.vim25.VirtualMachinePowerState;
+import com.vmware.vim25.VirtualMachineRelocateSpec;
+import com.vmware.vim25.VirtualMachineRelocateSpecDiskLocator;
+import com.vmware.vim25.VirtualMachineRuntimeInfo;
+import com.vmware.vim25.VirtualSCSISharing;
+
 import com.cloud.agent.IAgentControl;
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.AttachIsoCommand;
@@ -74,9 +120,6 @@ import com.cloud.agent.api.CreateVolumeFromSnapshotCommand;
 import com.cloud.agent.api.DeleteStoragePoolCommand;
 import com.cloud.agent.api.DeleteVMSnapshotAnswer;
 import com.cloud.agent.api.DeleteVMSnapshotCommand;
-import com.cloud.agent.api.MigrateWithStorageAnswer;
-import com.cloud.agent.api.MigrateWithStorageCommand;
-import com.cloud.agent.api.UnregisterVMCommand;
 import com.cloud.agent.api.GetDomRVersionAnswer;
 import com.cloud.agent.api.GetDomRVersionCmd;
 import com.cloud.agent.api.GetHostStatsAnswer;
@@ -94,6 +137,8 @@ import com.cloud.agent.api.ManageSnapshotAnswer;
 import com.cloud.agent.api.ManageSnapshotCommand;
 import com.cloud.agent.api.MigrateAnswer;
 import com.cloud.agent.api.MigrateCommand;
+import com.cloud.agent.api.MigrateWithStorageAnswer;
+import com.cloud.agent.api.MigrateWithStorageCommand;
 import com.cloud.agent.api.ModifySshKeysCommand;
 import com.cloud.agent.api.ModifyStoragePoolAnswer;
 import com.cloud.agent.api.ModifyStoragePoolCommand;
@@ -131,6 +176,7 @@ import com.cloud.agent.api.StopCommand;
 import com.cloud.agent.api.StoragePoolInfo;
 import com.cloud.agent.api.UnPlugNicAnswer;
 import com.cloud.agent.api.UnPlugNicCommand;
+import com.cloud.agent.api.UnregisterVMCommand;
 import com.cloud.agent.api.UpgradeSnapshotCommand;
 import com.cloud.agent.api.ValidateSnapshotAnswer;
 import com.cloud.agent.api.ValidateSnapshotCommand;
@@ -167,16 +213,16 @@ import com.cloud.agent.api.routing.VmDataCommand;
 import com.cloud.agent.api.routing.VpnUsersCfgCommand;
 import com.cloud.agent.api.storage.CopyVolumeAnswer;
 import com.cloud.agent.api.storage.CopyVolumeCommand;
-import com.cloud.agent.api.storage.CreateVolumeOVACommand;
+import com.cloud.agent.api.storage.CreateAnswer;
+import com.cloud.agent.api.storage.CreateCommand;
+import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer;
 import com.cloud.agent.api.storage.CreateVolumeOVAAnswer;
+import com.cloud.agent.api.storage.CreateVolumeOVACommand;
+import com.cloud.agent.api.storage.DestroyCommand;
 import com.cloud.agent.api.storage.MigrateVolumeAnswer;
 import com.cloud.agent.api.storage.MigrateVolumeCommand;
 import com.cloud.agent.api.storage.PrepareOVAPackingAnswer;
 import com.cloud.agent.api.storage.PrepareOVAPackingCommand;
-import com.cloud.agent.api.storage.CreateAnswer;
-import com.cloud.agent.api.storage.CreateCommand;
-import com.cloud.agent.api.storage.CreatePrivateTemplateAnswer;
-import com.cloud.agent.api.storage.DestroyCommand;
 import com.cloud.agent.api.storage.PrimaryStorageDownloadAnswer;
 import com.cloud.agent.api.storage.PrimaryStorageDownloadCommand;
 import com.cloud.agent.api.storage.ResizeVolumeAnswer;
@@ -201,8 +247,8 @@ import com.cloud.hypervisor.vmware.mo.CustomFieldConstants;
 import com.cloud.hypervisor.vmware.mo.CustomFieldsManagerMO;
 import com.cloud.hypervisor.vmware.mo.DatacenterMO;
 import com.cloud.hypervisor.vmware.mo.DatastoreMO;
-import com.cloud.hypervisor.vmware.mo.FeatureKeyConstants;
 import com.cloud.hypervisor.vmware.mo.DiskControllerType;
+import com.cloud.hypervisor.vmware.mo.FeatureKeyConstants;
 import com.cloud.hypervisor.vmware.mo.HostFirewallSystemMO;
 import com.cloud.hypervisor.vmware.mo.HostMO;
 import com.cloud.hypervisor.vmware.mo.HypervisorHostHelper;
@@ -249,53 +295,6 @@ import com.cloud.vm.VirtualMachine;
 import com.cloud.vm.VirtualMachine.State;
 import com.cloud.vm.VirtualMachineName;
 import com.cloud.vm.VmDetailConstants;
-import com.google.gson.Gson;
-import com.vmware.vim25.AboutInfo;
-import com.vmware.vim25.ClusterDasConfigInfo;
-import com.vmware.vim25.ComputeResourceSummary;
-import com.vmware.vim25.DatastoreSummary;
-import com.vmware.vim25.DynamicProperty;
-import com.vmware.vim25.GuestInfo;
-import com.vmware.vim25.GuestOsDescriptor;
-import com.vmware.vim25.HostCapability;
-import com.vmware.vim25.HostFirewallInfo;
-import com.vmware.vim25.HostFirewallRuleset;
-import com.vmware.vim25.HostNetworkTrafficShapingPolicy;
-import com.vmware.vim25.HostPortGroupSpec;
-import com.vmware.vim25.ManagedObjectReference;
-import com.vmware.vim25.ObjectContent;
-import com.vmware.vim25.OptionValue;
-import com.vmware.vim25.PerfCounterInfo;
-import com.vmware.vim25.PerfEntityMetric;
-import com.vmware.vim25.PerfEntityMetricBase;
-import com.vmware.vim25.PerfMetricId;
-import com.vmware.vim25.PerfMetricIntSeries;
-import com.vmware.vim25.PerfMetricSeries;
-import com.vmware.vim25.PerfQuerySpec;
-import com.vmware.vim25.PerfSampleInfo;
-import com.vmware.vim25.RuntimeFaultFaultMsg;
-import com.vmware.vim25.ToolsUnavailableFaultMsg;
-import com.vmware.vim25.VimPortType;
-import com.vmware.vim25.VirtualDevice;
-import com.vmware.vim25.VirtualDeviceConfigSpec;
-import com.vmware.vim25.VirtualDeviceConfigSpecOperation;
-import com.vmware.vim25.VirtualDisk;
-import com.vmware.vim25.VirtualEthernetCard;
-import com.vmware.vim25.VirtualEthernetCardNetworkBackingInfo;
-import com.vmware.vim25.VirtualLsiLogicController;
-import com.vmware.vim25.VirtualMachineConfigOption;
-import com.vmware.vim25.VirtualMachineConfigSpec;
-import com.vmware.vim25.VirtualMachineFileInfo;
-import com.vmware.vim25.VirtualMachineGuestOsIdentifier;
-import com.vmware.vim25.VirtualMachinePowerState;
-import com.vmware.vim25.VirtualMachineRelocateSpec;
-import com.vmware.vim25.VirtualMachineRelocateSpecDiskLocator;
-import com.vmware.vim25.VirtualMachineRuntimeInfo;
-import com.vmware.vim25.VirtualSCSISharing;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.Map.Entry;
 
 public class VmwareResource implements StoragePoolResource, ServerResource, VmwareHostService
{
     private static final Logger s_logger = Logger.getLogger(VmwareResource.class);
@@ -1490,7 +1489,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
             if(!isVMWareToolsInstalled(vmMo)){
                 String errMsg = "vmware tools is not installed or not running, cannot add
nic to vm " + vmName;
                 s_logger.debug(errMsg);
-                return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due
to " + errMsg); 
+                return new PlugNicAnswer(cmd, false, "Unable to execute PlugNicCommand due
to " + errMsg);
             }
 
             // TODO need a way to specify the control of NIC device type
@@ -1603,7 +1602,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
 
         VmwareManager mgr = getServiceContext().getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
 
-        int ethDeviceNum = this.findRouterEthDeviceIndex(domrName, routerIp, ip.getVifMacAddress());
+        int ethDeviceNum = findRouterEthDeviceIndex(domrName, routerIp, ip.getVifMacAddress());
         if (ethDeviceNum < 0) {
             if (ip.isAdd()) {
                 throw new InternalErrorException("Failed to find DomR VIF to associate/disassociate
IP with.");
@@ -1770,11 +1769,11 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
             vSwitchType = _publicTrafficInfo.getVirtualSwitchType();
         }
         if (VirtualSwitchType.StandardVirtualSwitch == vSwitchType) {
-            networkInfo = HypervisorHostHelper.prepareNetwork(this._publicTrafficInfo.getVirtualSwitchName(),
"cloud.public",
-                    vmMo.getRunningHost(), vlanId, null, null, this._ops_timeout, true);
+            networkInfo = HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(),
"cloud.public",
+                    vmMo.getRunningHost(), vlanId, null, null, _ops_timeout, true);
         } else {
-            networkInfo = HypervisorHostHelper.prepareNetwork(this._publicTrafficInfo.getVirtualSwitchName(),
"cloud.public",
-                    vmMo.getRunningHost(), vlanId, null, null, null, this._ops_timeout, vSwitchType,
_portsPerDvPortGroup, null, false);
+            networkInfo = HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(),
"cloud.public",
+                    vmMo.getRunningHost(), vlanId, null, null, null, _ops_timeout, vSwitchType,
_portsPerDvPortGroup, null, false);
         }
 
         int nicIndex = allocPublicNicIndex(vmMo);
@@ -2392,9 +2391,34 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
             VirtualMachineMO vmMo = hyperHost.findVmOnHyperHost(cmd.getVmName());
             VirtualMachineConfigSpec vmConfigSpec = new VirtualMachineConfigSpec();
             int ramMb = (int) (vmSpec.getMinRam()/(1024 * 1024));
+
+            long hotaddIncrementSizeInMb;
+            long hotaddMemoryLimitInMb;
+            long requestedMaxMemoryInMb = vmSpec.getMaxRam() / (1024 * 1024);
+
+            // Check if VM is really running on hypervisor host
+            if (getVmState(vmMo) != State.Running) {
+                throw new CloudRuntimeException("Found that the VM " + vmMo.getVmName() +
" is not running. Unable to scale-up this VM");
+            }
+
+            // Check max hot add limit
+            hotaddIncrementSizeInMb = vmMo.getHotAddMemoryIncrementSizeInMb();
+            hotaddMemoryLimitInMb = vmMo.getHotAddMemoryLimitInMb();
+            if (requestedMaxMemoryInMb > hotaddMemoryLimitInMb) {
+                throw new CloudRuntimeException("Memory of VM " + vmMo.getVmName() + " cannot
be scaled to " + requestedMaxMemoryInMb + "MB." +
+                        " Requested memory limit is beyond the hotadd memory limit for this
VM at the moment is " + hotaddMemoryLimitInMb + "MB");
+            }
+
+            // Check increment is multiple of increment size
+            long reminder = requestedMaxMemoryInMb % hotaddIncrementSizeInMb;
+            if (reminder != 0) {
+                requestedMaxMemoryInMb = requestedMaxMemoryInMb + hotaddIncrementSizeInMb
- reminder;
+            }
+
             // Check if license supports the feature
             VmwareHelper.isFeatureLicensed(hyperHost, FeatureKeyConstants.HOTPLUG);
-            VmwareHelper.setVmScaleUpConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(),
vmSpec.getMinSpeed(),(int) (vmSpec.getMaxRam()/(1024 * 1024)), ramMb, vmSpec.getLimitCpuUse());
+            VmwareHelper
+                    .setVmScaleUpConfig(vmConfigSpec, vmSpec.getCpus(), vmSpec.getMaxSpeed(),
vmSpec.getMinSpeed(), (int)requestedMaxMemoryInMb, ramMb, vmSpec.getLimitCpuUse());
 
             if(!vmMo.configureVm(vmConfigSpec)) {
                 throw new Exception("Unable to execute ScaleVmCommand");
@@ -2525,12 +2549,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                 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 = 
+                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);                   
+                    vmConfigSpec.setNestedHVEnabled(true);
                 }
                 else {
                 	s_logger.warn("Hypervisor doesn't support nested virtualization, unable
to set config for VM " +vmSpec.getName());
@@ -2650,7 +2674,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                         String[] diskChain = _gson.fromJson(chainInfo, String[].class);
                         if (diskChain == null || diskChain.length < 1) {
                             s_logger.warn("Empty previously-saved chain info, fall back to
the original");
-                            device = VmwareHelper.prepareDiskDevice(vmMo, controllerKey,
new String[] { datastoreDiskPath }, volumeDsDetails.first(), 
+                            device = VmwareHelper.prepareDiskDevice(vmMo, controllerKey,
new String[] { datastoreDiskPath }, volumeDsDetails.first(),
                             		(controllerKey==ideControllerKey)?ideUnitNumber++:scsiUnitNumber++,
i + 1);
                         } else {
                             s_logger.info("Attach the disk with stored chain info: " + chainInfo);
@@ -2658,7 +2682,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                                 diskChain[j] = String.format("[%s] %s", volumeDsDetails.second().getName(),
diskChain[j]);
                             }
 
-                            device = VmwareHelper.prepareDiskDevice(vmMo, controllerKey,
diskChain, volumeDsDetails.first(), 
+                            device = VmwareHelper.prepareDiskDevice(vmMo, controllerKey,
diskChain, volumeDsDetails.first(),
                             		(controllerKey==ideControllerKey)?ideUnitNumber++:scsiUnitNumber++,
i + 1);
                         }
                     } else {
@@ -2961,13 +2985,13 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         }
 
         if (nicTo.getType() == Networks.TrafficType.Guest) {
-            return new Pair<String, String>(this._guestTrafficInfo.getVirtualSwitchName(),
Vlan.UNTAGGED);
+            return new Pair<String, String>(_guestTrafficInfo.getVirtualSwitchName(),
Vlan.UNTAGGED);
         } else if (nicTo.getType() == Networks.TrafficType.Control || nicTo.getType() ==
Networks.TrafficType.Management) {
-            return new Pair<String, String>(this._privateNetworkVSwitchName, Vlan.UNTAGGED);
+            return new Pair<String, String>(_privateNetworkVSwitchName, Vlan.UNTAGGED);
         } else if (nicTo.getType() == Networks.TrafficType.Public) {
-            return new Pair<String, String>(this._publicTrafficInfo.getVirtualSwitchName(),
Vlan.UNTAGGED);
+            return new Pair<String, String>(_publicTrafficInfo.getVirtualSwitchName(),
Vlan.UNTAGGED);
         } else if (nicTo.getType() == Networks.TrafficType.Storage) {
-            return new Pair<String, String>(this._privateNetworkVSwitchName, Vlan.UNTAGGED);
+            return new Pair<String, String>(_privateNetworkVSwitchName, Vlan.UNTAGGED);
         } else if (nicTo.getType() == Networks.TrafficType.Vpn) {
             throw new Exception("Unsupported traffic type: " + nicTo.getType().toString());
         } else {
@@ -5324,8 +5348,8 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                     if(!"untagged".equalsIgnoreCase(tokens[2]))
                         vlanId = tokens[2];
 
-                    HypervisorHostHelper.prepareNetwork(this._privateNetworkVSwitchName,
"cloud.private",
-                            hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false);
+                    HypervisorHostHelper.prepareNetwork(_privateNetworkVSwitchName, "cloud.private",
+                            hostMo, vlanId, networkRateMbps, null, _ops_timeout, false);
                 } else {
                     s_logger.info("Skip suspecious cloud network " + networkName);
                 }
@@ -5341,7 +5365,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                         vlanId = tokens[2];
 
                     HypervisorHostHelper.prepareNetwork(_publicTrafficInfo.getVirtualSwitchName(),
"cloud.public",
-                            hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false);
+                            hostMo, vlanId, networkRateMbps, null, _ops_timeout, false);
                 } else {
                     s_logger.info("Skip suspecious cloud network " + networkName);
                 }
@@ -5358,7 +5382,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                         vlanId = tokens[2];
 
                     HypervisorHostHelper.prepareNetwork(_guestTrafficInfo.getVirtualSwitchName(),
"cloud.guest",
-                            hostMo, vlanId, networkRateMbps, null, this._ops_timeout, false);
+                            hostMo, vlanId, networkRateMbps, null, _ops_timeout, false);
                 } else {
                     s_logger.info("Skip suspecious cloud network " + networkName);
                 }
@@ -5740,9 +5764,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
 
         s_logger.info("VmwareResource network configuration info." +
                 " private traffic over vSwitch: " + _privateNetworkVSwitchName + ", public
traffic over " +
-                this._publicTrafficInfo.getVirtualSwitchType() + " : " + this._publicTrafficInfo.getVirtualSwitchName()
+
-                ", guest traffic over " + this._guestTrafficInfo.getVirtualSwitchType() +
" : " +
-                this._guestTrafficInfo.getVirtualSwitchName());
+                _publicTrafficInfo.getVirtualSwitchType() + " : " + _publicTrafficInfo.getVirtualSwitchName()
+
+                ", guest traffic over " + _guestTrafficInfo.getVirtualSwitchType() + " :
" +
+                _guestTrafficInfo.getVirtualSwitchName());
 
         value = params.get("vmware.create.full.clone").toString();
         if (value != null && value.equalsIgnoreCase("true")) {
@@ -5878,5 +5902,5 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
     private boolean isVMWareToolsInstalled(VirtualMachineMO vmMo) throws Exception{
         GuestInfo guestInfo = vmMo.getVmGuestInfo();
         return (guestInfo != null && guestInfo.getGuestState() != null &&
guestInfo.getGuestState().equalsIgnoreCase("running"));
-    }	
+    }
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/12b39cfd/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
----------------------------------------------------------------------
diff --git a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
index 3e51047..7eed583 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -32,13 +32,6 @@ import java.util.List;
 
 import org.apache.log4j.Logger;
 
-import com.cloud.hypervisor.vmware.mo.SnapshotDescriptor.SnapshotInfo;
-import com.cloud.hypervisor.vmware.util.VmwareContext;
-import com.cloud.hypervisor.vmware.util.VmwareHelper;
-import com.cloud.utils.ActionDelegate;
-import com.cloud.utils.Pair;
-import com.cloud.utils.Ternary;
-import com.cloud.utils.script.Script;
 import com.google.gson.Gson;
 import com.vmware.vim25.ArrayOfManagedObjectReference;
 import com.vmware.vim25.CustomFieldStringValue;
@@ -49,7 +42,6 @@ import com.vmware.vim25.GuestOsDescriptor;
 import com.vmware.vim25.HttpNfcLeaseDeviceUrl;
 import com.vmware.vim25.HttpNfcLeaseInfo;
 import com.vmware.vim25.HttpNfcLeaseState;
-import com.vmware.vim25.InvalidStateFaultMsg;
 import com.vmware.vim25.ManagedObjectReference;
 import com.vmware.vim25.ObjectContent;
 import com.vmware.vim25.ObjectSpec;
@@ -59,8 +51,6 @@ import com.vmware.vim25.OvfCreateDescriptorResult;
 import com.vmware.vim25.OvfFile;
 import com.vmware.vim25.PropertyFilterSpec;
 import com.vmware.vim25.PropertySpec;
-import com.vmware.vim25.RuntimeFaultFaultMsg;
-import com.vmware.vim25.SelectionSpec;
 import com.vmware.vim25.TraversalSpec;
 import com.vmware.vim25.VirtualCdrom;
 import com.vmware.vim25.VirtualCdromIsoBackingInfo;
@@ -101,6 +91,14 @@ import com.vmware.vim25.VirtualPCIController;
 import com.vmware.vim25.VirtualSCSIController;
 import com.vmware.vim25.VirtualSCSISharing;
 
+import com.cloud.hypervisor.vmware.mo.SnapshotDescriptor.SnapshotInfo;
+import com.cloud.hypervisor.vmware.util.VmwareContext;
+import com.cloud.hypervisor.vmware.util.VmwareHelper;
+import com.cloud.utils.ActionDelegate;
+import com.cloud.utils.Pair;
+import com.cloud.utils.Ternary;
+import com.cloud.utils.script.Script;
+
 import edu.emory.mathcs.backport.java.util.Arrays;
 
 public class VirtualMachineMO extends BaseMO {
@@ -210,7 +208,7 @@ public class VirtualMachineMO extends BaseMO {
 
 		if(isVMwareToolsRunning()) {
 			try {
-				String vmName = this.getName();
+				String vmName = getName();
 
 				s_logger.info("Try gracefully shut down VM " + vmName);
 				shutdown();
@@ -320,7 +318,7 @@ public class VirtualMachineMO extends BaseMO {
 	}
 
 	public boolean isTemplate() throws Exception {
-		VirtualMachineConfigInfo configInfo = this.getConfigInfo();
+		VirtualMachineConfigInfo configInfo = getConfigInfo();
 		return configInfo.isTemplate();
 	}
 
@@ -669,7 +667,8 @@ public class VirtualMachineMO extends BaseMO {
 			_mor, "config.files");
 	}
 
-	public ManagedObjectReference getParentMor() throws Exception {
+	@Override
+    public ManagedObjectReference getParentMor() throws Exception {
 		return (ManagedObjectReference)_context.getVimClient().getDynamicProperty(
 			_mor, "parent");
 	}
@@ -1660,7 +1659,7 @@ public class VirtualMachineMO extends BaseMO {
 		DatacenterMO dcMo = getOwnerDatacenter().first();
 		if(disks != null) {
 			for(VirtualDevice disk : disks) {
-				List<Pair<String, ManagedObjectReference>> vmdkFiles = this.getDiskDatastorePathChain((VirtualDisk)disk,
followDiskChain);
+				List<Pair<String, ManagedObjectReference>> vmdkFiles = getDiskDatastorePathChain((VirtualDisk)disk,
followDiskChain);
 				for(Pair<String, ManagedObjectReference> fileItem : vmdkFiles) {
 					DatastoreMO srcDsMo = new DatastoreMO(_context, fileItem.second());
 
@@ -1696,7 +1695,7 @@ public class VirtualMachineMO extends BaseMO {
 		DatacenterMO dcMo = getOwnerDatacenter().first();
 		if(disks != null) {
 			for(VirtualDevice disk : disks) {
-				List<Pair<String, ManagedObjectReference>> vmdkFiles = this.getDiskDatastorePathChain((VirtualDisk)disk,
followDiskChain);
+				List<Pair<String, ManagedObjectReference>> vmdkFiles = getDiskDatastorePathChain((VirtualDisk)disk,
followDiskChain);
 				for(Pair<String, ManagedObjectReference> fileItem : vmdkFiles) {
 					DatastoreMO srcDsMo = new DatastoreMO(_context, fileItem.second());
 
@@ -2110,8 +2109,8 @@ public class VirtualMachineMO extends BaseMO {
 
     public String getDvPortGroupName(VirtualEthernetCard nic) throws Exception {
         VirtualEthernetCardDistributedVirtualPortBackingInfo dvpBackingInfo =
-                (VirtualEthernetCardDistributedVirtualPortBackingInfo) ((VirtualEthernetCard)
nic).getBacking();
-        DistributedVirtualSwitchPortConnection dvsPort = (DistributedVirtualSwitchPortConnection)
dvpBackingInfo.getPort();
+                (VirtualEthernetCardDistributedVirtualPortBackingInfo) nic.getBacking();
+        DistributedVirtualSwitchPortConnection dvsPort = dvpBackingInfo.getPort();
         String dvPortGroupKey = dvsPort.getPortgroupKey();
         ManagedObjectReference dvPortGroupMor = new ManagedObjectReference();
         dvPortGroupMor.setValue(dvPortGroupKey);
@@ -2183,5 +2182,13 @@ public class VirtualMachineMO extends BaseMO {
 			}
 		}
 	}
+
+    public long getHotAddMemoryIncrementSizeInMb() throws Exception {
+        return (Long)_context.getVimClient().getDynamicProperty(_mor, "config.hotPlugMemoryIncrementSize");
+    }
+
+    public long getHotAddMemoryLimitInMb() throws Exception {
+        return (Long)_context.getVimClient().getDynamicProperty(_mor, "config.hotPlugMemoryLimit");
+    }
 }
 


Mime
View raw message