diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2012-10-08 17:26:53 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-10-09 09:45:42 +0100 |
commit | 0a85fbc946d7838366c35c0425efddb1a91f593c (patch) | |
tree | bfc621b7075d563a37fdaafda05b594c0522c9c6 /generator/actions.ml | |
parent | 18b7f09f366d518050f467d0944c81c82fd5e39e (diff) | |
download | libguestfs-0a85fbc946d7838366c35c0425efddb1a91f593c.tar.gz libguestfs-0a85fbc946d7838366c35c0425efddb1a91f593c.tar.xz libguestfs-0a85fbc946d7838366c35c0425efddb1a91f593c.zip |
Add support for hotplugging (removing disks).
New API: remove-drive.
Note because of a bug in fuser, this only works with psmisc >= 22.20.
This also updates the hotplugging tests.
Diffstat (limited to 'generator/actions.ml')
-rw-r--r-- | generator/actions.ml | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/generator/actions.ml b/generator/actions.ml index 39c71ab8..0c1f4ab2 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -2355,6 +2355,25 @@ backing file. Note that detecting disk features can be insecure under some circumstances. See L<guestfs(3)/CVE-2010-3851>." }; + { defaults with + name = "remove_drive"; + style = RErr, [String "label"], []; + tests = []; + shortdesc = "remove a disk image"; + longdesc = "\ +This function is conceptually the opposite of C<guestfs_add_drive_opts>. +It removes the drive that was previously added with label C<label>. + +Note that in order to remove drives, you have to add them with +labels (see the optional C<label> argument to C<guestfs_add_drive_opts>). +If you didn't use a label, then they cannot be removed. + +You can call this function before or after launching the handle. +If called after launch, if the attach-method supports it, we try to hot +unplug the drive: see L<guestfs(3)/HOTPLUGGING>. The disk B<must not> +be in use (eg. mounted) when you do this. We try to detect if the +disk is in use and stop you from doing this." }; + ] (* daemon_functions are any functions which cause some action @@ -9969,6 +9988,26 @@ are the full raw block device and partition names longdesc = "\ This function is used internally when hotplugging drives." }; + { defaults with + name = "internal_hot_remove_drive_precheck"; + style = RErr, [String "label"], []; + proc_nr = Some 371; + in_fish = false; in_docs = false; + tests = []; + shortdesc = "internal hotplugging operation"; + longdesc = "\ +This function is used internally when hotplugging drives." }; + + { defaults with + name = "internal_hot_remove_drive"; + style = RErr, [String "label"], []; + proc_nr = Some 372; + 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. |