summaryrefslogtreecommitdiffstats
path: root/src/guestfs.pod
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2012-10-05 14:56:35 +0100
committerRichard W.M. Jones <rjones@redhat.com>2012-10-08 20:04:53 +0100
commit18b7f09f366d518050f467d0944c81c82fd5e39e (patch)
tree6f89801dec73c60eb05cc01160544d76782e454a /src/guestfs.pod
parent7786d56db8c22413949f98ef6b15fe0ea367d195 (diff)
downloadlibguestfs-18b7f09f366d518050f467d0944c81c82fd5e39e.tar.gz
libguestfs-18b7f09f366d518050f467d0944c81c82fd5e39e.tar.xz
libguestfs-18b7f09f366d518050f467d0944c81c82fd5e39e.zip
Add support for hotplugging (adding disks) to the libvirt attach-method.
When libvirt is used, we can allow disks to be hotplugged. guestfs_add_drive can be called after launch to hot-add a disk. When a disk is hot-added, we first ask libvirt to add the disk to the appliance, then we make an internal call into the appliance to get it to wait for the disk to appear (ie. udev_settle ()). Hot-added disks are tracked in the g->drives array. This also adds a test.
Diffstat (limited to 'src/guestfs.pod')
-rw-r--r--src/guestfs.pod38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/guestfs.pod b/src/guestfs.pod
index 48d810b0..624e743e 100644
--- a/src/guestfs.pod
+++ b/src/guestfs.pod
@@ -143,8 +143,11 @@ one you added), etc.
Once L</guestfs_launch> has been called you cannot add any more images.
You can call L</guestfs_list_devices> to get a list of the device
-names, in the order that you added them. See also L</BLOCK DEVICE
-NAMING> below.
+names, in the order that you added them.
+See also L</BLOCK DEVICE NAMING> below.
+
+There are slightly different rules when hotplugging disks (in
+libguestfs E<ge> 1.20). See L</HOTPLUGGING> below.
=head2 MOUNTING
@@ -601,6 +604,35 @@ Libguestfs on top of FUSE performs quite poorly. For best performance
do not use it. Use ordinary libguestfs filesystem calls, upload,
download etc. instead.
+=head2 HOTPLUGGING
+
+In libguestfs E<ge> 1.20, you may add drives after calling
+L</guestfs_launch>. There are some restrictions, see below.
+This is called I<hotplugging>.
+
+Only a subset of the attach-method backends support hotplugging
+(currently only the libvirt attach-method has support). It also
+requires that you use libvirt E<ge> 0.10.3 and qemu E<ge> 1.2.
+
+To hot-add a disk, simply call L</guestfs_add_drive_opts> after
+L</guestfs_launch>. It is mandatory to specify the C<label> parameter
+so that the newly added disk has a predictable name. For example:
+
+ if (guestfs_launch (g) == -1)
+ error ("launch failed");
+
+ if (guestfs_add_drive_opts (g, filename,
+ GUESTFS_ADD_DRIVE_OPTS_LABEL, "newdisk",
+ -1) == -1)
+ error ("hot-add of disk failed");
+
+ if (guestfs_part_disk ("/dev/disk/guestfs/newdisk", "mbr") == -1)
+ error ("partitioning of hot-added disk failed");
+
+Backends that support hotplugging do not require that you add
+E<ge> 1 disk before calling launch. When hotplugging is supported
+you don't need to add any disks.
+
=head2 INSPECTION
Libguestfs has APIs for inspecting an unknown disk image to find out
@@ -2639,7 +2671,7 @@ The guest may be killed by L</guestfs_kill_subprocess>, or may die
asynchronously at any time (eg. due to some internal error), and that
causes the state to transition back to CONFIG.
-Configuration commands for qemu such as L</guestfs_add_drive> can only
+Configuration commands for qemu such as L</guestfs_set_path> can only
be issued when in the CONFIG state.
The API offers one call that goes from CONFIG through LAUNCHING to