mirror of https://gitee.com/openkylin/libvirt.git
qemu: turn if into switch in qemuDomainValidateDevicePCISlotsQ35
This will make it simpler to add checks for other types of controllers. This is a prerequisite for patches to resolve: https://bugzilla.redhat.com/show_bug.cgi?id=1003983
This commit is contained in:
parent
b83d26f6c4
commit
c484fe16cb
|
@ -2534,11 +2534,14 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
|
||||||
char *addrStr = NULL;
|
char *addrStr = NULL;
|
||||||
qemuDomainPCIConnectFlags flags = QEMU_PCI_CONNECT_TYPE_PCIE;
|
qemuDomainPCIConnectFlags flags = QEMU_PCI_CONNECT_TYPE_PCIE;
|
||||||
|
|
||||||
/* Verify that the first SATA controller is at 00:1F.2 */
|
|
||||||
/* the q35 machine type *always* has a SATA controller at this address */
|
|
||||||
for (i = 0; i < def->ncontrollers; i++) {
|
for (i = 0; i < def->ncontrollers; i++) {
|
||||||
if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA &&
|
switch (def->controllers[i]->type) {
|
||||||
def->controllers[i]->idx == 0) {
|
case VIR_DOMAIN_CONTROLLER_TYPE_SATA:
|
||||||
|
/* Verify that the first SATA controller is at 00:1F.2 the
|
||||||
|
* q35 machine type *always* has a SATA controller at this
|
||||||
|
* address.
|
||||||
|
*/
|
||||||
|
if (def->controllers[i]->idx == 0) {
|
||||||
if (def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
if (def->controllers[i]->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
|
||||||
if (def->controllers[i]->info.addr.pci.domain != 0 ||
|
if (def->controllers[i]->info.addr.pci.domain != 0 ||
|
||||||
def->controllers[i]->info.addr.pci.bus != 0 ||
|
def->controllers[i]->info.addr.pci.bus != 0 ||
|
||||||
|
@ -2556,6 +2559,8 @@ qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
|
||||||
def->controllers[i]->info.addr.pci.function = 2;
|
def->controllers[i]->info.addr.pci.function = 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reserve slot 0x1F function 0 (ISA bridge, not in config model)
|
/* Reserve slot 0x1F function 0 (ISA bridge, not in config model)
|
||||||
|
|
Loading…
Reference in New Issue