Commit Graph

4 Commits

Author SHA1 Message Date
Ryan Gahagan
8d7708ac61 virsh: Added attach-disk support for network disk
Related issue: https://gitlab.com/libvirt/libvirt/-/issues/16
Added in support for the following parameters in attach-disk:
--source-protocol
--source-host-name
--source-host-socket
--source-host-transport

Added documentation to virsh.rst specifying usage.

Signed-off-by: Ryan Gahagan <rgahagan@cs.utexas.edu>
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-23 14:44:39 +01:00
Peter Krempa
464629223e virsh: Extract address formatting from cmdAttachDiskFormatAddress
Introduce virshAddressFormat with code from cmdAttachDiskFormatAddress
to format the address.

Note that this patch fixes some whitespace inconsistencies in the
formatted addresses.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-23 14:44:39 +01:00
Peter Krempa
5c9fc43e69 virsh: cmdAttachDisk: Don't assume type='block' if file can't be examined
'virsh attach-disk' uses stat() to determine if the 'source' is a
regular file. If stat fails though it assumes that the file is block.

Since it's way more common to have regular files and the detection does
not work at all when accessing a remote host, modify the default to
assume type='file' by default.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-23 14:44:39 +01:00
Peter Krempa
ed46c9921f tests: virsh: Add simple testsuite for using --print-xml of various commands
The test uses a script and compares the output against a template file.
VIR_TEST_REGENREATE_OUTPUT can be used on test failures. This test will
be marked as expensive once the refactors it guards are done.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
2020-11-23 14:44:39 +01:00