summaryrefslogtreecommitdiffstats
path: root/ruby
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-07-03 13:22:45 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-07-07 11:32:46 +0100
commitdff126b7c5c322c942ec920fe9fb752137c2e25b (patch)
treeb0f3c70599ba1fbf8e581d3c0b623eb1ecc9f6f6 /ruby
parentb6ef5f47cf6355c860f659252a391293ae026a32 (diff)
downloadlibguestfs-dff126b7c5c322c942ec920fe9fb752137c2e25b.tar.gz
libguestfs-dff126b7c5c322c942ec920fe9fb752137c2e25b.tar.xz
libguestfs-dff126b7c5c322c942ec920fe9fb752137c2e25b.zip
New API: guestfs_shutdown: Cleanly shutdown the backend.
The new API splits orderly close into a two-step process: if (guestfs_shutdown (g) == -1) { /* handle the error, eg. qemu error */ } guestfs_close (g); Note that the explicit shutdown step is only necessary in the case where you have made changes to the disk image and want to handle write errors. Read the documentation for further information. This change also: - deprecates guestfs_kill_subprocess - turns guestfs_kill_subprocess into the same as guestfs_shutdown - changes guestfish and other tools to call shutdown + close where necessary (not for read-only tools) - updates documentation - updates examples (cherry picked from commit ffbf1475f7ae7c462db289ad4834391469e72edd)
Diffstat (limited to 'ruby')
-rw-r--r--ruby/examples/create_disk.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/ruby/examples/create_disk.rb b/ruby/examples/create_disk.rb
index 026ea2e7..32fb1171 100644
--- a/ruby/examples/create_disk.rb
+++ b/ruby/examples/create_disk.rb
@@ -54,6 +54,11 @@ g.mkdir("/foo")
# the disk image.
g.upload("/etc/resolv.conf", "/foo/resolv.conf")
+# Because we wrote to the disk and we want to detect write
+# errors, call g.shutdown. You don't need to do this:
+# g.close will do it implicitly.
+g.shutdown()
+
# Note also that handles are automatically closed if they are
# reaped by the garbage collector. You only need to call close
# if you want to close the handle right away.