]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
tests: Add pseries-phb-user-alias
authorAndrea Bolognani <abologna@redhat.com>
Tue, 16 Jan 2024 16:05:07 +0000 (17:05 +0100)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 17 Jan 2024 18:18:19 +0000 (19:18 +0100)
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>
tests/qemuxml2argvdata/pseries-phb-user-alias.ppc64-latest.args [new file with mode: 0644]
tests/qemuxml2argvdata/pseries-phb-user-alias.xml [new file with mode: 0644]
tests/qemuxml2xmloutdata/pseries-phb-user-alias.ppc64-latest.xml [new file with mode: 0644]
tests/qemuxmlconftest.c

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 (file)
index 0000000..e64fc9a
--- /dev/null
@@ -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 (file)
index 0000000..1f95e52
--- /dev/null
@@ -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/qemuxml2xmloutdata/pseries-phb-user-alias.ppc64-latest.xml b/tests/qemuxml2xmloutdata/pseries-phb-user-alias.ppc64-latest.xml
new file mode 100644 (file)
index 0000000..d6de203
--- /dev/null
@@ -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>
index 73c0772c81ef8c7cf92a74a2ed53253dcf700ad9..6fea3808db719d6a7a05a1e6bac97cc3ad1c99df 100644 (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");