incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [35/38] git commit: refs/heads/qemu-img - Use the info method for finding out if it has a backing file.
Date Mon, 18 Feb 2013 17:21:25 GMT
Use the info method for finding out if it has a backing file.


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

Branch: refs/heads/qemu-img
Commit: dcb0484b74c1a4c1fd303cea88f97f031739d481
Parents: a0b0878
Author: Wido den Hollander <wido@widodh.nl>
Authored: Mon Feb 18 15:07:38 2013 +0100
Committer: Wido den Hollander <wido@widodh.nl>
Committed: Mon Feb 18 15:07:38 2013 +0100

----------------------------------------------------------------------
 .../kvm/storage/LibvirtStorageAdaptor.java         |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/dcb0484b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
index 63027fd..41ce76f 100644
--- a/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
+++ b/plugins/hypervisors/kvm/src/com/cloud/hypervisor/kvm/storage/LibvirtStorageAdaptor.java
@@ -22,6 +22,8 @@ import java.net.URISyntaxException;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
+import java.util.Map;
+import java.util.HashMap;
 import org.apache.log4j.Logger;
 import org.apache.commons.codec.binary.Base64;
 import org.apache.cloudstack.utils.qemu.QemuImg;
@@ -692,8 +694,10 @@ public class LibvirtStorageAdaptor implements StorageAdaptor {
         QemuImgFile destFile = null;
 
         if ((srcPool.getType() != StoragePoolType.RBD) && (destPool.getType() !=
StoragePoolType.RBD)) {
-            if (sourceFormat.equals(destFormat) && 
-                Script.runSimpleBashScript("qemu-img info " + sourcePath + "|grep backing")
== null) {
+            srcFile = new QemuImgFile(sourcePath);
+            Map<String, String> info = Qemu.info(srcFile);
+            String backingFile = info.get(new String("backing_file"));
+            if (sourceFormat.equals(destFormat) && !backingFile) {
                 Script.runSimpleBashScript("cp -f " + sourcePath + " " + destPath);
 
             } else {


Mime
View raw message