cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wid...@apache.org
Subject [5/5] git commit: refs/heads/qemu-img - Implement QemuImg.create()
Date Wed, 06 Feb 2013 16:51:33 GMT
Updated Branches:
  refs/heads/qemu-img ad88091dd -> e5e48b0cb


Implement QemuImg.create()


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

Branch: refs/heads/qemu-img
Commit: e5e48b0cb2b88f351cc8cd63c61cd344f518af3c
Parents: cf17ff1
Author: Wido den Hollander <wido@widodh.nl>
Authored: Wed Feb 6 17:50:59 2013 +0100
Committer: Wido den Hollander <wido@widodh.nl>
Committed: Wed Feb 6 17:50:59 2013 +0100

----------------------------------------------------------------------
 utils/src/org/apache/cloudstack/utils/QemuImg.java |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/e5e48b0c/utils/src/org/apache/cloudstack/utils/QemuImg.java
----------------------------------------------------------------------
diff --git a/utils/src/org/apache/cloudstack/utils/QemuImg.java b/utils/src/org/apache/cloudstack/utils/QemuImg.java
index cf406c3..414022f 100644
--- a/utils/src/org/apache/cloudstack/utils/QemuImg.java
+++ b/utils/src/org/apache/cloudstack/utils/QemuImg.java
@@ -16,11 +16,16 @@
 // under the License.
 package org.apache.cloudstack.utils;
 
+import com.cloud.utils.script.Script;
+
 import java.util.List;
 import java.util.Map;
 
 public class QemuImg {
 
+    /* The qemu-img binary. We expect this to be in $PATH */
+    public static String _qemuImgPath = "qemu-img";
+
     /* Shouldn't we have KVMPhysicalDisk and LibvirtVMDef read this? */
     public static enum PhysicalDiskFormat {
         RAW("raw"), QCOW2("qcow2"), VMDK("vmdk"), FILE("file"), RBD("rbd"), SHEEPDOG("sheepdog"),
HTTP("http"), HTTPS("https");
@@ -44,7 +49,12 @@ public class QemuImg {
 
     /* Create a new disk image */
     public static void create(String filename, long size, PhysicalDiskFormat format, List<Map<String,
String>> options) {
-
+        Script s = new Script(_qemuImgPath);
+        s.add("create");
+        s.add("-f");
+        s.add(format.toString());
+        s.add(filename);
+        s.add(Long.toString(size));
     }
 
     public static void create(String filename, long size, PhysicalDiskFormat format) {
@@ -93,5 +103,4 @@ public class QemuImg {
             newSize = "-" + size;
         }
     }
-
 }
\ No newline at end of file


Mime
View raw message