[libvirt] [PATCH v2 10/11] tests: Test user set aliases for qemu

Michal Privoznik mprivozn at redhat.com
Fri Oct 20 14:52:20 UTC 2017


Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
---
 .../qemuxml2argv-user-aliases.args                 |  71 +++++++++++
 .../qemuxml2argvdata/qemuxml2argv-user-aliases.xml | 140 +++++++++++++++++++++
 tests/qemuxml2argvtest.c                           |   5 +
 .../qemuxml2xmlout-user-aliases.xml                |   1 +
 tests/qemuxml2xmltest.c                            |   2 +
 5 files changed, 219 insertions(+)
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-user-aliases.args
 create mode 100644 tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml
 create mode 120000 tests/qemuxml2xmloutdata/qemuxml2xmlout-user-aliases.xml

diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.args b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.args
new file mode 100644
index 000000000..62fbd567b
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.args
@@ -0,0 +1,71 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/home/test \
+USER=test \
+LOGNAME=test \
+QEMU_AUDIO_DRV=none \
+/usr/bin/qemu-system-x86_64 \
+-name gentoo \
+-S \
+-M pc-i440fx-1.4 \
+-m 4096 \
+-smp 4,sockets=4,cores=1,threads=1 \
+-object memory-backend-file,id=ram-node0,prealloc=yes,\
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-gentoo,size=1073741824 \
+-numa node,nodeid=0,cpus=0,memdev=ram-node0 \
+-object memory-backend-file,id=ram-node1,prealloc=yes,\
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-gentoo,size=1073741824 \
+-numa node,nodeid=1,cpus=1,memdev=ram-node1 \
+-object memory-backend-file,id=ram-node2,prealloc=yes,\
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-gentoo,size=1073741824 \
+-numa node,nodeid=2,cpus=2,memdev=ram-node2 \
+-object memory-backend-file,id=ram-node3,prealloc=yes,\
+mem-path=/dev/hugepages1G/libvirt/qemu/-1-gentoo,size=1073741824 \
+-numa node,nodeid=3,cpus=3,memdev=ram-node3 \
+-uuid a75aca4b-a02f-2bcb-4a91-c93cd848c34b \
+-nodefaults \
+-chardev socket,id=charmonitor,path=/tmp/lib/domain--1-gentoo/monitor.sock,\
+server,nowait \
+-mon chardev=charmonitor,id=monitor,mode=readline \
+-global PIIX4_PM.disable_s3=0 \
+-global PIIX4_PM.disable_s4=0 \
+-boot cd \
+-device virtio-serial-pci,id=virtio-serial0,bus=pci.0,addr=0x8 \
+-usb \
+-drive file=/var/lib/libvirt/images/fd.img,format=raw,if=none,\
+id=drive-ua-myDisk1,cache=none \
+-global isa-fdc.driveA=drive-ua-myDisk1 \
+-drive file=/var/lib/libvirt/images/gentoo.qcow2,format=qcow2,if=none,\
+id=drive-ua-myDisk2 \
+-device virtio-blk-pci,bus=pci.0,addr=0x5,drive=drive-ua-myDisk2,id=ua-myDisk2 \
+-drive file=/var/lib/libvirt/images/OtherDemo.img,format=qcow2,if=none,\
+id=drive-ua-myEncryptedDisk1 \
+-device virtio-blk-pci,bus=pci.0,addr=0x7,drive=drive-ua-myEncryptedDisk1,\
+id=ua-myEncryptedDisk1 \
+-drive file=/home/zippy/tmp/install-amd64-minimal-20140619.iso,format=raw,\
+if=none,media=cdrom,id=drive-ua-WhatAnAwesomeCDROM,readonly=on,cache=none \
+-device ide-drive,bus=ua-DoesAnybodyStillUseIDE.1,unit=0,\
+drive=drive-ua-WhatAnAwesomeCDROM,id=ua-WhatAnAwesomeCDROM \
+-device virtio-net-pci,vlan=0,id=ua-CheckoutThisNIC,mac=52:54:00:d6:c0:0b,\
+bus=pci.0,addr=0x3 \
+-net tap,fd=3,vlan=0,name=hostua-CheckoutThisNIC \
+-device rtl8139,vlan=1,id=ua-WeCanAlsoDoServerMode,mac=52:54:00:22:c9:42,\
+bus=pci.0,addr=0x9 \
+-net socket,listen=127.0.0.1:1234,vlan=1,name=hostua-WeCanAlsoDoServerMode \
+-device rtl8139,vlan=2,id=ua-AndAlsoClientMode,mac=52:54:00:8c:b1:f8,bus=pci.0,\
+addr=0xa \
+-net socket,connect=127.0.0.1:1234,vlan=2,name=hostua-AndAlsoClientMode \
+-chardev pty,id=charserial0 \
+-device isa-serial,chardev=charserial0,id=serial0 \
+-chardev pty,id=charserial1 \
+-device isa-serial,chardev=charserial1,id=serial1 \
+-chardev socket,id=charchannel0,\
+path=/var/lib/libvirt/qemu/channel/target/gentoo.org.qemu.guest_agent.0,server,\
+nowait \
+-device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,\
+id=channel0,name=org.qemu.guest_agent.0 \
+-vnc 127.0.0.1:0 \
+-vga cirrus \
+-device intel-hda,id=sound0,bus=pci.0,addr=0x4 \
+-device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0 \
+-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x6
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml
new file mode 100644
index 000000000..d1cb8fea6
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-user-aliases.xml
@@ -0,0 +1,140 @@
+<domain type='kvm'>
+  <name>gentoo</name>
+  <uuid>a75aca4b-a02f-2bcb-4a91-c93cd848c34b</uuid>
+  <memory unit='KiB'>4194304</memory>
+  <currentMemory unit='KiB'>4194304</currentMemory>
+  <memoryBacking>
+    <hugepages>
+      <page size='1048576' unit='KiB' nodeset='0-3'/>
+    </hugepages>
+  </memoryBacking>
+  <vcpu placement='static'>4</vcpu>
+  <os>
+    <type arch='x86_64' machine='pc-i440fx-1.4'>hvm</type>
+    <boot dev='hd'/>
+    <boot dev='cdrom'/>
+  </os>
+  <features>
+    <acpi/>
+    <apic/>
+    <pae/>
+  </features>
+  <cpu>
+    <numa>
+      <cell id='0' cpus='0' memory='1048576' unit='KiB'/>
+      <cell id='1' cpus='1' memory='1048576' unit='KiB'/>
+      <cell id='2' cpus='2' memory='1048576' unit='KiB'/>
+      <cell id='3' cpus='3' memory='1048576' unit='KiB'/>
+    </numa>
+  </cpu>
+  <clock offset='utc'/>
+  <on_poweroff>destroy</on_poweroff>
+  <on_reboot>restart</on_reboot>
+  <on_crash>restart</on_crash>
+  <pm>
+    <suspend-to-mem enabled='yes'/>
+    <suspend-to-disk enabled='yes'/>
+  </pm>
+  <devices>
+    <emulator>/usr/bin/qemu-system-x86_64</emulator>
+    <disk type='file' device='floppy'>
+      <driver name='qemu' type='raw' cache='none'/>
+      <source file='/var/lib/libvirt/images/fd.img'/>
+      <target dev='fda' bus='fdc'/>
+      <alias name='ua-myDisk1'/>
+      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2'/>
+      <source file='/var/lib/libvirt/images/gentoo.qcow2'/>
+      <target dev='vda' bus='virtio'/>
+      <alias name='ua-myDisk2'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
+    </disk>
+    <disk type='file' device='disk'>
+      <driver name='qemu' type='qcow2'/>
+      <source file='/var/lib/libvirt/images/OtherDemo.img'/>
+      <target dev='vdb' bus='virtio'/>
+      <encryption format='qcow'>
+        <secret type='passphrase' uuid='e78d4b51-a2af-485f-b0f5-afca709a80f4'/>
+      </encryption>
+      <alias name='ua-myEncryptedDisk1'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
+    </disk>
+    <disk type='file' device='cdrom'>
+      <driver name='qemu' type='raw' cache='none'/>
+      <source file='/home/zippy/tmp/install-amd64-minimal-20140619.iso'/>
+      <target dev='hdc' bus='ide'/>
+      <readonly/>
+      <shareable/>
+      <alias name='ua-WhatAnAwesomeCDROM'/>
+      <address type='drive' controller='0' bus='1' target='0' unit='0'/>
+    </disk>
+    <controller type='usb' index='0'>
+      <alias name='ua-SomeWeirdController'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
+    </controller>
+    <controller type='pci' index='0' model='pci-root'/>
+    <controller type='ide' index='0'>
+      <alias name='ua-DoesAnybodyStillUseIDE'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/>
+    </controller>
+    <controller type='virtio-serial' index='0'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
+    </controller>
+    <controller type='fdc' index='0'/>
+    <interface type='ethernet'>
+      <mac address='52:54:00:d6:c0:0b'/>
+      <model type='virtio'/>
+      <alias name='ua-CheckoutThisNIC'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
+    </interface>
+    <interface type='server'>
+      <mac address='52:54:00:22:c9:42'/>
+      <source address='127.0.0.1' port='1234'/>
+      <bandwidth>
+        <inbound average='1234'/>
+        <outbound average='5678'/>
+      </bandwidth>
+      <model type='rtl8139'/>
+      <alias name='ua-WeCanAlsoDoServerMode'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
+    </interface>
+    <interface type='client'>
+      <mac address='52:54:00:8c:b1:f8'/>
+      <source address='127.0.0.1' port='1234'/>
+      <model type='rtl8139'/>
+      <alias name='ua-AndAlsoClientMode'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/>
+    </interface>
+    <serial type='pty'>
+      <target port='0'/>
+    </serial>
+    <serial type='pty'>
+      <target port='1'/>
+    </serial>
+    <console type='pty'>
+      <target type='serial' port='0'/>
+    </console>
+    <channel type='unix'>
+      <source mode='bind' path='/var/lib/libvirt/qemu/channel/target/gentoo.org.qemu.guest_agent.0'/>
+      <target type='virtio' name='org.qemu.guest_agent.0'/>
+      <address type='virtio-serial' controller='0' bus='0' port='1'/>
+    </channel>
+    <input type='mouse' bus='ps2'/>
+    <input type='keyboard' bus='ps2'/>
+    <graphics type='vnc' port='-1' autoport='yes'>
+      <listen type='address'/>
+    </graphics>
+    <sound model='ich6'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
+    </sound>
+    <video>
+      <model type='cirrus' vram='16384' heads='1' primary='yes'/>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
+    </video>
+    <memballoon model='virtio'>
+      <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
+    </memballoon>
+  </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index ec6fad453..03b1bcbcf 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2811,6 +2811,11 @@ mymain(void)
     DO_TEST_PARSE_ERROR("cpu-cache-passthrough3", QEMU_CAPS_KVM);
     DO_TEST_PARSE_ERROR("cpu-cache-passthrough-l3", QEMU_CAPS_KVM);
 
+    DO_TEST("user-aliases", QEMU_CAPS_KVM, QEMU_CAPS_DEVICE_CIRRUS_VGA,
+            QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_PIIX_DISABLE_S3,
+            QEMU_CAPS_PIIX_DISABLE_S4, QEMU_CAPS_VNC,
+            QEMU_CAPS_HDA_DUPLEX);
+
     if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
         virFileDeleteTree(fakerootdir);
 
diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-user-aliases.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-user-aliases.xml
new file mode 120000
index 000000000..5fe737a69
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-user-aliases.xml
@@ -0,0 +1 @@
+../qemuxml2argvdata/qemuxml2argv-user-aliases.xml
\ No newline at end of file
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 41663a0ea..fdba2adb9 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -1271,6 +1271,8 @@ mymain(void)
     DO_TEST("pseries-cpu-compat", NONE);
     DO_TEST("pseries-cpu-exact", NONE);
 
+    DO_TEST("user-aliases", NONE);
+
     if (getenv("LIBVIRT_SKIP_CLEANUP") == NULL)
         virFileDeleteTree(fakerootdir);
 
-- 
2.13.6




More information about the libvir-list mailing list