tests: Add pseries-phb-user-alias

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@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Andrea Bolognani 2024-01-16 17:05:07 +01:00
parent 9de7fded51
commit 95032b89d4
4 changed files with 112 additions and 0 deletions

View File

@ -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

View File

@ -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>

View File

@ -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>

View File

@ -2187,6 +2187,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");