cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anthon...@apache.org
Subject git commit: updated refs/heads/master to ecf100e
Date Tue, 29 Jul 2014 00:38:01 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master f47cfc6eb -> ecf100e4e


fixed build for vmware


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

Branch: refs/heads/master
Commit: ecf100e4edb34b6b954ec87349139fe24e356690
Parents: f47cfc6
Author: Anthony Xu <anthony.xu@citrix.com>
Authored: Mon Jul 28 17:36:22 2014 -0700
Committer: Anthony Xu <anthony.xu@citrix.com>
Committed: Mon Jul 28 17:37:31 2014 -0700

----------------------------------------------------------------------
 .../manager/VmwareStorageManagerImpl.java       |  4 ++--
 .../vmware/resource/VmwareResource.java         | 20 +++++++++-----------
 .../resource/VmwareStorageProcessor.java        |  4 ++--
 3 files changed, 13 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ecf100e4/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
index c1b907e..308a8bf 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/hypervisor/vmware/manager/VmwareStorageManagerImpl.java
@@ -1415,7 +1415,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
         String vmName = cmd.getVmName();
         Boolean snapshotMemory = cmd.getTarget().getType() == VMSnapshot.Type.DiskAndMemory;
         List<VolumeObjectTO> listVolumeTo = cmd.getVolumeTOs();
-        VirtualMachine.State vmState = VirtualMachine.State.Running;
+        VirtualMachine.PowerState vmState = VirtualMachine.PowerState.PowerOn;
         VirtualMachineMO vmMo = null;
         VmwareContext context = hostService.getServiceContext(cmd);
 
@@ -1468,7 +1468,7 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager
{
                     setVolumeToPathAndSize(listVolumeTo, mapNewDisk, context, hyperHost,
cmd.getVmName());
 
                     if (!snapshotMemory) {
-                        vmState = VirtualMachine.State.Stopped;
+                        vmState = VirtualMachine.PowerState.PowerOff;
                     }
 
                     return new RevertToVMSnapshotAnswer(cmd, listVolumeTo, vmState);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ecf100e4/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 b87e4ea..b076b61 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
@@ -312,7 +312,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
     protected static ThreadLocal<VmwareContext> s_serviceContext = new ThreadLocal<VmwareContext>();
     protected String _hostName;
 
-    protected HashMap<String, State> _vms = new HashMap<String, State>(71);
     protected List<PropertyMapDynamicBean> _cmdMBeans = new ArrayList<PropertyMapDynamicBean>();
 
     protected Gson _gson;
@@ -1295,7 +1294,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         String vmNameOnVcenter = names.second();
 
         // Thus, vmInternalCSName always holds i-x-y, the cloudstack generated internal VM
name.
-        State state = State.Stopped;
         VmwareContext context = getServiceContext();
         try {
             VmwareManager mgr = context.getStockObject(VmwareManager.CONTEXT_STOCK_NAME);
@@ -1691,8 +1689,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                 throw new Exception("Failed to start VM. vmName: " + vmInternalCSName + "
with hostname " + vmNameOnVcenter);
             }
 
-            state = State.Running;
-
             StartAnswer startAnswer = new StartAnswer(cmd);
 
             startAnswer.setIqnToPath(iqnToPath);
@@ -2544,7 +2540,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         HashMap<String, VmStatsEntry> vmStatsMap = null;
 
         try {
-            HashMap<String, PowerState> vmPowerStates = getVmStates()
+            HashMap<String, PowerState> vmPowerStates = getVmStates();
 
             // getVmNames should return all i-x-y values.
             List<String> requestedVmNames = cmd.getVmNames();
@@ -2732,7 +2728,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         }
 
         final String vmName = cmd.getVmName();
-        PowerState powerState = PowerState.Unknown;
+        PowerState powerState = PowerState.PowerUnknown;
         Integer vncPort = null;
 
         VmwareContext context = getServiceContext();
@@ -2806,10 +2802,6 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
                 String msg = "Failed to prepare secondary storage on host, secondary store
url: " + secStoreUrl;
                 throw new Exception(msg);
             }
-
-            synchronized (_vms) {
-                _vms.put(vm.getName(), State.Migrating);
-            }
             return new PrepareForMigrationAnswer(cmd);
         } catch (Throwable e) {
             if (e instanceof RemoteException) {
@@ -4332,7 +4324,7 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         // the internal CS name, but the custom field CLOUD_VM_INTERNAL_NAME always stores
the internal CS name.
         ObjectContent[] ocs = hyperHost.getVmPropertiesOnHyperHost(new String[] {"name",
"runtime.powerState", "config.template", instanceNameCustomField});
 
-        HashMap<String, State> newStates = new HashMap<String, State>();
+        HashMap<String, PowerState> newStates = new HashMap<String, PowerState>();
         if (ocs != null && ocs.length > 0) {
             for (ObjectContent oc : ocs) {
                 List<DynamicProperty> objProps = oc.getPropSet();
@@ -4592,6 +4584,12 @@ public class VmwareResource implements StoragePoolResource, ServerResource,
Vmwa
         return connect(vmname, ipAddress, 3922);
     }
 
+    public static PowerState getVmState(VirtualMachineMO vmMo) throws Exception {
+        VirtualMachineRuntimeInfo runtimeInfo = vmMo.getRuntimeInfo();
+        return convertPowerState(runtimeInfo.getPowerState());
+    }
+
+
     private static PowerState convertPowerState(VirtualMachinePowerState powerState) {
         return s_powerStatesTable.get(powerState);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ecf100e4/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
index 5b4942c..730ea1e 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -99,7 +99,7 @@ import com.cloud.utils.Pair;
 import com.cloud.utils.Ternary;
 import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.script.Script;
-import com.cloud.vm.VirtualMachine.State;
+import com.cloud.vm.VirtualMachine.PowerState;
 
 public class VmwareStorageProcessor implements StorageProcessor {
     private static final Logger s_logger = Logger.getLogger(VmwareStorageProcessor.class);
@@ -1611,7 +1611,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
                         List<NetworkDetails> networks = vmMo.getNetworksWithDetails();
 
                         // tear down all devices first before we destroy the VM to avoid
accidently delete disk backing files
-                        if (VmwareResource.getVmState(vmMo) != State.Stopped) {
+                        if (VmwareResource.getVmState(vmMo) != PowerState.PowerOff) {
                             vmMo.safePowerOff(_shutdownWaitMs);
                         }
 


Mime
View raw message