[PATCH v3 03/18] qemu: new functions qemuDomainMachineHasPCI[e]Root()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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;
+    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;
+    return false;
+}
+
+
+bool
 qemuDomainMachineNeedsFDC(const virDomainDef *def)
 {
     char *p = STRSKIP(def->os.machine, "pc-q35-");
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index a1404d0..5b97c8c 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -637,6 +637,8 @@ virDomainChrDefPtr qemuFindAgentConfig(virDomainDefPtr def);
 
 bool qemuDomainMachineIsQ35(const virDomainDef *def);
 bool qemuDomainMachineIsI440FX(const virDomainDef *def);
+bool qemuDomainMachineHasPCIRoot(const virDomainDef *def);
+bool qemuDomainMachineHasPCIeRoot(const virDomainDef *def);
 bool qemuDomainMachineNeedsFDC(const virDomainDef *def);
 bool qemuDomainMachineIsS390CCW(const virDomainDef *def);
 bool qemuDomainMachineIsVirt(const virDomainDef *def);
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]