if (virDomainDeviceAliasIsUserAlias(contAlias)) {
/* When domain has builtin pci-root controller we don't put it
* onto cmd line. Therefore we can't set its alias. In that
- * case, use the default one. */
- if (!qemuDomainIsPSeries(domainDef) &&
- cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) {
+ * case, use the default one.
+ *
+ * Note that we have to check the value of targetIndex here,
+ * because we need to handle three different cases:
+ *
+ * non-pSeries guest (targetIndex == -1)
+ * => must use default alias
+ *
+ * pSeries guest, default PHB (targetIndex == 0)
+ * => must use default alias
+ *
+ * pSeries guest, non-default PHB (targetIndex > 0)
+ * => can use actual alias
+ *
+ * The last one is due to non-default PHBs beind created
+ * through the spapr-pci-host-bridge device, which supports
+ * custom device IDs and thus custom bus names.
+ * */
+ if (cont->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT &&
+ contTargetIndex <= 0) {
if (virQEMUCapsHasPCIMultiBus(domainDef))
contAlias = "pci.0";
else
-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"}' \
+-device '{"driver":"virtio-net-pci","netdev":"hostnet0","id":"net0","mac":"52:54:00:a2:44:92","bus":"pci.0","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"}' \