This is the same as the existing pseries-phb-simple, except that
each of the controllers is given a user alias. If we tried to
start the resulting guest, we'd get an error:
Bus 'ua-phb0' not found
This is because, at the QEMU command line level, the default PHB
is not represented and so it can't be given a custom alias. We're
going to address this issue in a follow-up commit.
Signed-off-by: Andrea Bolognani <abologna(a)redhat.com>
---
.../pseries-phb-user-alias.ppc64-latest.args | 36 +++++++++++++++
.../pseries-phb-user-alias.xml | 30 +++++++++++++
tests/qemuxml2argvtest.c | 1 +
.../pseries-phb-user-alias.ppc64-latest.xml | 45 +++++++++++++++++++
tests/qemuxml2xmltest.c | 1 +
5 files changed, 113 insertions(+)
create mode 100644 tests/qemuxml2argvdata/pseries-phb-user-alias.ppc64-latest.args
create mode 100644 tests/qemuxml2argvdata/pseries-phb-user-alias.xml
create mode 100644 tests/qemuxml2xmloutdata/pseries-phb-user-alias.ppc64-latest.xml
diff --git a/tests/qemuxml2argvdata/pseries-phb-user-alias.ppc64-latest.args
b/tests/qemuxml2argvdata/pseries-phb-user-alias.ppc64-latest.args
new file mode 100644
index 0000000000..e64fc9aa11
--- /dev/null
+++ b/tests/qemuxml2argvdata/pseries-phb-user-alias.ppc64-latest.args
@@ -0,0 +1,36 @@
+LC_ALL=C \
+PATH=/bin \
+HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
+USER=test \
+LOGNAME=test \
+XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
+XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
+XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
+/usr/bin/qemu-system-ppc64 \
+-name guest=QEMUGuest1,debug-threads=on \
+-S \
+-object
'{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes"}'
\
+-machine pseries,usb=off,dump-guest-core=off,memory-backend=ppc_spapr.ram \
+-accel tcg \
+-cpu POWER9 \
+-m size=524288k \
+-object
'{"qom-type":"memory-backend-ram","id":"ppc_spapr.ram","size":536870912}'
\
+-overcommit mem-lock=off \
+-smp 1,sockets=1,cores=1,threads=1 \
+-uuid 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 \
+-display none \
+-no-user-config \
+-nodefaults \
+-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
+-mon chardev=charmonitor,id=monitor,mode=control \
+-rtc base=utc \
+-no-shutdown \
+-boot strict=on \
+-device
'{"driver":"spapr-pci-host-bridge","index":1,"id":"ua-phb1"}'
\
+-netdev user,id=hostnet0 \
+-device
'{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:a2:44:92","bus":"ua-phb0","addr":"0x1"}'
\
+-netdev user,id=hostnet1 \
+-device
'{"driver":"virtio-net-pci","netdev":"hostnet1","id":"net1","mac":"52:54:00:a2:44:93","bus":"ua-phb1.0","addr":"0x1"}'
\
+-audiodev
'{"id":"audio1","driver":"none"}' \
+-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
+-msg timestamp=on
diff --git a/tests/qemuxml2argvdata/pseries-phb-user-alias.xml
b/tests/qemuxml2argvdata/pseries-phb-user-alias.xml
new file mode 100644
index 0000000000..1f95e52747
--- /dev/null
+++ b/tests/qemuxml2argvdata/pseries-phb-user-alias.xml
@@ -0,0 +1,30 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <memory unit='KiB'>524288</memory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc64' machine='pseries'>hvm</type>
+ </os>
+ <devices>
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <controller type='usb' model='none'/>
+ <controller type='pci' model='pci-root'>
+ <alias name='ua-phb0'/>
+ </controller>
+ <controller type='pci' model='pci-root'>
+ <alias name='ua-phb1'/>
+ </controller>
+ <interface type='user'>
+ <mac address='52:54:00:a2:44:92'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x0'/>
+ </interface>
+ <interface type='user'>
+ <mac address='52:54:00:a2:44:93'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x01'
slot='0x01' function='0x0'/>
+ </interface>
+ <memballoon model='none'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 1be138bb0f..354f47bea3 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -2038,6 +2038,7 @@ mymain(void)
DO_TEST_CAPS_LATEST_PPC64("pseries-phb-simple");
DO_TEST_CAPS_LATEST_PPC64("pseries-phb-default-missing");
DO_TEST_CAPS_LATEST_PPC64("pseries-phb-numa-node");
+ DO_TEST_CAPS_LATEST_PPC64("pseries-phb-user-alias");
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("pseries-default-phb-numa-node",
"ppc64");
DO_TEST_CAPS_ARCH_LATEST_PARSE_ERROR("pseries-phb-invalid-target-index-1",
"ppc64");
diff --git a/tests/qemuxml2xmloutdata/pseries-phb-user-alias.ppc64-latest.xml
b/tests/qemuxml2xmloutdata/pseries-phb-user-alias.ppc64-latest.xml
new file mode 100644
index 0000000000..d6de2037a8
--- /dev/null
+++ b/tests/qemuxml2xmloutdata/pseries-phb-user-alias.ppc64-latest.xml
@@ -0,0 +1,45 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>1ccfd97d-5eb4-478a-bbe6-88d254c16db7</uuid>
+ <memory unit='KiB'>524288</memory>
+ <currentMemory unit='KiB'>524288</currentMemory>
+ <vcpu placement='static'>1</vcpu>
+ <os>
+ <type arch='ppc64' machine='pseries'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <cpu mode='custom' match='exact' check='none'>
+ <model fallback='forbid'>POWER9</model>
+ </cpu>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu-system-ppc64</emulator>
+ <controller type='usb' index='0' model='none'/>
+ <controller type='pci' index='0' model='pci-root'>
+ <model name='spapr-pci-host-bridge'/>
+ <target index='0'/>
+ <alias name='ua-phb0'/>
+ </controller>
+ <controller type='pci' index='1' model='pci-root'>
+ <model name='spapr-pci-host-bridge'/>
+ <target index='1'/>
+ <alias name='ua-phb1'/>
+ </controller>
+ <interface type='user'>
+ <mac address='52:54:00:a2:44:92'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x00'
slot='0x01' function='0x0'/>
+ </interface>
+ <interface type='user'>
+ <mac address='52:54:00:a2:44:93'/>
+ <model type='virtio'/>
+ <address type='pci' domain='0x0000' bus='0x01'
slot='0x01' function='0x0'/>
+ </interface>
+ <audio id='1' type='none'/>
+ <memballoon model='none'/>
+ <panic model='pseries'/>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
index 15cb6bd692..b281d9970f 100644
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -541,6 +541,7 @@ mymain(void)
DO_TEST_CAPS_ARCH_LATEST("pseries-phb-simple", "ppc64");
DO_TEST_CAPS_ARCH_LATEST("pseries-phb-default-missing",
"ppc64");
DO_TEST_CAPS_ARCH_LATEST("pseries-phb-numa-node", "ppc64");
+ DO_TEST_CAPS_ARCH_LATEST("pseries-phb-user-alias", "ppc64");
DO_TEST_CAPS_ARCH_LATEST("pseries-many-devices", "ppc64");
DO_TEST_CAPS_ARCH_LATEST("pseries-many-buses-1", "ppc64");
--
2.43.0