{
virCapsGuestPtr guest;
bool haskvm = false;
- bool haskqemu = false;
virCapsGuestMachinePtr *machines = NULL;
size_t nmachines = 0;
int ret = -1;
kvmbin))
haskvm = true;
- if (virFileExists("/dev/kqemu") &&
- virQEMUCapsGet(qemubinCaps, QEMU_CAPS_KQEMU))
- haskqemu = true;
-
if (virQEMUCapsGetMachineTypesCaps(qemubinCaps, &nmachines, &machines) < 0)
goto cleanup;
NULL) == NULL)
goto cleanup;
- if (haskqemu &&
- virCapabilitiesAddGuestDomain(guest,
- VIR_DOMAIN_VIRT_KQEMU,
- NULL,
- NULL,
- 0,
- NULL) == NULL)
- goto cleanup;
-
if (haskvm) {
virCapsGuestDomainPtr dom;
const char *p;
const char *fsdev, *netdev;
- if (strstr(help, "-no-kqemu"))
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_KQEMU);
- if (strstr(help, "-enable-kqemu"))
- virQEMUCapsSet(qemuCaps, QEMU_CAPS_ENABLE_KQEMU);
if (strstr(help, "-no-kvm"))
virQEMUCapsSet(qemuCaps, QEMU_CAPS_KVM);
if (strstr(help, "-enable-kvm"))
# include "qemu_monitor.h"
# include "domain_capabilities.h"
-/* Internal flags to keep track of qemu command line capabilities */
+/*
+ * Internal flags to keep track of qemu command line capabilities
+ *
+ * As a general rule these flags must not be deleted / renamed, as
+ * they are serialized in string format into the runtime XML file
+ * for guests, and new libvirt needs to cope with reading flags
+ * defined by old libvirt.
+ *
+ * The exception to this rule is when we drop support for running
+ * with older QEMU versions entirely. When a flag is no longer needed
+ * we temporarily give it an X_ prefix to indicate it should no
+ * longer be used in code. Periodically we can then purge all the
+ * X_ flags and re-group what's left.
+ */
typedef enum {
/* 0 */
- QEMU_CAPS_KQEMU, /* Whether KQEMU is compiled in */
+ X_QEMU_CAPS_KQEMU, /* Whether KQEMU is compiled in */
QEMU_CAPS_VNC_COLON, /* VNC takes or address + display */
QEMU_CAPS_NO_REBOOT, /* Is the -no-reboot flag available */
QEMU_CAPS_DRIVE, /* Is the new -drive arg available */
QEMU_CAPS_PCI_CONFIGFD, /* pci-assign.configfd */
QEMU_CAPS_NODEFCONFIG, /* -nodefconfig */
QEMU_CAPS_BOOT_MENU, /* -boot menu=on support */
- QEMU_CAPS_ENABLE_KQEMU, /* -enable-kqemu flag */
+ X_QEMU_CAPS_ENABLE_KQEMU, /* -enable-kqemu flag */
/* 40 */
QEMU_CAPS_FSDEV, /* -fstype filesystem passthrough */
const virDomainDef *def,
virQEMUCapsPtr qemuCaps)
{
- bool disableKQEMU = false;
- bool enableKQEMU = false;
bool disableKVM = false;
bool enableKVM = false;
switch (def->virtType) {
case VIR_DOMAIN_VIRT_QEMU:
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KQEMU))
- disableKQEMU = true;
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
disableKVM = true;
break;
case VIR_DOMAIN_VIRT_KQEMU:
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM))
- disableKVM = true;
-
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KQEMU)) {
- enableKQEMU = true;
- } else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KQEMU)) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("the QEMU binary does not support kqemu"));
- return -1;
- }
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("the QEMU binary does not support kqemu"));
break;
case VIR_DOMAIN_VIRT_KVM:
- if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_KQEMU))
- disableKQEMU = true;
-
if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KVM)) {
enableKVM = true;
} else if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
return -1;
}
- if (disableKQEMU)
- virCommandAddArg(cmd, "-no-kqemu");
- else if (enableKQEMU)
- virCommandAddArgList(cmd, "-enable-kqemu", "-kernel-kqemu", NULL);
if (disableKVM)
virCommandAddArg(cmd, "-no-kvm");
if (enableKVM)