From a659f2c316fa8a959a6286f214e50911253c5580 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 3 Jul 2012 13:22:45 +0100 Subject: 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) --- python/examples/create_disk.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'python/examples/create_disk.py') diff --git a/python/examples/create_disk.py b/python/examples/create_disk.py index 0885383e..86f50427 100644 --- a/python/examples/create_disk.py +++ b/python/examples/create_disk.py @@ -51,6 +51,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 reference counting. You only need to call close # if you want to close the handle right away. -- cgit