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

Re: [libvirt] [PATCH v4 4/6] qemu: add virQEMUCapsSupportsVmport



On Tue, Apr 21, 2015 at 01:57:39PM +0200, Marc-André Lureau wrote:
The vmport machine argument works with pc machine kind, not with xen for
example.
---
src/qemu/qemu_capabilities.c | 13 +++++++++++++
src/qemu/qemu_capabilities.h |  3 +++
src/qemu/qemu_command.c      | 19 -------------------
src/qemu/qemu_domain.c       | 19 +++++++++++++++++++
src/qemu/qemu_domain.h       |  3 +++
5 files changed, 38 insertions(+), 19 deletions(-)


This one's not directly applicable, but trivial enough that it doesn't
cause any problems.  I'd rather move the domain functions in another
patch, though.  That way it's clearly separated.

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ca26855..607b6d5 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -3725,6 +3725,19 @@ virQEMUCapsSupportsChardev(virDomainDefPtr def,


bool
+virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps,
+                          const virDomainDef *def)
+{
+    if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_MACHINE_VMPORT_OPT))
+        return false;
+
+    return qemuDomainMachineIsI440FX(def) ||
+        qemuDomainMachineIsQ35(def) ||
+        STREQ(def->os.machine, "isapc");
+}
+
+
+bool
virQEMUCapsIsMachineSupported(virQEMUCapsPtr qemuCaps,
                              const char *canonical_machine)
{
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 48c8f96..81557b7 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -263,6 +263,9 @@ bool virQEMUCapsGet(virQEMUCapsPtr qemuCaps,
bool virQEMUCapsHasPCIMultiBus(virQEMUCapsPtr qemuCaps,
                               virDomainDefPtr def);

+bool virQEMUCapsSupportsVmport(virQEMUCapsPtr qemuCaps,
+                               const virDomainDef *def);
+
char *virQEMUCapsFlagsString(virQEMUCapsPtr qemuCaps);

const char *virQEMUCapsGetBinary(virQEMUCapsPtr qemuCaps);
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 29b876e..f25a75f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -1954,25 +1954,6 @@ qemuValidateDevicePCISlotsPIIX3(virDomainDefPtr def,
}


-static bool
-qemuDomainMachineIsQ35(virDomainDefPtr def)
-{
-    return (STRPREFIX(def->os.machine, "pc-q35") ||
-            STREQ(def->os.machine, "q35"));
-}
-
-
-static bool
-qemuDomainMachineIsI440FX(virDomainDefPtr def)
-{
-    return (STREQ(def->os.machine, "pc") ||
-            STRPREFIX(def->os.machine, "pc-0.") ||
-            STRPREFIX(def->os.machine, "pc-1.") ||
-            STRPREFIX(def->os.machine, "pc-i440") ||
-            STRPREFIX(def->os.machine, "rhel"));
-}
-
-
static int
qemuDomainValidateDevicePCISlotsQ35(virDomainDefPtr def,
                                    virQEMUCapsPtr qemuCaps,
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 1368386..506c0af 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -3082,3 +3082,22 @@ qemuDomainSupportsBlockJobs(virDomainObjPtr vm,

    return 0;
}
+
+
+bool
+qemuDomainMachineIsQ35(const virDomainDef *def)
+{
+    return (STRPREFIX(def->os.machine, "pc-q35") ||
+            STREQ(def->os.machine, "q35"));
+}
+
+
+bool
+qemuDomainMachineIsI440FX(const virDomainDef *def)
+{
+    return (STREQ(def->os.machine, "pc") ||
+            STRPREFIX(def->os.machine, "pc-0.") ||
+            STRPREFIX(def->os.machine, "pc-1.") ||
+            STRPREFIX(def->os.machine, "pc-i440") ||
+            STRPREFIX(def->os.machine, "rhel"));
+}
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index 6bea7c7..d68e41b 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -431,4 +431,7 @@ void qemuDomObjEndAPI(virDomainObjPtr *vm);
int qemuDomainAlignMemorySizes(virDomainDefPtr def);
void qemuDomainMemoryDeviceAlignSize(virDomainMemoryDefPtr mem);

+bool qemuDomainMachineIsQ35(const virDomainDef *def);
+bool qemuDomainMachineIsI440FX(const virDomainDef *def);
+
#endif /* __QEMU_DOMAIN_H__ */
--
2.1.0

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

Attachment: signature.asc
Description: PGP signature


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