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>
This commit is contained in:
Peter Krempa 2020-11-19 15:09:10 +01:00
parent 24ce5a6cd2
commit ed46c9921f
4 changed files with 516 additions and 0 deletions

View File

@ -654,6 +654,7 @@ if conf.has('WITH_LIBVIRTD')
'virsh-define-dev-segfault',
'virsh-int-overflow',
'virsh-optparse',
'virsh-output',
'virsh-read-bufsiz',
'virsh-read-non-seekable',
'virsh-schedinfo',

27
tests/virsh-output Executable file
View File

@ -0,0 +1,27 @@
#!/bin/sh
. "$(dirname $0)/test-lib.sh"
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

80
tests/virsh-output-commands Executable file
View File

@ -0,0 +1,80 @@
#!/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

408
tests/virsh-output.out Normal file
View File

@ -0,0 +1,408 @@
+ ./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='block'>
<source dev='/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.
end