xl: implement documented '--force' option for block-detach
authorPaul Durrant <pdurrant@amazon.com>
Tue, 15 Sep 2020 14:10:07 +0000 (15:10 +0100)
committerWei Liu <wl@xen.org>
Thu, 1 Oct 2020 09:32:57 +0000 (09:32 +0000)
commit707eb41ae2dde4636261f631224c97e9c0b16b56
tree58e7829978c60157b239e7f5c7e8caf0f046c169
parent6df07f9fbe1e9b65a40183f79a6171200dc877dd
xl: implement documented '--force' option for block-detach

The manpage for 'xl' documents an option to force a block device to be
released even if the domain to which it is attached does not co-operate.
The documentation also states that, if the force flag is not specified, the
block-detach operation should fail.

Currently the force option is not implemented and a non-forced block-detach
will auto-force after a time-out of 10s. This patch implements the force
option and also stops auto-forcing a non-forced block-detach by calling
libxl_device_disk_safe_remove() rather than libxl_device_disk_remove(),
allowing the operation to fail cleanly as per the documented behaviour.

NOTE: The documentation is also adjusted since the normal positioning of
      options is before compulsory parameters. It is also noted that use of
      the --force option may lead to a guest crash.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
Acked-by: Wei Liu <wl@xen.org>
docs/man/xl.1.pod.in
tools/xl/xl_block.c
tools/xl/xl_cmdtable.c