
On Tue, 2016-09-20 at 15:14 -0400, Laine Stump wrote:
These functions provide a simple one line method of learning if the current domain has a pci-root or pcie-root bus. --- src/qemu/qemu_domain.c | 28 ++++++++++++++++++++++++++++ src/qemu/qemu_domain.h | 2 ++ 2 files changed, 30 insertions(+) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3f16dbe..227134e 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -5263,6 +5263,34 @@ qemuDomainMachineIsI440FX(const virDomainDef *def) bool +qemuDomainMachineHasPCIRoot(const virDomainDef *def) +{ + int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0); + + if (root < 0) + return false; + + if (def->controllers[root]->model == VIR_DOMAIN_CONTROLLER_MODEL_PCI_ROOT) + return true;
Please leave an empty line here...
+ return false; +} + + +bool +qemuDomainMachineHasPCIeRoot(const virDomainDef *def) +{ + int root = virDomainControllerFind(def, VIR_DOMAIN_CONTROLLER_TYPE_PCI, 0); + + if (root < 0) + return false; + + if (def->controllers[root]->model == VIR_DOMAIN_CONTROLLER_MODEL_PCIE_ROOT) + return true;
... and here. You might want to consider reversing the polarity of the neutron flow^W^W^W^W^Wmodel check, so that the function looks like if (...) return false; if (...) return false; return true; ACK, with the empty lines added, whether or not you decide to go for this change. -- Andrea Bolognani / Red Hat / Virtualization