[PATCH 5/9] qemu: Add arch checks to qemuDomainMachine*()

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

 



There is very little overlap in the machine types available
on different architectures, so broadly speaking checking the
machine type is usually enough; regardless, it's better to
check the architecture as well.

Signed-off-by: Andrea Bolognani <abologna@xxxxxxxxxx>
---
 src/qemu/qemu_domain.c | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 41996583fc..5feb743ad1 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -9872,8 +9872,11 @@ qemuFindAgentConfig(virDomainDefPtr def)
 
 bool
 qemuDomainMachineIsQ35(const char *machine,
-                       const virArch arch ATTRIBUTE_UNUSED)
+                       const virArch arch)
 {
+    if (!ARCH_IS_X86(arch))
+        return false;
+
     return (STRPREFIX(machine, "pc-q35-") ||
             STREQ(machine, "q35"));
 }
@@ -9881,8 +9884,11 @@ qemuDomainMachineIsQ35(const char *machine,
 
 bool
 qemuDomainMachineIsI440FX(const char *machine,
-                          const virArch arch ATTRIBUTE_UNUSED)
+                          const virArch arch)
 {
+    if (!ARCH_IS_X86(arch))
+        return false;
+
     return (STREQ(machine, "pc") ||
             STRPREFIX(machine, "pc-0.") ||
             STRPREFIX(machine, "pc-1.") ||
@@ -9893,8 +9899,11 @@ qemuDomainMachineIsI440FX(const char *machine,
 
 bool
 qemuDomainMachineIsS390CCW(const char *machine,
-                           const virArch arch ATTRIBUTE_UNUSED)
+                           const virArch arch)
 {
+    if (!ARCH_IS_S390(arch))
+        return false;
+
     return STRPREFIX(machine, "s390-ccw");
 }
 
@@ -9959,10 +9968,13 @@ qemuDomainMachineHasBuiltinIDE(const char *machine,
 
 bool
 qemuDomainMachineNeedsFDC(const char *machine,
-                          const virArch arch ATTRIBUTE_UNUSED)
+                          const virArch arch)
 {
     const char *p = STRSKIP(machine, "pc-q35-");
 
+    if (!ARCH_IS_X86(arch))
+        return false;
+
     if (p) {
         if (STRPREFIX(p, "1.") ||
             STREQ(p, "2.0") ||
-- 
2.20.1

--
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]

  Powered by Linux