1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

qemu: Move skip for implicit PHB of pSeries guests

Performing the skip earlier will help us making the function
nicer later on. We also make the condition for the skip a bit
more precise, though that'a more for self-documenting purposes
and doesn't change anything in practice.

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Andrea Bolognani 2018-02-12 18:52:40 +01:00
parent 3424de6288
commit 35e9c02cbe

View File

@ -2732,6 +2732,13 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
def->model != VIR_DOMAIN_CONTROLLER_MODEL_PCI_LAST)
modelName = virDomainControllerPCIModelNameTypeToString(pciopts->modelName);
/* Skip the implicit PHB for pSeries guests */
if (def->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT &&
pciopts->modelName == VIR_DOMAIN_CONTROLLER_PCI_MODEL_NAME_SPAPR_PCI_HOST_BRIDGE &&
pciopts->targetIndex == 0) {
goto done;
}
switch ((virDomainControllerModelPCI) def->model) {
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_BRIDGE:
virBufferAsprintf(&buf, "%s,chassis_nr=%d,id=%s",
@ -2759,10 +2766,6 @@ qemuBuildControllerDevStr(const virDomainDef *domainDef,
pciopts->chassis, def->info.alias);
break;
case VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT:
/* Skip the implicit one */
if (pciopts->targetIndex == 0)
goto done;
virBufferAsprintf(&buf, "%s,index=%d,id=%s",
modelName, pciopts->targetIndex,
def->info.alias);