cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kelv...@apache.org
Subject git commit: updated refs/heads/4.2-forward to 5e52a86
Date Sun, 15 Sep 2013 18:40:06 GMT
Updated Branches:
  refs/heads/4.2-forward 4ab2a741f -> 5e52a86a2


CLOUDSTACK-4659: Fix the regression caused by worker VM consolidation for GC purpose


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

Branch: refs/heads/4.2-forward
Commit: 5e52a86a2ac8783141c99e8ab34a96fb21b8826a
Parents: 4ab2a74
Author: Kelven Yang <kelveny@gmail.com>
Authored: Sun Sep 15 11:39:32 2013 -0700
Committer: Kelven Yang <kelveny@gmail.com>
Committed: Sun Sep 15 11:39:32 2013 -0700

----------------------------------------------------------------------
 .../resource/VmwareStorageProcessor.java        | 24 ++++++--------------
 .../hypervisor/vmware/mo/VirtualMachineMO.java  |  9 ++++----
 2 files changed, 12 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e52a86a/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 5dad90a..05ffec9 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -660,15 +660,10 @@ public class VmwareStorageProcessor implements StorageProcessor {
             }
 
             // 4 MB is the minimum requirement for VM memory in VMware
-            vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(),
+            Pair<VirtualMachineMO, String[]> cloneResult = vmMo.cloneFromCurrentSnapshot(workerVmName,
0, 4, volumeDeviceInfo.second(),
                     VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()));
-            clonedVm = vmMo.getRunningHost().findVmOnHyperHost(workerVmName);
-            if(clonedVm == null) {
-                String msg = "Unable to create dummy VM to export volume. volume path: "
+ volumePath;
-                s_logger.error(msg);
-                throw new Exception(msg);
-            }
-
+            clonedVm = cloneResult.first();
+            
             clonedVm.exportVm(secondaryMountPoint + "/" + installPath, templateUniqueName,
true, false);
 
             long physicalSize = new File(installFullPath + "/" + templateUniqueName + ".ova").length();
@@ -984,17 +979,12 @@ public class VmwareStorageProcessor implements StorageProcessor {
             }
 
             // 4 MB is the minimum requirement for VM memory in VMware
-            String disks[] = vmMo.cloneFromCurrentSnapshot(workerVmName, 0, 4, volumeDeviceInfo.second(),
-                    VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()));
-            clonedVm = vmMo.getRunningHost().findVmOnHyperHost(workerVmName);
-            if(clonedVm == null) {
-                String msg = "Unable to create dummy VM to export volume. volume path: "
+ volumePath;
-                s_logger.error(msg);
-                throw new Exception(msg);
-            }
+            Pair<VirtualMachineMO, String[]> cloneResult = vmMo.cloneFromCurrentSnapshot(workerVmName,
0, 4, volumeDeviceInfo.second(),
+                VmwareHelper.getDiskDeviceDatastore(volumeDeviceInfo.first()));
+            clonedVm = cloneResult.first();
+            String disks[] = cloneResult.second();
 
             clonedVm.exportVm(exportPath, exportName, false, false);
-            
             return new Pair<String, String[]>(volumeDeviceInfo.second(), disks);
         } finally {
             if(clonedVm != null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/5e52a86a/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 a6df40e..f64c3c0 100644
--- a/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
+++ b/vmware-base/src/com/cloud/hypervisor/vmware/mo/VirtualMachineMO.java
@@ -1545,15 +1545,15 @@ public class VirtualMachineMO extends BaseMO {
 	}
 
 	// return the disk chain (VMDK datastore paths) for cloned snapshot
-	public String[] cloneFromCurrentSnapshot(String clonedVmName, int cpuSpeedMHz, int memoryMb,
String diskDevice,
+	public Pair<VirtualMachineMO, String[]> cloneFromCurrentSnapshot(String clonedVmName,
int cpuSpeedMHz, int memoryMb, String diskDevice,
 		ManagedObjectReference morDs) throws Exception {
 		assert(morDs != null);
 		String[] disks = getCurrentSnapshotDiskChainDatastorePaths(diskDevice);
-		cloneFromDiskChain(clonedVmName, cpuSpeedMHz, memoryMb, disks, morDs);
-		return disks;
+		VirtualMachineMO clonedVm = cloneFromDiskChain(clonedVmName, cpuSpeedMHz, memoryMb, disks,
morDs);
+		return new Pair<VirtualMachineMO, String[]>(clonedVm, disks);
 	}
 
-	public void cloneFromDiskChain(String clonedVmName, int cpuSpeedMHz, int memoryMb,
+	public VirtualMachineMO cloneFromDiskChain(String clonedVmName, int cpuSpeedMHz, int memoryMb,
 		String[] disks, ManagedObjectReference morDs) throws Exception {
 		assert(disks != null);
 	    assert(disks.length >= 1);
@@ -1576,6 +1576,7 @@ public class VirtualMachineMO extends BaseMO {
     	    vmConfigSpec.getDeviceChange().add(deviceConfigSpec);
     	    clonedVmMo.configureVm(vmConfigSpec);
     	    bSuccess = true;
+    	    return clonedVmMo;
 		} finally {
 		    if(!bSuccess) {
 		        clonedVmMo.detachAllDisks();


Mime
View raw message