diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-10-05 14:56:35 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-10-08 20:04:53 +0100 |
commit | 18b7f09f366d518050f467d0944c81c82fd5e39e (patch) | |
tree | 6f89801dec73c60eb05cc01160544d76782e454a /generator | |
parent | 7786d56db8c22413949f98ef6b15fe0ea367d195 (diff) | |
download | libguestfs-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 'generator')
-rw-r--r-- | generator/actions.ml | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/generator/actions.ml b/generator/actions.ml index 25d28098..39c71ab8 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -1186,14 +1186,22 @@ not all belong to a single logical operating system name = "add_drive"; style = RErr, [String "filename"], [OBool "readonly"; OString "format"; OString "iface"; OString "name"; OString "label"]; once_had_no_optargs = true; - fish_alias = ["add"]; config_only = true; + fish_alias = ["add"]; shortdesc = "add an image to examine or modify"; longdesc = "\ This function adds a disk image called C<filename> to the handle. C<filename> may be a regular host file or a host device. -The first time you call this function, the disk appears as -C</dev/sda>, the second time as C</dev/sdb>, and so on. +When this function is called before C<guestfs_launch> (the +usual case) then the first time you call this function, +the disk appears in the API as C</dev/sda>, the second time +as C</dev/sdb>, and so on. + +In libguestfs E<ge> 1.20 you can also call this function +after launch (with some restrictions). This is called +\"hotplugging\". When hotplugging, you must specify a +C<label> so that the new disk gets a predictable name. +For more information see L<guestfs(3)/HOTPLUGGING>. You don't necessarily need to be root when using libguestfs. However you obviously do need sufficient permissions to access the filename @@ -9951,6 +9959,16 @@ This returns a hashtable, where keys are the disk labels are the full raw block device and partition names (eg. C</dev/sda> and C</dev/sda1>)." }; + { defaults with + name = "internal_hot_add_drive"; + style = RErr, [String "label"], []; + proc_nr = Some 370; + in_fish = false; in_docs = false; + tests = []; + shortdesc = "internal hotplugging operation"; + longdesc = "\ +This function is used internally when hotplugging drives." }; + ] (* Non-API meta-commands available only in guestfish. |