Displaying 2 results from an estimated 2 matches for "fba85ff".
2014 Jan 28
0
[PATCH 05/10] examples: Update various examples to use new disk-create API.
...-f = open (output, "w")
-f.truncate (512 * 1024 * 1024)
-f.close ()
+g.disk_create (output, "raw", 512 * 1024 * 1024);
# Set the trace flag so that we can see each libguestfs call.
g.set_trace (1)
diff --git a/ruby/examples/create_disk.rb b/ruby/examples/create_disk.rb
index fba85ff..00310de 100644
--- a/ruby/examples/create_disk.rb
+++ b/ruby/examples/create_disk.rb
@@ -7,9 +7,7 @@ output = "disk.img"
g = Guestfs::Guestfs.new()
# Create a raw-format sparse disk image, 512 MB in size.
-File.open(output, "w") {
- |f| f.truncate(512 * 1024 * 1024)
-}
+g....
2014 Jan 28
11
[PATCH 00/10] New API: disk-create for creating blank disks.
A lot of code runs 'qemu-img create' or 'truncate' to create blank
disk images.
In the past I resisted adding an API to do this, since it essentially
duplicates what you can already do using other tools (ie. qemu-img).
However this does simplify calling code quite a lot since qemu-img is
somewhat error-prone to use (eg: don't try to create a disk called
"foo:bar")