Adapt the 'tests/virsh-output-commands' file from 'virsh-output' test as
a source. Apart from expanding the bash function to each command, I've
also had to drop the negative tests for argument population, as a
command parsing error aborts the execution of the script right away
rather than just reporting the error.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
tests/meson.build | 1 -
tests/virsh-output | 29 --
tests/virsh-output-commands | 94 ------
tests/virsh-output.out | 496 ----------------------------
tests/virshtest.c | 1 +
tests/virshtestdata/attach-disk.in | 79 +++++
tests/virshtestdata/attach-disk.out | 343 +++++++++++++++++++
7 files changed, 423 insertions(+), 620 deletions(-)
delete mode 100755 tests/virsh-output
delete mode 100755 tests/virsh-output-commands
delete mode 100644 tests/virsh-output.out
create mode 100755 tests/virshtestdata/attach-disk.in
create mode 100644 tests/virshtestdata/attach-disk.out
diff --git a/tests/meson.build b/tests/meson.build
index 849a513f33..b70fe7732e 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -695,7 +695,6 @@ if conf.has('WITH_LIBVIRTD')
'virsh-cpuset',
'virsh-define-dev-segfault',
'virsh-int-overflow',
- 'virsh-output',
'virsh-read-bufsiz',
'virsh-read-non-seekable',
'virsh-schedinfo',
diff --git a/tests/virsh-output b/tests/virsh-output
deleted file mode 100755
index aa2d386c39..0000000000
--- a/tests/virsh-output
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-. "$(dirname $0)/test-lib.sh"
-
-test_expensive
-
-if [ ! -x /bin/bash ]; then
- echo skipping test - no bash
- exit 77
-fi
-
-mock_xdg_ || framework_failure
-
-export LIBVIRT_DEFAULT_URI='test:///default'
-ln -s $abs_top_builddir/tools/virsh virsh
-
-$abs_top_srcdir/tests/virsh-output-commands > out 2>&1
-
-echo end >> out
-
-if compare $abs_top_srcdir/tests/virsh-output.out out; then
- exit 0
-else
- if [ "x$VIR_TEST_REGENERATE_OUTPUT" = "x1" ]; then
- cp out $abs_top_srcdir/tests/virsh-output.out
- fi
-
- exit 1
-fi
diff --git a/tests/virsh-output-commands b/tests/virsh-output-commands
deleted file mode 100755
index d8e73fc1ac..0000000000
--- a/tests/virsh-output-commands
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/bash
-
-attach_disk()
-{
- ./virsh attach-disk --print-xml --domain testdom $@ --source /nonexistent/file
-}
-
-set -x
-
-./virsh attach-disk
-./virsh attach-disk --print-xml --domain testdom $@ --source ""
-./virsh attach-disk --print-xml --domain testdom $@ --source "" --sourcetype
file
-./virsh attach-disk --print-xml --domain testdom $@ --source "" --sourcetype
blah
-attach_disk --target hda
-attach_disk --target hda --sourcetype file
-attach_disk --target hda --sourcetype block
-attach_disk --target hda --sourcetype nothing
-attach_disk --target hda --sourcetype file --type disk
-attach_disk --target hda --sourcetype block --type disk
-attach_disk --target hda --sourcetype file --type cdrom
-attach_disk --target hda --sourcetype block --type cdrom
-attach_disk --target hda --sourcetype file --type blah
-attach_disk --target hda --sourcetype block --type blah
-attach_disk --target hda --sourcetype file --type disk --driver testdriver
-attach_disk --target hda --sourcetype file --type disk --subdriver qcow2
-attach_disk --target hda --sourcetype file --type disk --subdriver raw
-attach_disk --target hda --sourcetype file --type disk --cache none
-attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --cache none
-attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --serial
TEST_SERIAL
-attach_disk --target hda --sourcetype file --type disk --mode readonly
-attach_disk --target hda --sourcetype file --type disk --mode shareable
-attach_disk --target hda --sourcetype file --type disk --mode whatever
-attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias
testalias
-attach_disk --target hda --sourcetype file --type disk --rawio
-attach_disk --target hda --sourcetype file --type disk --multifunction
-attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias
testalias --iothread 3 --mode readonly --cache none --driver qemu
-
-attach_disk --target hda --sourcetype file --type disk --address ide:1.2.3
-attach_disk --target hda --sourcetype file --type disk --address ide:1.2.4
-attach_disk --target hda --sourcetype file --type disk --address ide:1:2:5
-attach_disk --target sda --sourcetype file --type disk --address ide:1.2.3
-attach_disk --target vda --sourcetype file --type disk --address ide:1.2.3
-
-attach_disk --target sda --sourcetype file --type disk --address usb:12.34
-attach_disk --target sda --sourcetype file --type disk --address usb:12.3
-attach_disk --target sda --sourcetype file --type disk --address usb:12:34
-attach_disk --target vda --sourcetype file --type disk --address usb:12.34
-attach_disk --target hda --sourcetype file --type disk --address usb:12.34
-
-attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.3
-attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.4
-attach_disk --target sda --sourcetype file --type disk --address scsi:1:2:5
-attach_disk --target hda --sourcetype file --type disk --address scsi:1.2.3
-attach_disk --target vda --sourcetype file --type disk --address scsi:1.2.3
-
-attach_disk --target sda --sourcetype file --type disk --address sata:1.2.3
-attach_disk --target sda --sourcetype file --type disk --address sata:1.2.4
-attach_disk --target sda --sourcetype file --type disk --address sata:1:2:5
-attach_disk --target hda --sourcetype file --type disk --address sata:1.2.3
-attach_disk --target vda --sourcetype file --type disk --address sata:1.2.3
-
-attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78
-attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78
-attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa
-attach_disk --target hda --sourcetype file --type disk --address pci:12.34.56.aa
-attach_disk --target sda --sourcetype file --type disk --address pci:12.34.56.aa
-
-attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78
--multifunction
-attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78
--multifunction
-attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa
--multifunction
-
-attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
-attach_disk --target vda --sourcetype file --type disk --address ccw:12:34:56
-attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
-attach_disk --target hda --sourcetype file --type disk --address ccw:12.34.56
-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
deleted file mode 100644
index d8ef641c2a..0000000000
--- a/tests/virsh-output.out
+++ /dev/null
@@ -1,496 +0,0 @@
-+ ./virsh attach-disk
-error: command 'attach-disk' requires <domain> option
-error: command 'attach-disk' requires <source> option
-error: command 'attach-disk' requires <target> option
-+ ./virsh attach-disk --print-xml --domain testdom --source ''
-error: command 'attach-disk' requires <target> option
-+ ./virsh attach-disk --print-xml --domain testdom --source '' --sourcetype file
-error: command 'attach-disk' requires <target> option
-+ ./virsh attach-disk --print-xml --domain testdom --source '' --sourcetype blah
-error: command 'attach-disk' requires <target> option
-+ attach_disk --target hda
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --source
/nonexistent/file
-<disk type='file'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file
--source /nonexistent/file
-<disk type='file'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype block
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block
--source /nonexistent/file
-<disk type='block'>
- <source dev='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype nothing
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype nothing
--source /nonexistent/file
-error: Unknown source type: 'nothing'
-
-+ attach_disk --target hda --sourcetype file --type disk
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype block --type disk
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --type
disk --source /nonexistent/file
-<disk type='block' device='disk'>
- <source dev='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type cdrom
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
cdrom --source /nonexistent/file
-<disk type='file' device='cdrom'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype block --type cdrom
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --type
cdrom --source /nonexistent/file
-<disk type='block' device='cdrom'>
- <source dev='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type blah
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
blah --source /nonexistent/file
-<disk type='file' device='blah'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype block --type blah
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype block --type
blah --source /nonexistent/file
-<disk type='block' device='blah'>
- <source dev='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --driver testdriver
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --driver testdriver --source /nonexistent/file
-<disk type='file' device='disk'>
- <driver name='testdriver'/>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --subdriver qcow2 --source /nonexistent/file
-<disk type='file' device='disk'>
- <driver type='qcow2'/>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --subdriver raw
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --subdriver raw --source /nonexistent/file
-<disk type='file' device='disk'>
- <driver type='raw'/>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --cache none
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --cache none --source /nonexistent/file
-<disk type='file' device='disk'>
- <driver cache='none'/>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --cache none
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --subdriver qcow2 --cache none --source /nonexistent/file
-<disk type='file' device='disk'>
- <driver type='qcow2' cache='none'/>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --serial
TEST_SERIAL
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --subdriver qcow2 --serial TEST_SERIAL --source /nonexistent/file
-<disk type='file' device='disk'>
- <driver type='qcow2'/>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
- <serial>TEST_SERIAL</serial>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --mode readonly
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --mode readonly --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
- <readonly/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --mode shareable
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --mode shareable --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
- <shareable/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --mode whatever
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --mode whatever --source /nonexistent/file
-error: No support for whatever in command 'attach-disk'
-
-+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias
testalias
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --subdriver qcow2 --alias testalias --source /nonexistent/file
-<disk type='file' device='disk'>
- <driver type='qcow2'/>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
- <alias name='testalias'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --rawio
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --rawio --source /nonexistent/file
-<disk type='file' device='disk' rawio='yes'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --multifunction
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --multifunction --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --subdriver qcow2 --alias
testalias --iothread 3 --mode readonly --cache none --driver qemu
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --subdriver qcow2 --alias testalias --iothread 3 --mode readonly --cache none
--driver qemu --source /nonexistent/file
-<disk type='file' device='disk'>
- <driver name='qemu' type='qcow2' iothread='3'
cache='none'/>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
- <readonly/>
- <alias name='testalias'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --address ide:1.2.3
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --address ide:1.2.3 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
- <address type='drive' controller='1' bus='2'
unit='3'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --address ide:1.2.4
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --address ide:1.2.4 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
- <address type='drive' controller='1' bus='2'
unit='4'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --address ide:1:2:5
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --address ide:1:2:5 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='hda'/>
- <address type='drive' controller='1' bus='2'
unit='5'/>
-</disk>
-
-+ attach_disk --target sda --sourcetype file --type disk --address ide:1.2.3
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address ide:1.2.3 --source /nonexistent/file
-error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
-
-+ attach_disk --target vda --sourcetype file --type disk --address ide:1.2.3
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address ide:1.2.3 --source /nonexistent/file
-error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
-
-+ attach_disk --target sda --sourcetype file --type disk --address usb:12.34
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address usb:12.34 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='sda'/>
- <address type='usb' bus='12' port='34'/>
-</disk>
-
-+ attach_disk --target sda --sourcetype file --type disk --address usb:12.3
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address usb:12.3 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='sda'/>
- <address type='usb' bus='12' port='3'/>
-</disk>
-
-+ attach_disk --target sda --sourcetype file --type disk --address usb:12:34
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address usb:12:34 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='sda'/>
- <address type='usb' bus='12' port='34'/>
-</disk>
-
-+ attach_disk --target vda --sourcetype file --type disk --address usb:12.34
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address usb:12.34 --source /nonexistent/file
-error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
-
-+ attach_disk --target hda --sourcetype file --type disk --address usb:12.34
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --address usb:12.34 --source /nonexistent/file
-error: expecting an ide:00.00.00 address.
-
-+ attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.3
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address scsi:1.2.3 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='sda'/>
- <address type='drive' controller='1' bus='2'
unit='3'/>
-</disk>
-
-+ attach_disk --target sda --sourcetype file --type disk --address scsi:1.2.4
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address scsi:1.2.4 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='sda'/>
- <address type='drive' controller='1' bus='2'
unit='4'/>
-</disk>
-
-+ attach_disk --target sda --sourcetype file --type disk --address scsi:1:2:5
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address scsi:1:2:5 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='sda'/>
- <address type='drive' controller='1' bus='2'
unit='5'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --address scsi:1.2.3
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --address scsi:1.2.3 --source /nonexistent/file
-error: expecting an ide:00.00.00 address.
-
-+ attach_disk --target vda --sourcetype file --type disk --address scsi:1.2.3
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address scsi:1.2.3 --source /nonexistent/file
-error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
-
-+ attach_disk --target sda --sourcetype file --type disk --address sata:1.2.3
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address sata:1.2.3 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='sda'/>
- <address type='drive' controller='1' bus='2'
unit='3'/>
-</disk>
-
-+ attach_disk --target sda --sourcetype file --type disk --address sata:1.2.4
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address sata:1.2.4 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='sda'/>
- <address type='drive' controller='1' bus='2'
unit='4'/>
-</disk>
-
-+ attach_disk --target sda --sourcetype file --type disk --address sata:1:2:5
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address sata:1:2:5 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='sda'/>
- <address type='drive' controller='1' bus='2'
unit='5'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --address sata:1.2.3
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --address sata:1.2.3 --source /nonexistent/file
-error: expecting an ide:00.00.00 address.
-
-+ attach_disk --target vda --sourcetype file --type disk --address sata:1.2.3
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address sata:1.2.3 --source /nonexistent/file
-error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
-
-+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address pci:12.34.56.78 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='vda'/>
- <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0x78'/>
-</disk>
-
-+ attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address pci:12:34:56:78 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='vda'/>
- <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0x78'/>
-</disk>
-
-+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address pci:12.34.56.aa --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='vda'/>
- <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0xaa'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --address pci:12.34.56.aa
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --address pci:12.34.56.aa --source /nonexistent/file
-error: expecting an ide:00.00.00 address.
-
-+ attach_disk --target sda --sourcetype file --type disk --address pci:12.34.56.aa
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address pci:12.34.56.aa --source /nonexistent/file
-error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
-
-+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.78
--multifunction
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address pci:12.34.56.78 --multifunction --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='vda'/>
- <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0x78' multifunction='on'/>
-</disk>
-
-+ attach_disk --target vda --sourcetype file --type disk --address pci:12:34:56:78
--multifunction
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address pci:12:34:56:78 --multifunction --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='vda'/>
- <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0x78' multifunction='on'/>
-</disk>
-
-+ attach_disk --target vda --sourcetype file --type disk --address pci:12.34.56.aa
--multifunction
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address pci:12.34.56.aa --multifunction --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='vda'/>
- <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0xaa' multifunction='on'/>
-</disk>
-
-+ attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address ccw:12.34.56 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='vda'/>
- <address type='ccw' cssid='0x12' ssid='0x34'
devno='0x0056'/>
-</disk>
-
-+ attach_disk --target vda --sourcetype file --type disk --address ccw:12:34:56
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address ccw:12:34:56 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='vda'/>
- <address type='ccw' cssid='0x12' ssid='0x34'
devno='0x0056'/>
-</disk>
-
-+ attach_disk --target vda --sourcetype file --type disk --address ccw:12.34.56
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address ccw:12.34.56 --source /nonexistent/file
-<disk type='file' device='disk'>
- <source file='/nonexistent/file'/>
- <target dev='vda'/>
- <address type='ccw' cssid='0x12' ssid='0x34'
devno='0x0056'/>
-</disk>
-
-+ attach_disk --target hda --sourcetype file --type disk --address ccw:12.34.56
-+ ./virsh attach-disk --print-xml --domain testdom --target hda --sourcetype file --type
disk --address ccw:12.34.56 --source /nonexistent/file
-error: expecting an ide:00.00.00 address.
-
-+ attach_disk --target sda --sourcetype file --type disk --address ccw:12.34.56
-+ ./virsh attach-disk --print-xml --domain testdom --target sda --sourcetype file --type
disk --address ccw:12.34.56 --source /nonexistent/file
-error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
-
-+ attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address test:12.34.56 --source /nonexistent/file
-error: Invalid address.
-
-+ attach_disk --target vda --sourcetype file --type disk --address test:12:34:56
-+ ./virsh attach-disk --print-xml --domain testdom --target vda --sourcetype file --type
disk --address test:12:34:56 --source /nonexistent/file
-error: Invalid address.
-
-+ attach_disk --target vda --sourcetype file --type disk --address test:12.34.56
-+ ./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
diff --git a/tests/virshtest.c b/tests/virshtest.c
index ca0a73651a..78f6148733 100644
--- a/tests/virshtest.c
+++ b/tests/virshtest.c
@@ -212,6 +212,7 @@ mymain(void)
/* The 'numeric-parsing-event' invokes virsh event with a 1 second timeout,
* thus is marked expensive */
DO_TEST_SCRIPT_FULL("numeric-parsing-event", true, NULL, VIRSH_DEFAULT,
"-q");
+ DO_TEST_SCRIPT("attach-disk", NULL, VIRSH_DEFAULT);
VIR_FREE(custom_uri);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
diff --git a/tests/virshtestdata/attach-disk.in b/tests/virshtestdata/attach-disk.in
new file mode 100755
index 0000000000..f46b12f6dc
--- /dev/null
+++ b/tests/virshtestdata/attach-disk.in
@@ -0,0 +1,79 @@
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype block
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype nothing
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype block --type disk
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type cdrom
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype block --type cdrom
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type blah
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype block --type blah
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --driver testdriver
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --subdriver qcow2
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --subdriver raw
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --cache none
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --subdriver qcow2 --cache none
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --subdriver qcow2 --serial TEST_SERIAL
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --mode readonly
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --mode shareable
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --mode whatever
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --subdriver qcow2 --alias testalias
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --rawio
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --multifunction
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --subdriver qcow2 --alias testalias --iothread 3 --mode
readonly --cache none --driver qemu
+
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --address ide:1.2.3
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --address ide:1.2.4
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --address ide:1:2:5
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address ide:1.2.3
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address ide:1.2.3
+
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address usb:12.34
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address usb:12.3
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address usb:12:34
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address usb:12.34
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --address usb:12.34
+
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address scsi:1.2.3
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address scsi:1.2.4
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address scsi:1:2:5
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --address scsi:1.2.3
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address scsi:1.2.3
+
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address sata:1.2.3
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address sata:1.2.4
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address sata:1:2:5
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --address sata:1.2.3
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address sata:1.2.3
+
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address pci:12.34.56.78
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address pci:12:34:56:78
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address pci:12.34.56.aa
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --address pci:12.34.56.aa
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address pci:12.34.56.aa
+
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address pci:12.34.56.78 --multifunction
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address pci:12:34:56:78 --multifunction
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address pci:12.34.56.aa --multifunction
+
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address ccw:12.34.56
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address ccw:12:34:56
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address ccw:12.34.56
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype file --type disk --address ccw:12.34.56
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target sda
--sourcetype file --type disk --address ccw:12.34.56
+
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address test:12.34.56
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address test:12:34:56
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target vda
--sourcetype file --type disk --address test:12.34.56
+
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--source-protocol AAA --sourcetype file
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype network
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype network --source-protocol TEST --source-host-name hostname
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype network --source-protocol TEST --source-host-name hostname:port
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype network --source-protocol TEST --source-host-name hostname:
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype network --source-protocol TEST --source-host-name :port
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype network --source-protocol TEST --source-host-name :
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype network --source-protocol TEST --source-host-name hostname:port
--source-host-transport trnsp
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype network --source-protocol TEST --source-host-transport trnsp
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype network --source-protocol TEST --source-host-transport trnsp
--source-host-socket /nonexistent/socket
+attach-disk --print-xml --domain testdom --source /nonexistent/file --target hda
--sourcetype network --source-protocol TEST --source-host-socket /nonexistent/socket
diff --git a/tests/virshtestdata/attach-disk.out b/tests/virshtestdata/attach-disk.out
new file mode 100644
index 0000000000..4f7fe7d8e0
--- /dev/null
+++ b/tests/virshtestdata/attach-disk.out
@@ -0,0 +1,343 @@
+<disk type='file'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='block'>
+ <source dev='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+error: Unknown source type: 'nothing'
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='block' device='disk'>
+ <source dev='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file' device='cdrom'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='block' device='cdrom'>
+ <source dev='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file' device='blah'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='block' device='blah'>
+ <source dev='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <driver name='testdriver'/>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <driver type='qcow2'/>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <driver type='raw'/>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <driver cache='none'/>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <driver type='qcow2' cache='none'/>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <driver type='qcow2'/>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+ <serial>TEST_SERIAL</serial>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+ <readonly/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+ <shareable/>
+</disk>
+
+error: No support for whatever in command 'attach-disk'
+
+<disk type='file' device='disk'>
+ <driver type='qcow2'/>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+ <alias name='testalias'/>
+</disk>
+
+<disk type='file' device='disk' rawio='yes'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <driver name='qemu' type='qcow2' iothread='3'
cache='none'/>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+ <readonly/>
+ <alias name='testalias'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+ <address type='drive' controller='1' bus='2'
unit='3'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+ <address type='drive' controller='1' bus='2'
unit='4'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='hda'/>
+ <address type='drive' controller='1' bus='2'
unit='5'/>
+</disk>
+
+error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
+
+error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='sda'/>
+ <address type='usb' bus='12' port='34'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='sda'/>
+ <address type='usb' bus='12' port='3'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='sda'/>
+ <address type='usb' bus='12' port='34'/>
+</disk>
+
+error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+
+error: expecting an ide:00.00.00 address.
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='sda'/>
+ <address type='drive' controller='1' bus='2'
unit='3'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='sda'/>
+ <address type='drive' controller='1' bus='2'
unit='4'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='sda'/>
+ <address type='drive' controller='1' bus='2'
unit='5'/>
+</disk>
+
+error: expecting an ide:00.00.00 address.
+
+error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='sda'/>
+ <address type='drive' controller='1' bus='2'
unit='3'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='sda'/>
+ <address type='drive' controller='1' bus='2'
unit='4'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='sda'/>
+ <address type='drive' controller='1' bus='2'
unit='5'/>
+</disk>
+
+error: expecting an ide:00.00.00 address.
+
+error: expecting a pci:0000.00.00.00 or ccw:00.0.0000 address.
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='vda'/>
+ <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0x78'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='vda'/>
+ <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0x78'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='vda'/>
+ <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0xaa'/>
+</disk>
+
+error: expecting an ide:00.00.00 address.
+
+error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='vda'/>
+ <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0x78' multifunction='on'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='vda'/>
+ <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0x78' multifunction='on'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='vda'/>
+ <address type='pci' domain='0x0012' bus='0x34'
slot='0x56' function='0xaa' multifunction='on'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='vda'/>
+ <address type='ccw' cssid='0x12' ssid='0x34'
devno='0x0056'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='vda'/>
+ <address type='ccw' cssid='0x12' ssid='0x34'
devno='0x0056'/>
+</disk>
+
+<disk type='file' device='disk'>
+ <source file='/nonexistent/file'/>
+ <target dev='vda'/>
+ <address type='ccw' cssid='0x12' ssid='0x34'
devno='0x0056'/>
+</disk>
+
+error: expecting an ide:00.00.00 address.
+
+error: expecting a scsi:00.00.00 or usb:00.00 or sata:00.00.00 address.
+
+error: Invalid address.
+
+error: Invalid address.
+
+error: Invalid address.
+
+error: --source-protocol option requires --sourcetype network
+
+error: --source-protocol option requires --sourcetype network
+
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host name='hostname'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host name='hostname' port='port'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host name='hostname' port=''/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host name='' port='port'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host name='' port=''/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host transport='trnsp' name='hostname' port='port'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host transport='trnsp'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
+<disk type='network'>
+ <source protocol='TEST' name='/nonexistent/file'>
+ <host transport='trnsp' socket='/nonexistent/socket'/>
+ </source>
+ <target dev='hda'/>
+</disk>
+
+error: Option --source-host-transport is required by option --source-host-socket
+
+
+## Exit code: 1
--
2.44.0