cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anim...@apache.org
Subject [08/12] git commit: updated refs/heads/4.2 to 41d2fb3
Date Tue, 27 Aug 2013 20:14:01 GMT
CLOUDSTACK-4423: Do not always append .qcow2 to volume names when copying

Disk images are not always in the QCOW2 format, so don't assume that the
filename will always and in .qcow2
(cherry picked from commit 93b40b0ca6a796ffbacd80c40897f6ada6284bc4)

Signed-off-by: animesh <animesh@apache.org>


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

Branch: refs/heads/4.2
Commit: bba9801cf7ef1eb65a730b45140bf5af0d978741
Parents: 7678ab4
Author: Wido den Hollander <wido@widodh.nl>
Authored: Tue Aug 27 18:33:46 2013 +0200
Committer: animesh <animesh@apache.org>
Committed: Tue Aug 27 12:55:51 2013 -0700

----------------------------------------------------------------------
 .../cloud/hypervisor/kvm/storage/KVMStorageProcessor.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/bba9801c/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 fd5c9d9..8482a8d 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
@@ -319,6 +319,8 @@ public class KVMStorageProcessor implements StorageProcessor {
         DataTO destData = cmd.getDestTO();
         DataStoreTO srcStore = srcData.getDataStore();
         DataStoreTO destStore = destData.getDataStore();
+        VolumeObjectTO srcVol = (VolumeObjectTO) srcData;
+        ImageFormat srcFormat = srcVol.getFormat();
         PrimaryDataStoreTO primaryStore = (PrimaryDataStoreTO) destStore;
         if (!(srcStore instanceof NfsTO)) {
             return new CopyCmdAnswer("can only handle nfs storage");
@@ -352,14 +354,16 @@ public class KVMStorageProcessor implements StorageProcessor {
             secondaryStoragePool = storagePoolMgr.getStoragePoolByURI(
                     secondaryStorageUrl + File.separator + volumeDir
                            );
-            if (!srcVolumeName.endsWith(".qcow2")) {
+            if (!srcVolumeName.endsWith(".qcow2") && srcFormat == ImageFormat.QCOW2)
{
                 srcVolumeName = srcVolumeName + ".qcow2";
             }
             KVMPhysicalDisk volume = secondaryStoragePool
                     .getPhysicalDisk(srcVolumeName);
-            storagePoolMgr.copyPhysicalDisk(volume, volumeName,
+            volume.setFormat(PhysicalDiskFormat.valueOf(srcFormat.toString()));
+            KVMPhysicalDisk newDisk = storagePoolMgr.copyPhysicalDisk(volume, volumeName,
                     primaryPool);
             VolumeObjectTO newVol = new VolumeObjectTO();
+            newVol.setFormat(ImageFormat.valueOf(newDisk.getFormat().toString().toUpperCase()));
             newVol.setPath(volumeName);
             return new CopyCmdAnswer(newVol);
         } catch (CloudRuntimeException e) {


Mime
View raw message