mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-02 01:45:17 +00:00
qemu: support qmp on RHEL/CentOS qemu
I'm getting tired of remembering to backport RHEL-specific patches when building upstream libvirt on RHEL 6.x or CentOS. All the affected versions of RHEL qemu-kvm have backported enough patches to a) make JSON useful, and b) modify the -help text to mention libvirt as the preferred interface; which means this string in the help output is a reliable indicator that we can outsmart a strict version check, even when upstream qemu 0.12 lacked the needed features. * src/qemu/qemu_capabilities.c (qemuCapsComputeCmdFlags): Recognize particular help string present when enough features were backported to be worth using JSON. * tests/qemuhelptest.c (mymain): Update tests accordingly.
This commit is contained in:
parent
823b90339f
commit
ff88cd5905
@ -1104,7 +1104,8 @@ qemuCapsComputeCmdFlags(const char *help,
|
|||||||
if (strstr(help, "-netdev")) {
|
if (strstr(help, "-netdev")) {
|
||||||
/* Disable -netdev on 0.12 since although it exists,
|
/* Disable -netdev on 0.12 since although it exists,
|
||||||
* the corresponding netdev_add/remove monitor commands
|
* the corresponding netdev_add/remove monitor commands
|
||||||
* do not, and we need them to be able todo hotplug */
|
* do not, and we need them to be able to do hotplug.
|
||||||
|
* But see below about RHEL build. */
|
||||||
if (version >= 13000)
|
if (version >= 13000)
|
||||||
qemuCapsSet(flags, QEMU_CAPS_NETDEV);
|
qemuCapsSet(flags, QEMU_CAPS_NETDEV);
|
||||||
}
|
}
|
||||||
@ -1169,12 +1170,20 @@ qemuCapsComputeCmdFlags(const char *help,
|
|||||||
/* While JSON mode was available in 0.12.0, it was too
|
/* While JSON mode was available in 0.12.0, it was too
|
||||||
* incomplete to contemplate using. The 0.13.0 release
|
* incomplete to contemplate using. The 0.13.0 release
|
||||||
* is good enough to use, even though it lacks one or
|
* is good enough to use, even though it lacks one or
|
||||||
* two features. The benefits of JSON mode now outweigh
|
* two features. This is also true of versions of qemu
|
||||||
* the downside.
|
* built for RHEL, labeled 0.12.1, but with extra text
|
||||||
|
* in the help output that mentions that features were
|
||||||
|
* backported for libvirt. The benefits of JSON mode now
|
||||||
|
* outweigh the downside.
|
||||||
*/
|
*/
|
||||||
#if HAVE_YAJL
|
#if HAVE_YAJL
|
||||||
if (version >= 13000)
|
if (version >= 13000) {
|
||||||
qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
|
qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
|
||||||
|
} else if (version >= 12000 &&
|
||||||
|
strstr(help, "libvirt")) {
|
||||||
|
qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
|
||||||
|
qemuCapsSet(flags, QEMU_CAPS_NETDEV);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (version >= 13000)
|
if (version >= 13000)
|
||||||
|
@ -354,9 +354,11 @@ mymain(void)
|
|||||||
QEMU_CAPS_MIGRATE_QEMU_UNIX,
|
QEMU_CAPS_MIGRATE_QEMU_UNIX,
|
||||||
QEMU_CAPS_CHARDEV,
|
QEMU_CAPS_CHARDEV,
|
||||||
QEMU_CAPS_ENABLE_KVM,
|
QEMU_CAPS_ENABLE_KVM,
|
||||||
|
QEMU_CAPS_MONITOR_JSON,
|
||||||
QEMU_CAPS_BALLOON,
|
QEMU_CAPS_BALLOON,
|
||||||
QEMU_CAPS_DEVICE,
|
QEMU_CAPS_DEVICE,
|
||||||
QEMU_CAPS_SMP_TOPOLOGY,
|
QEMU_CAPS_SMP_TOPOLOGY,
|
||||||
|
QEMU_CAPS_NETDEV,
|
||||||
QEMU_CAPS_RTC,
|
QEMU_CAPS_RTC,
|
||||||
QEMU_CAPS_VHOST_NET,
|
QEMU_CAPS_VHOST_NET,
|
||||||
QEMU_CAPS_NO_KVM_PIT,
|
QEMU_CAPS_NO_KVM_PIT,
|
||||||
@ -503,9 +505,11 @@ mymain(void)
|
|||||||
QEMU_CAPS_MIGRATE_QEMU_UNIX,
|
QEMU_CAPS_MIGRATE_QEMU_UNIX,
|
||||||
QEMU_CAPS_CHARDEV,
|
QEMU_CAPS_CHARDEV,
|
||||||
QEMU_CAPS_ENABLE_KVM,
|
QEMU_CAPS_ENABLE_KVM,
|
||||||
|
QEMU_CAPS_MONITOR_JSON,
|
||||||
QEMU_CAPS_BALLOON,
|
QEMU_CAPS_BALLOON,
|
||||||
QEMU_CAPS_DEVICE,
|
QEMU_CAPS_DEVICE,
|
||||||
QEMU_CAPS_SMP_TOPOLOGY,
|
QEMU_CAPS_SMP_TOPOLOGY,
|
||||||
|
QEMU_CAPS_NETDEV,
|
||||||
QEMU_CAPS_RTC,
|
QEMU_CAPS_RTC,
|
||||||
QEMU_CAPS_VHOST_NET,
|
QEMU_CAPS_VHOST_NET,
|
||||||
QEMU_CAPS_NO_KVM_PIT,
|
QEMU_CAPS_NO_KVM_PIT,
|
||||||
@ -559,8 +563,10 @@ mymain(void)
|
|||||||
QEMU_CAPS_CHARDEV,
|
QEMU_CAPS_CHARDEV,
|
||||||
QEMU_CAPS_ENABLE_KVM,
|
QEMU_CAPS_ENABLE_KVM,
|
||||||
QEMU_CAPS_BALLOON,
|
QEMU_CAPS_BALLOON,
|
||||||
|
QEMU_CAPS_MONITOR_JSON,
|
||||||
QEMU_CAPS_DEVICE,
|
QEMU_CAPS_DEVICE,
|
||||||
QEMU_CAPS_SMP_TOPOLOGY,
|
QEMU_CAPS_SMP_TOPOLOGY,
|
||||||
|
QEMU_CAPS_NETDEV,
|
||||||
QEMU_CAPS_RTC,
|
QEMU_CAPS_RTC,
|
||||||
QEMU_CAPS_VHOST_NET,
|
QEMU_CAPS_VHOST_NET,
|
||||||
QEMU_CAPS_NO_KVM_PIT,
|
QEMU_CAPS_NO_KVM_PIT,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user