cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [1/2] git commit: updated refs/heads/master to c3a275f
Date Tue, 27 Aug 2013 16:35:34 GMT
Updated Branches:
  refs/heads/4.2-forward 3315159de -> 93b40b0ca
  refs/heads/master 79c366db2 -> c3a275fc7


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


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

Branch: refs/heads/master
Commit: c3a275fc75384959da67c4f196e4d6d9e0d85d65
Parents: 79c366d
Author: Wido den Hollander <wido@widodh.nl>
Authored: Tue Aug 27 18:33:46 2013 +0200
Committer: Wido den Hollander <wido@widodh.nl>
Committed: Tue Aug 27 18:34:39 2013 +0200

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c3a275fc/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 ba66802..3cca4fd 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