summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorRyan Gahagan <rgahagan@cs.utexas.edu>2020-11-18 17:48:13 -0600
committerPeter Krempa <pkrempa@redhat.com>2020-11-23 14:44:39 +0100
commit8d7708ac6130afaa9d48c8bff9dc4ec7df41d151 (patch)
tree85f4071eb3a27e4819adc4ceba48b0b3307f1f62 /tests
parent61c8164502d756c0369ab7788dd67d528e66e951 (diff)
downloadlibvirt-8d7708ac6130afaa9d48c8bff9dc4ec7df41d151.tar.gz
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>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/virsh-output-commands14
-rw-r--r--tests/virsh-output.out88
2 files changed, 102 insertions, 0 deletions
diff --git a/tests/virsh-output-commands b/tests/virsh-output-commands
index 43f87bee0f..d8e73fc1ac 100755
--- a/tests/virsh-output-commands
+++ b/tests/virsh-output-commands
@@ -78,3 +78,17 @@ attach_disk --target sda --sourcetype file --type disk --address ccw:12.34.56
attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
attach_disk --target vda --sourcetype file --type disk --address test:12:34:56
attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
+
+./virsh attach-disk --print-xml --domain testdom $@ --source "" --source-protocol AAA
+./virsh attach-disk --print-xml --domain testdom $@ --source "" --source-protocol AAA
+attach_disk --target hda --source-protocol AAA --sourcetype file
+attach_disk --target hda --sourcetype network
+attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname
+attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port
+attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:
+attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :port
+attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :
+attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp
+attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp
+attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket
+attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket
diff --git a/tests/virsh-output.out b/tests/virsh-output.out
index 6af7600a9c..d8ef641c2a 100644
--- a/tests/virsh-output.out
+++ b/tests/virsh-output.out
@@ -405,4 +405,92 @@ error: Invalid address.
+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type disk --address test:12.34.56 --source /nonexistent/file
error: Invalid address.
++ ./virsh attach-disk --print-xml --domain testdom --source '' --source-protocol AAA
+error: command 'attach-disk' requires <target> option
++ ./virsh attach-disk --print-xml --domain testdom --source '' --source-protocol AAA
+error: command 'attach-disk' requires <target> option
++ attach_disk --target hda --source-protocol AAA --sourcetype file
++ ./virsh attach-disk --print-xml --domain testdom --target hda --source-protocol AAA --sourcetype file --source /nonexistent/file
+error: --source-protocol option requires --sourcetype network
+
++ attach_disk --target hda --sourcetype network
++ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source /nonexistent/file
+error: --source-protocol option requires --sourcetype network
+
++ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname
++ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname --source /nonexistent/file
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host name='hostname'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
++ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port
++ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source /nonexistent/file
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host name='hostname' port='port'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
++ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:
++ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname: --source /nonexistent/file
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host name='hostname' port=''/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
++ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :port
++ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name :port --source /nonexistent/file
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host name='' port='port'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
++ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name :
++ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name : --source /nonexistent/file
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host name='' port=''/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
++ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp
++ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-name hostname:port --source-host-transport trnsp --source /nonexistent/file
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host transport='trnsp' name='hostname' port='port'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
++ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp
++ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source /nonexistent/file
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host transport='trnsp'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
++ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket
++ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-transport trnsp --source-host-socket /nonexistent/socket --source /nonexistent/file
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host transport='trnsp' socket='/nonexistent/socket'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
++ attach_disk --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket
++ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket --source /nonexistent/file
+error: Option --source-host-transport is required by option --source-host-socket
+
end