cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edi...@apache.org
Subject git commit: updated refs/heads/4.2 to 784a9d4
Date Thu, 08 Aug 2013 19:35:11 GMT
Updated Branches:
  refs/heads/4.2 6999fca4d -> 784a9d45d


CLOUDSTACK-4106: fix volume related operations on vmware&s3


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

Branch: refs/heads/4.2
Commit: 784a9d45d031bbc354996f85ba76347c360aac72
Parents: 6999fca
Author: Edison Su <sudison@gmail.com>
Authored: Thu Aug 8 12:34:24 2013 -0700
Committer: Edison Su <sudison@gmail.com>
Committed: Thu Aug 8 12:34:54 2013 -0700

----------------------------------------------------------------------
 .../motion/AncientDataMotionStrategy.java       | 13 +++++------
 .../resource/VmwareStorageProcessor.java        | 23 +++++++++++++-------
 .../com/cloud/template/TemplateManagerImpl.java |  2 +-
 3 files changed, 22 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/784a9d45/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
----------------------------------------------------------------------
diff --git a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
index 5b791ab..f069ffa 100644
--- a/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
+++ b/engine/storage/datamotion/src/org/apache/cloudstack/storage/motion/AncientDataMotionStrategy.java
@@ -437,19 +437,18 @@ public class AncientDataMotionStrategy implements DataMotionStrategy
{
                 EndPoint ep = selector.select(srcData, destData);
                 answer = ep.sendMessage(cmd);
             }
-            // clean up cache entry in case of failure
-            if (answer == null || !answer.getResult()) {
-                if (cacheData != null) {
-                    cacheMgr.deleteCacheObject(cacheData);
-                }
+
+            if (cacheData != null) {
+                cacheMgr.deleteCacheObject(cacheData);
             }
+
             return answer;
         } catch (Exception e) {
-            s_logger.debug("copy snasphot failed: " + e.toString());
+            s_logger.debug("copy snasphot failed: ", e);
             if (cacheData != null) {
                 cacheMgr.deleteCacheObject(cacheData);
             }
-            throw new CloudRuntimeException(e.toString());
+            throw new CloudRuntimeException(e);
         }
 
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/784a9d45/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 c4d6119..aed8f45 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -1040,13 +1040,16 @@ public class VmwareStorageProcessor implements StorageProcessor {
             morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost,
primaryStore.getUuid());
 
             try {
-                vmMo = hyperHost.findVmOnHyperHost(vmName);
+                if (vmName != null) {
+                    vmMo = hyperHost.findVmOnHyperHost(vmName);
+                }
                 if (vmMo == null) {
                     if(s_logger.isDebugEnabled()) {
                         s_logger.debug("Unable to find owner VM for BackupSnapshotCommand
on host " + hyperHost.getHyperHostName() + ", will try within datacenter");
                     }
-
-                    vmMo = hyperHost.findVmOnPeerHyperHost(vmName);
+                    if (vmName != null) {
+                        vmMo = hyperHost.findVmOnPeerHyperHost(vmName);
+                    }
                     if(vmMo == null) {
                         dsMo = new DatastoreMO(hyperHost.getContext(), morDs);
 
@@ -1489,17 +1492,21 @@ public class VmwareStorageProcessor implements StorageProcessor {
         String secondaryMountPoint = mountService.getMountPoint(secStorageUrl);
         String srcOVAFileName = null;
         String srcOVFFileName = null;
-
-        srcOVAFileName = secondaryMountPoint + "/" +  secStorageDir + "/"
+        if (backupName.endsWith(".ova")) {
+            srcOVAFileName = secondaryMountPoint + "/" +  secStorageDir + "/"
+                    + backupName;
+            srcOVFFileName = secondaryMountPoint + "/" +  secStorageDir + "/"
+                    + backupName.replace(".ova", ".ovf");
+        } else {
+            srcOVAFileName = secondaryMountPoint + "/" +  secStorageDir + "/"
                 + backupName + "." + ImageFormat.OVA.getFileExtension();
-        srcOVFFileName = secondaryMountPoint + "/" +  secStorageDir + "/"
+            srcOVFFileName = secondaryMountPoint + "/" +  secStorageDir + "/"
                 + backupName + ".ovf";
-
+        }
         String snapshotDir = "";
         if (backupName.contains("/")){
             snapshotDir = backupName.split("/")[0];
         }
-
         File ovafile = new File(srcOVAFileName);
 
         File ovfFile = new File(srcOVFFileName);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/784a9d45/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/template/TemplateManagerImpl.java b/server/src/com/cloud/template/TemplateManagerImpl.java
index a5f389d..90d4b70 100755
--- a/server/src/com/cloud/template/TemplateManagerImpl.java
+++ b/server/src/com/cloud/template/TemplateManagerImpl.java
@@ -1386,7 +1386,7 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
                     //getting the prent volume
                     long parentVolumeId=_snapshotDao.findById(snapshotId).getVolumeId();
                     VolumeVO parentVolume = _volumeDao.findById(parentVolumeId);
-                    if (parentVolume.getIsoId() != null) {
+                    if (parentVolume != null && parentVolume.getIsoId() != null)
{
                         privateTemplate.setSourceTemplateId(parentVolume.getIsoId());
                         _tmpltDao.update(privateTemplate.getId(), privateTemplate);
                     }


Mime
View raw message