Updated Branches:
  refs/heads/master 0f60b5d41 -> dd6b24522

CLOUDSTACK-4324: need to clean up snapshot_store_ref, if creating snapshot 
failed.


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

Branch: refs/heads/master
Commit: 374de76dae63db7fb79201f37db2254c80bd28c6
Parents: 0f60b5d
Author: Edison Su <[email protected]>
Authored: Wed Aug 14 14:18:02 2013 -0700
Committer: Edison Su <[email protected]>
Committed: Wed Aug 14 14:59:19 2013 -0700

----------------------------------------------------------------------
 .../cloudstack/storage/snapshot/SnapshotServiceImpl.java      | 7 +++++--
 .../com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java | 7 +++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/374de76d/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
 
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
index cabd91b..ab785d7 100644
--- 
a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
+++ 
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotServiceImpl.java
@@ -214,7 +214,8 @@ public class SnapshotServiceImpl implements SnapshotService 
{
         try {
             result = future.get();
             if (result.isFailed()) {
-                s_logger.debug("Failed to create snapshot:" + 
result.getResult());
+                snapshot.processEvent(Snapshot.Event.OperationFailed);
+                snapshot.processEvent(Event.OperationFailed);
                 throw new CloudRuntimeException(result.getResult());
             }
             return result;
@@ -224,8 +225,10 @@ public class SnapshotServiceImpl implements 
SnapshotService {
         } catch (ExecutionException e) {
             s_logger.debug("Failed to create snapshot", e);
             throw new CloudRuntimeException("Failed to create snapshot", e);
+        } catch (NoTransitionException e) {
+            s_logger.debug("Failed to create snapshot", e);
+            throw new CloudRuntimeException("Failed to create snapshot", e);
         }
-
     }
 
     // if a snapshot has parent snapshot, the new snapshot should be stored in

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/374de76d/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
----------------------------------------------------------------------
diff --git 
a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
 
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
index 8f46c22..e00e4d2 100644
--- 
a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
+++ 
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/KVMStorageProcessor.java
@@ -352,8 +352,11 @@ public class KVMStorageProcessor implements 
StorageProcessor {
             secondaryStoragePool = storagePoolMgr.getStoragePoolByURI(
                     secondaryStorageUrl + File.separator + volumeDir
                            );
+            if (!srcVolumeName.endsWith(".qcow2")) {
+                srcVolumeName = srcVolumeName + ".qcow2";
+            }
             KVMPhysicalDisk volume = secondaryStoragePool
-                    .getPhysicalDisk(srcVolumeName + ".qcow2");
+                    .getPhysicalDisk(srcVolumeName);
             storagePoolMgr.copyPhysicalDisk(volume, volumeName,
                     primaryPool);
             VolumeObjectTO newVol = new VolumeObjectTO();
@@ -414,7 +417,7 @@ public class KVMStorageProcessor implements 
StorageProcessor {
             storagePoolMgr.copyPhysicalDisk(volume,
                     destVolumeName,secondaryStoragePool);
             VolumeObjectTO newVol = new VolumeObjectTO();
-            newVol.setPath(destVolumePath + File.separator + volumeName);
+            newVol.setPath(destVolumePath + File.separator + destVolumeName);
             return new CopyCmdAnswer(newVol);
         } catch (CloudRuntimeException e) {
             return new CopyCmdAnswer(e.toString());

Reply via email to