Updated Branches: refs/heads/4.2 431ea4988 -> 1451b8b64
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/1451b8b6 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1451b8b6 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1451b8b6 Branch: refs/heads/4.2 Commit: 1451b8b6424bdade512c6b6144286c05af952d3c Parents: 431ea49 Author: Edison Su <[email protected]> Authored: Wed Aug 14 14:18:02 2013 -0700 Committer: Edison Su <[email protected]> Committed: Wed Aug 14 14:18:22 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/1451b8b6/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 f8d9cbc..c805cdd 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 @@ -211,7 +211,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; @@ -221,8 +222,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/1451b8b6/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());
