This is done for two reasons:
- we are getting very close to 64 flags which is the maximum we can use
with unsigned long long
- by using LL constants in enum we already violates C99 constraint that
enum values have to fit into int
---
Notes:
Version 2:
- rebased to current master
- qemuCapsFree added to a list of free-like functions in cfg.mk
- don't fail qemuCapsParseHelpStr() if there is no memory for bitmap
string used for a debug message
cfg.mk | 3 +-
src/qemu/qemu_capabilities.c | 188 ++++++++++++++++++++++++------------------
src/qemu/qemu_capabilities.h | 145 +++++++++++++++++---------------
src/qemu/qemu_command.c | 55 ++++++------
src/qemu/qemu_command.h | 30 ++++----
src/qemu/qemu_driver.c | 12 ++-
src/qemu/qemu_hotplug.c | 34 ++++----
src/qemu/qemu_hotplug.h | 32 ++++----
src/qemu/qemu_migration.c | 6 +-
src/qemu/qemu_process.c | 11 ++-
10 files changed, 280 insertions(+), 236 deletions(-)
diff --git a/cfg.mk b/cfg.mk
index 1bb9cbb..3d13d70 100644
--- a/cfg.mk
+++ b/cfg.mk
@@ -135,7 +135,8 @@ useless_free_options = \
--name=virThreadPoolFree \
--name=xmlFree \
--name=xmlXPathFreeContext \
- --name=xmlXPathFreeObject
+ --name=xmlXPathFreeObject \
+ --name=qemuCapsFree
# The following template was generated by this command:
# make ID && aid free|grep '^vi'|sed 's/ .*//;s/^/# /'
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index fbf426a..873360a 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -377,7 +377,7 @@ error:
int
qemuCapsProbeCPUModels(const char *qemu,
- unsigned long long qemuCaps,
+ virBitmapPtr qemuCaps,
const char *arch,
unsigned int *count,
const char ***cpus)
@@ -442,7 +442,7 @@ qemuCapsInitGuest(virCapsPtr caps,
int nmachines = 0;
struct stat st;
unsigned int ncpus;
- unsigned long long qemuCaps;
+ virBitmapPtr qemuCaps = NULL;
int ret = -1;
/* Check for existance of base emulator, or alternate base
@@ -553,7 +553,7 @@ qemuCapsInitGuest(virCapsPtr caps,
guest->arch.defaultInfo.emulator_mtime = binary_mtime;
if (caps->host.cpu &&
- qemuCapsProbeCPUModels(binary, 0, info->arch, &ncpus, NULL) == 0
&&
+ qemuCapsProbeCPUModels(binary, NULL, info->arch, &ncpus, NULL) == 0
&&
ncpus > 0 &&
!virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
goto error;
@@ -648,6 +648,7 @@ cleanup:
VIR_FREE(binary);
VIR_FREE(kvmbin);
}
+ qemuCapsFree(qemuCaps);
return ret;
@@ -781,129 +782,129 @@ virCapsPtr qemuCapsInit(virCapsPtr old_caps)
}
-static unsigned long long
+static void
qemuCapsComputeCmdFlags(const char *help,
unsigned int version,
unsigned int is_kvm,
- unsigned int kvm_version)
+ unsigned int kvm_version,
+ virBitmapPtr flags)
{
- unsigned long long flags = 0;
const char *p;
if (strstr(help, "-no-kqemu"))
- qemuCapsSet(&flags, QEMU_CAPS_KQEMU);
+ qemuCapsSet(flags, QEMU_CAPS_KQEMU);
if (strstr(help, "-enable-kqemu"))
- qemuCapsSet(&flags, QEMU_CAPS_ENABLE_KQEMU);
+ qemuCapsSet(flags, QEMU_CAPS_ENABLE_KQEMU);
if (strstr(help, "-no-kvm"))
- qemuCapsSet(&flags, QEMU_CAPS_KVM);
+ qemuCapsSet(flags, QEMU_CAPS_KVM);
if (strstr(help, "-enable-kvm"))
- qemuCapsSet(&flags, QEMU_CAPS_ENABLE_KVM);
+ qemuCapsSet(flags, QEMU_CAPS_ENABLE_KVM);
if (strstr(help, "-no-reboot"))
- qemuCapsSet(&flags, QEMU_CAPS_NO_REBOOT);
+ qemuCapsSet(flags, QEMU_CAPS_NO_REBOOT);
if (strstr(help, "-name")) {
- qemuCapsSet(&flags, QEMU_CAPS_NAME);
+ qemuCapsSet(flags, QEMU_CAPS_NAME);
if (strstr(help, ",process="))
- qemuCapsSet(&flags, QEMU_CAPS_NAME_PROCESS);
+ qemuCapsSet(flags, QEMU_CAPS_NAME_PROCESS);
}
if (strstr(help, "-uuid"))
- qemuCapsSet(&flags, QEMU_CAPS_UUID);
+ qemuCapsSet(flags, QEMU_CAPS_UUID);
if (strstr(help, "-xen-domid"))
- qemuCapsSet(&flags, QEMU_CAPS_XEN_DOMID);
+ qemuCapsSet(flags, QEMU_CAPS_XEN_DOMID);
else if (strstr(help, "-domid"))
- qemuCapsSet(&flags, QEMU_CAPS_DOMID);
+ qemuCapsSet(flags, QEMU_CAPS_DOMID);
if (strstr(help, "-drive")) {
- qemuCapsSet(&flags, QEMU_CAPS_DRIVE);
+ qemuCapsSet(flags, QEMU_CAPS_DRIVE);
if (strstr(help, "cache=") &&
!strstr(help, "cache=on|off"))
- qemuCapsSet(&flags, QEMU_CAPS_DRIVE_CACHE_V2);
+ qemuCapsSet(flags, QEMU_CAPS_DRIVE_CACHE_V2);
if (strstr(help, "format="))
- qemuCapsSet(&flags, QEMU_CAPS_DRIVE_FORMAT);
+ qemuCapsSet(flags, QEMU_CAPS_DRIVE_FORMAT);
if (strstr(help, "readonly="))
- qemuCapsSet(&flags, QEMU_CAPS_DRIVE_READONLY);
+ qemuCapsSet(flags, QEMU_CAPS_DRIVE_READONLY);
if (strstr(help, "aio=threads|native"))
- qemuCapsSet(&flags, QEMU_CAPS_DRIVE_AIO);
+ qemuCapsSet(flags, QEMU_CAPS_DRIVE_AIO);
}
if ((p = strstr(help, "-vga")) && !strstr(help,
"-std-vga")) {
const char *nl = strstr(p, "\n");
- qemuCapsSet(&flags, QEMU_CAPS_VGA);
+ qemuCapsSet(flags, QEMU_CAPS_VGA);
if (strstr(p, "|qxl"))
- qemuCapsSet(&flags, QEMU_CAPS_VGA_QXL);
+ qemuCapsSet(flags, QEMU_CAPS_VGA_QXL);
if ((p = strstr(p, "|none")) && p < nl)
- qemuCapsSet(&flags, QEMU_CAPS_VGA_NONE);
+ qemuCapsSet(flags, QEMU_CAPS_VGA_NONE);
}
if (strstr(help, "-spice"))
- qemuCapsSet(&flags, QEMU_CAPS_SPICE);
+ qemuCapsSet(flags, QEMU_CAPS_SPICE);
if (strstr(help, "boot=on"))
- qemuCapsSet(&flags, QEMU_CAPS_DRIVE_BOOT);
+ qemuCapsSet(flags, QEMU_CAPS_DRIVE_BOOT);
if (strstr(help, "serial=s"))
- qemuCapsSet(&flags, QEMU_CAPS_DRIVE_SERIAL);
+ qemuCapsSet(flags, QEMU_CAPS_DRIVE_SERIAL);
if (strstr(help, "-pcidevice"))
- qemuCapsSet(&flags, QEMU_CAPS_PCIDEVICE);
+ qemuCapsSet(flags, QEMU_CAPS_PCIDEVICE);
if (strstr(help, "-mem-path"))
- qemuCapsSet(&flags, QEMU_CAPS_MEM_PATH);
+ qemuCapsSet(flags, QEMU_CAPS_MEM_PATH);
if (strstr(help, "-chardev")) {
- qemuCapsSet(&flags, QEMU_CAPS_CHARDEV);
+ qemuCapsSet(flags, QEMU_CAPS_CHARDEV);
if (strstr(help, "-chardev spicevmc"))
- qemuCapsSet(&flags, QEMU_CAPS_CHARDEV_SPICEVMC);
+ qemuCapsSet(flags, QEMU_CAPS_CHARDEV_SPICEVMC);
}
if (strstr(help, "-balloon"))
- qemuCapsSet(&flags, QEMU_CAPS_BALLOON);
+ qemuCapsSet(flags, QEMU_CAPS_BALLOON);
if (strstr(help, "-device")) {
- qemuCapsSet(&flags, QEMU_CAPS_DEVICE);
+ qemuCapsSet(flags, QEMU_CAPS_DEVICE);
/*
* When -device was introduced, qemu already supported drive's
* readonly option but didn't advertise that.
*/
- qemuCapsSet(&flags, QEMU_CAPS_DRIVE_READONLY);
+ qemuCapsSet(flags, QEMU_CAPS_DRIVE_READONLY);
}
if (strstr(help, "-nodefconfig"))
- qemuCapsSet(&flags, QEMU_CAPS_NODEFCONFIG);
+ qemuCapsSet(flags, QEMU_CAPS_NODEFCONFIG);
/* The trailing ' ' is important to avoid a bogus match */
if (strstr(help, "-rtc "))
- qemuCapsSet(&flags, QEMU_CAPS_RTC);
+ qemuCapsSet(flags, QEMU_CAPS_RTC);
/* to wit */
if (strstr(help, "-rtc-td-hack"))
- qemuCapsSet(&flags, QEMU_CAPS_RTC_TD_HACK);
+ qemuCapsSet(flags, QEMU_CAPS_RTC_TD_HACK);
if (strstr(help, "-no-hpet"))
- qemuCapsSet(&flags, QEMU_CAPS_NO_HPET);
+ qemuCapsSet(flags, QEMU_CAPS_NO_HPET);
if (strstr(help, "-no-kvm-pit-reinjection"))
- qemuCapsSet(&flags, QEMU_CAPS_NO_KVM_PIT);
+ qemuCapsSet(flags, QEMU_CAPS_NO_KVM_PIT);
if (strstr(help, "-tdf"))
- qemuCapsSet(&flags, QEMU_CAPS_TDF);
+ qemuCapsSet(flags, QEMU_CAPS_TDF);
if (strstr(help, "-enable-nesting"))
- qemuCapsSet(&flags, QEMU_CAPS_NESTING);
+ qemuCapsSet(flags, QEMU_CAPS_NESTING);
if (strstr(help, ",menu=on"))
- qemuCapsSet(&flags, QEMU_CAPS_BOOT_MENU);
+ qemuCapsSet(flags, QEMU_CAPS_BOOT_MENU);
if (strstr(help, "-fsdev"))
- qemuCapsSet(&flags, QEMU_CAPS_FSDEV);
+ qemuCapsSet(flags, QEMU_CAPS_FSDEV);
if (strstr(help, "-smbios type"))
- qemuCapsSet(&flags, QEMU_CAPS_SMBIOS_TYPE);
+ qemuCapsSet(flags, QEMU_CAPS_SMBIOS_TYPE);
if (strstr(help, "-netdev")) {
/* Disable -netdev on 0.12 since although it exists,
* the corresponding netdev_add/remove monitor commands
* do not, and we need them to be able todo hotplug */
if (version >= 13000)
- qemuCapsSet(&flags, QEMU_CAPS_NETDEV);
+ qemuCapsSet(flags, QEMU_CAPS_NETDEV);
}
if (strstr(help, "-sdl"))
- qemuCapsSet(&flags, QEMU_CAPS_SDL);
+ qemuCapsSet(flags, QEMU_CAPS_SDL);
if (strstr(help, "cores=") &&
strstr(help, "threads=") &&
strstr(help, "sockets="))
- qemuCapsSet(&flags, QEMU_CAPS_SMP_TOPOLOGY);
+ qemuCapsSet(flags, QEMU_CAPS_SMP_TOPOLOGY);
if (version >= 9000)
- qemuCapsSet(&flags, QEMU_CAPS_VNC_COLON);
+ qemuCapsSet(flags, QEMU_CAPS_VNC_COLON);
if (is_kvm && (version >= 10000 || kvm_version >= 74))
- qemuCapsSet(&flags, QEMU_CAPS_VNET_HDR);
+ qemuCapsSet(flags, QEMU_CAPS_VNET_HDR);
if (is_kvm && strstr(help, ",vhost=")) {
- qemuCapsSet(&flags, QEMU_CAPS_VNET_HOST);
+ qemuCapsSet(flags, QEMU_CAPS_VNET_HOST);
}
/*
@@ -919,22 +920,22 @@ qemuCapsComputeCmdFlags(const char *help,
* while waiting for data, so pretend it doesn't exist
*/
if (version >= 10000) {
- qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_TCP);
- qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_EXEC);
+ qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_TCP);
+ qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_EXEC);
if (version >= 12000) {
- qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_UNIX);
- qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_FD);
+ qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_UNIX);
+ qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_FD);
}
} else if (kvm_version >= 79) {
- qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_TCP);
+ qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_TCP);
if (kvm_version >= 80)
- qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_EXEC);
+ qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_EXEC);
} else if (kvm_version > 0) {
- qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_KVM_STDIO);
+ qemuCapsSet(flags, QEMU_CAPS_MIGRATE_KVM_STDIO);
}
if (version >= 10000)
- qemuCapsSet(&flags, QEMU_CAPS_0_10);
+ qemuCapsSet(flags, QEMU_CAPS_0_10);
/* While JSON mode was available in 0.12.0, it was too
* incomplete to contemplate using. The 0.13.0 release
@@ -943,9 +944,7 @@ qemuCapsComputeCmdFlags(const char *help,
* the downside.
*/
if (version >= 13000)
- qemuCapsSet(&flags, QEMU_CAPS_MONITOR_JSON);
-
- return flags;
+ qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
}
/* We parse the output of 'qemu -help' to get the QEMU
@@ -974,15 +973,16 @@ qemuCapsComputeCmdFlags(const char *help,
int qemuCapsParseHelpStr(const char *qemu,
const char *help,
- unsigned long long *flags,
+ virBitmapPtr flags,
unsigned int *version,
unsigned int *is_kvm,
unsigned int *kvm_version)
{
unsigned major, minor, micro;
const char *p = help;
+ char *strflags;
- *flags = *version = *is_kvm = *kvm_version = 0;
+ *version = *is_kvm = *kvm_version = 0;
if (STRPREFIX(p, QEMU_VERSION_STR_1))
p += strlen(QEMU_VERSION_STR_1);
@@ -1029,10 +1029,13 @@ int qemuCapsParseHelpStr(const char *qemu,
*version = (major * 1000 * 1000) + (minor * 1000) + micro;
- *flags = qemuCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version);
+ qemuCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version, flags);
+
+ strflags = virBitmapString(flags);
+ VIR_DEBUG("Version %u.%u.%u, cooked version %u, flags %s",
+ major, minor, micro, *version, NULLSTR(strflags));
+ VIR_FREE(strflags);
- VIR_DEBUG("Version %u.%u.%u, cooked version %u, flags 0x%llx",
- major, minor, micro, *version, *flags);
if (*kvm_version)
VIR_DEBUG("KVM version %d detected", *kvm_version);
else if (*is_kvm)
@@ -1056,7 +1059,7 @@ fail:
static int
qemuCapsExtractDeviceStr(const char *qemu,
- unsigned long long *flags)
+ virBitmapPtr flags)
{
char *output = NULL;
virCommandPtr cmd;
@@ -1094,7 +1097,7 @@ cleanup:
int
-qemuCapsParseDeviceStr(const char *str, unsigned long long *flags)
+qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
{
/* Which devices exist. */
if (strstr(str, "name \"hda-duplex\""))
@@ -1104,7 +1107,7 @@ qemuCapsParseDeviceStr(const char *str, unsigned long long *flags)
if (strstr(str, "name \"ccid-card-passthru\""))
qemuCapsSet(flags, QEMU_CAPS_CCID_PASSTHRU);
/* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
- if (!qemuCapsGet(*flags, QEMU_CAPS_CHARDEV_SPICEVMC) &&
+ if (!qemuCapsGet(flags, QEMU_CAPS_CHARDEV_SPICEVMC) &&
strstr(str, "name \"spicevmc\""))
qemuCapsSet(flags, QEMU_CAPS_DEVICE_SPICEVMC);
@@ -1124,16 +1127,16 @@ qemuCapsParseDeviceStr(const char *str, unsigned long long
*flags)
int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
unsigned int *retversion,
- unsigned long long *retflags)
+ virBitmapPtr *retflags)
{
int ret = -1;
unsigned int version, is_kvm, kvm_version;
- unsigned long long flags = 0;
+ virBitmapPtr flags = NULL;
char *help = NULL;
virCommandPtr cmd;
if (retflags)
- *retflags = 0;
+ *retflags = NULL;
if (retversion)
*retversion = 0;
@@ -1154,33 +1157,37 @@ int qemuCapsExtractVersionInfo(const char *qemu, const char
*arch,
if (virCommandRun(cmd, NULL) < 0)
goto cleanup;
- if (qemuCapsParseHelpStr(qemu, help, &flags,
+ if (!(flags = qemuCapsNew()) ||
+ qemuCapsParseHelpStr(qemu, help, flags,
&version, &is_kvm, &kvm_version) == -1)
goto cleanup;
/* Currently only x86_64 and i686 support PCI-multibus. */
if (STREQLEN(arch, "x86_64", 6) ||
STREQLEN(arch, "i686", 4)) {
- qemuCapsSet(&flags, QEMU_CAPS_PCI_MULTIBUS);
+ qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIBUS);
}
/* qemuCapsExtractDeviceStr will only set additional flags if qemu
* understands the 0.13.0+ notion of "-device driver,". */
if (qemuCapsGet(flags, QEMU_CAPS_DEVICE) &&
strstr(help, "-device driver,?") &&
- qemuCapsExtractDeviceStr(qemu, &flags) < 0)
+ qemuCapsExtractDeviceStr(qemu, flags) < 0)
goto cleanup;
if (retversion)
*retversion = version;
- if (retflags)
+ if (retflags) {
*retflags = flags;
+ flags = NULL;
+ }
ret = 0;
cleanup:
VIR_FREE(help);
virCommandFree(cmd);
+ qemuCapsFree(flags);
return ret;
}
@@ -1233,25 +1240,42 @@ int qemuCapsExtractVersion(virCapsPtr caps,
}
+virBitmapPtr
+qemuCapsNew(void)
+{
+ virBitmapPtr caps;
+
+ if (!(caps = virBitmapAlloc(QEMU_CAPS_LAST)))
+ virReportOOMError();
+
+ return caps;
+}
+
+
void
-qemuCapsSet(unsigned long long *caps,
+qemuCapsSet(virBitmapPtr caps,
enum qemuCapsFlags flag)
{
- *caps |= flag;
+ ignore_value(virBitmapSetBit(caps, flag));
}
void
-qemuCapsClear(unsigned long long *caps,
+qemuCapsClear(virBitmapPtr caps,
enum qemuCapsFlags flag)
{
- *caps &= ~flag;
+ ignore_value(virBitmapClearBit(caps, flag));
}
bool
-qemuCapsGet(unsigned long long caps,
+qemuCapsGet(virBitmapPtr caps,
enum qemuCapsFlags flag)
{
- return !!(caps & flag);
+ bool b;
+
+ if (!caps || virBitmapGetBit(caps, flag, &b) < 0)
+ return false;
+ else
+ return b;
}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index d9eb782..b506e56 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -24,84 +24,91 @@
#ifndef __QEMU_CAPABILITIES_H__
# define __QEMU_CAPABILITIES_H__
+# include "bitmap.h"
# include "capabilities.h"
/* Internal flags to keep track of qemu command line capabilities */
enum qemuCapsFlags {
- QEMU_CAPS_KQEMU = (1 << 0), /* Whether KQEMU is compiled in */
- QEMU_CAPS_VNC_COLON = (1 << 1), /* Does the VNC take just port, or address
+ display */
- QEMU_CAPS_NO_REBOOT = (1 << 2), /* Is the -no-reboot flag available */
- QEMU_CAPS_DRIVE = (1 << 3), /* Is the new -drive arg available */
- QEMU_CAPS_DRIVE_BOOT = (1 << 4), /* Does -drive support boot=on */
- QEMU_CAPS_NAME = (1 << 5), /* Is the -name flag available */
- QEMU_CAPS_UUID = (1 << 6), /* Is the -uuid flag available */
- QEMU_CAPS_DOMID = (1 << 7), /* Xenner only, special -domid flag
available */
- QEMU_CAPS_VNET_HDR = (1 << 8),
- QEMU_CAPS_MIGRATE_KVM_STDIO = (1 << 9), /* Original migration code from KVM.
Also had tcp, but we can't use that
- * since it had a design bug blocking
the entire monitor console */
- QEMU_CAPS_MIGRATE_QEMU_TCP = (1 << 10), /* New migration syntax after merge to
QEMU with TCP transport */
- QEMU_CAPS_MIGRATE_QEMU_EXEC = (1 << 11), /* New migration syntax after merge to
QEMU with EXEC transport */
- QEMU_CAPS_DRIVE_CACHE_V2 = (1 << 12), /* Is the cache= flag wanting new v2
values */
- QEMU_CAPS_KVM = (1 << 13), /* Whether KVM is compiled in */
- QEMU_CAPS_DRIVE_FORMAT = (1 << 14), /* Is -drive format= avail */
- QEMU_CAPS_VGA = (1 << 15), /* Is -vga avail */
+ QEMU_CAPS_KQEMU, /* Whether KQEMU is compiled in */
+ QEMU_CAPS_VNC_COLON, /* Does the VNC take just port, or address + display
*/
+ QEMU_CAPS_NO_REBOOT, /* Is the -no-reboot flag available */
+ QEMU_CAPS_DRIVE, /* Is the new -drive arg available */
+ QEMU_CAPS_DRIVE_BOOT, /* Does -drive support boot=on */
+ QEMU_CAPS_NAME, /* Is the -name flag available */
+ QEMU_CAPS_UUID, /* Is the -uuid flag available */
+ QEMU_CAPS_DOMID, /* Xenner only, special -domid flag available */
+ QEMU_CAPS_VNET_HDR,
+ QEMU_CAPS_MIGRATE_KVM_STDIO, /* Original migration code from KVM. Also had tcp,
but we can't use that
+ * since it had a design bug blocking the entire
monitor console */
+ QEMU_CAPS_MIGRATE_QEMU_TCP, /* New migration syntax after merge to QEMU with TCP
transport */
+ QEMU_CAPS_MIGRATE_QEMU_EXEC, /* New migration syntax after merge to QEMU with EXEC
transport */
+ QEMU_CAPS_DRIVE_CACHE_V2, /* Is the cache= flag wanting new v2 values */
+ QEMU_CAPS_KVM, /* Whether KVM is compiled in */
+ QEMU_CAPS_DRIVE_FORMAT, /* Is -drive format= avail */
+ QEMU_CAPS_VGA, /* Is -vga avail */
/* features added in qemu-0.10.0 or later */
- QEMU_CAPS_0_10 = (1 << 16),
+ QEMU_CAPS_0_10,
QEMU_CAPS_NET_NAME = QEMU_CAPS_0_10, /* -net ...,name=str */
QEMU_CAPS_HOST_NET_ADD = QEMU_CAPS_0_10, /* host_net_add monitor command */
- QEMU_CAPS_PCIDEVICE = (1 << 17), /* PCI device assignment only supported by
qemu-kvm */
- QEMU_CAPS_MEM_PATH = (1 << 18), /* mmap'ped guest backing supported
*/
- QEMU_CAPS_DRIVE_SERIAL = (1 << 19), /* -driver serial= available */
- QEMU_CAPS_XEN_DOMID = (1 << 20), /* -xen-domid (new style xen integration)
*/
- QEMU_CAPS_MIGRATE_QEMU_UNIX = (1 << 21), /* Does qemu support unix domain
sockets for migration? */
- QEMU_CAPS_CHARDEV = (1 << 22), /* Is the new -chardev arg available */
- QEMU_CAPS_ENABLE_KVM = (1 << 23), /* Is the -enable-kvm flag available to
"enable KVM full virtualization support" */
- QEMU_CAPS_MONITOR_JSON = (1 << 24), /* JSON mode for monitor */
- QEMU_CAPS_BALLOON = (1 << 25), /* -balloon available */
- QEMU_CAPS_DEVICE = (1 << 26), /* Is the new -device arg available */
- QEMU_CAPS_SDL = (1 << 27), /* Is the new -sdl arg available */
- QEMU_CAPS_SMP_TOPOLOGY = (1 << 28), /* Is sockets=s,cores=c,threads=t
available for -smp? */
- QEMU_CAPS_NETDEV = (1 << 29), /* The -netdev flag &
netdev_add/remove monitor commands */
- QEMU_CAPS_RTC = (1 << 30), /* The -rtc flag for clock options */
- QEMU_CAPS_VNET_HOST = (1LL << 31), /* vnet-host support is available in
qemu */
- QEMU_CAPS_RTC_TD_HACK = (1LL << 32), /* -rtc-td-hack available */
- QEMU_CAPS_NO_HPET = (1LL << 33), /* -no-hpet flag is supported */
- QEMU_CAPS_NO_KVM_PIT = (1LL << 34), /* -no-kvm-pit-reinjection supported */
- QEMU_CAPS_TDF = (1LL << 35), /* -tdf flag (user-mode pit catchup) */
- QEMU_CAPS_PCI_CONFIGFD = (1LL << 36), /* pci-assign.configfd */
- QEMU_CAPS_NODEFCONFIG = (1LL << 37), /* -nodefconfig */
- QEMU_CAPS_BOOT_MENU = (1LL << 38), /* -boot menu=on support */
- QEMU_CAPS_ENABLE_KQEMU = (1LL << 39), /* -enable-kqemu flag */
- QEMU_CAPS_FSDEV = (1LL << 40), /* -fstype filesystem passthrough */
- QEMU_CAPS_NESTING = (1LL << 41), /* -enable-nesting (SVM/VMX) */
- QEMU_CAPS_NAME_PROCESS = (1LL << 42), /* Is -name process= available */
- QEMU_CAPS_DRIVE_READONLY= (1LL << 43), /* -drive readonly=on|off */
- QEMU_CAPS_SMBIOS_TYPE = (1LL << 44), /* Is -smbios type= available */
- QEMU_CAPS_VGA_QXL = (1LL << 45), /* The 'qxl' arg for
'-vga' */
- QEMU_CAPS_SPICE = (1LL << 46), /* Is -spice avail */
- QEMU_CAPS_VGA_NONE = (1LL << 47), /* The 'none' arg for
'-vga' */
- QEMU_CAPS_MIGRATE_QEMU_FD = (1LL << 48), /* -incoming fd:n */
- QEMU_CAPS_BOOTINDEX = (1LL << 49), /* -device bootindex property */
- QEMU_CAPS_HDA_DUPLEX = (1LL << 50), /* -device hda-duplex */
- QEMU_CAPS_DRIVE_AIO = (1LL << 51), /* -drive aio= supported */
- QEMU_CAPS_PCI_MULTIBUS = (1LL << 52), /* bus=pci.0 vs bus=pci */
- QEMU_CAPS_PCI_BOOTINDEX = (1LL << 53), /* pci-assign.bootindex */
- QEMU_CAPS_CCID_EMULATED = (1LL << 54), /* -device ccid-card-emulated */
- QEMU_CAPS_CCID_PASSTHRU = (1LL << 55), /* -device ccid-card-passthru */
- QEMU_CAPS_CHARDEV_SPICEVMC = (1LL << 56), /* newer -chardev spicevmc */
- QEMU_CAPS_DEVICE_SPICEVMC = (1LL << 57), /* older -device spicevmc*/
- QEMU_CAPS_VIRTIO_TX_ALG = (1LL << 58), /* -device virtio-net-pci,tx=string */
+ QEMU_CAPS_PCIDEVICE, /* PCI device assignment only supported by qemu-kvm
*/
+ QEMU_CAPS_MEM_PATH, /* mmap'ped guest backing supported */
+ QEMU_CAPS_DRIVE_SERIAL, /* -driver serial= available */
+ QEMU_CAPS_XEN_DOMID, /* -xen-domid (new style xen integration) */
+ QEMU_CAPS_MIGRATE_QEMU_UNIX, /* Does qemu support unix domain sockets for
migration? */
+ QEMU_CAPS_CHARDEV, /* Is the new -chardev arg available */
+ QEMU_CAPS_ENABLE_KVM, /* Is the -enable-kvm flag available to "enable
KVM full virtualization support" */
+ QEMU_CAPS_MONITOR_JSON, /* JSON mode for monitor */
+ QEMU_CAPS_BALLOON, /* -balloon available */
+ QEMU_CAPS_DEVICE, /* Is the new -device arg available */
+ QEMU_CAPS_SDL, /* Is the new -sdl arg available */
+ QEMU_CAPS_SMP_TOPOLOGY, /* Is sockets=s,cores=c,threads=t available for -smp?
*/
+ QEMU_CAPS_NETDEV, /* The -netdev flag & netdev_add/remove monitor
commands */
+ QEMU_CAPS_RTC, /* The -rtc flag for clock options */
+ QEMU_CAPS_VNET_HOST, /* vnet-host support is available in qemu */
+ QEMU_CAPS_RTC_TD_HACK, /* -rtc-td-hack available */
+ QEMU_CAPS_NO_HPET, /* -no-hpet flag is supported */
+ QEMU_CAPS_NO_KVM_PIT, /* -no-kvm-pit-reinjection supported */
+ QEMU_CAPS_TDF, /* -tdf flag (user-mode pit catchup) */
+ 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 */
+ QEMU_CAPS_FSDEV, /* -fstype filesystem passthrough */
+ QEMU_CAPS_NESTING, /* -enable-nesting (SVM/VMX) */
+ QEMU_CAPS_NAME_PROCESS, /* Is -name process= available */
+ QEMU_CAPS_DRIVE_READONLY, /* -drive readonly=on|off */
+ QEMU_CAPS_SMBIOS_TYPE, /* Is -smbios type= available */
+ QEMU_CAPS_VGA_QXL, /* The 'qxl' arg for '-vga' */
+ QEMU_CAPS_SPICE, /* Is -spice avail */
+ QEMU_CAPS_VGA_NONE, /* The 'none' arg for '-vga' */
+ QEMU_CAPS_MIGRATE_QEMU_FD, /* -incoming fd:n */
+ QEMU_CAPS_BOOTINDEX, /* -device bootindex property */
+ QEMU_CAPS_HDA_DUPLEX, /* -device hda-duplex */
+ QEMU_CAPS_DRIVE_AIO, /* -drive aio= supported */
+ QEMU_CAPS_PCI_MULTIBUS, /* bus=pci.0 vs bus=pci */
+ QEMU_CAPS_PCI_BOOTINDEX, /* pci-assign.bootindex */
+ QEMU_CAPS_CCID_EMULATED, /* -device ccid-card-emulated */
+ QEMU_CAPS_CCID_PASSTHRU, /* -device ccid-card-passthru */
+ QEMU_CAPS_CHARDEV_SPICEVMC, /* newer -chardev spicevmc */
+ QEMU_CAPS_DEVICE_SPICEVMC, /* older -device spicevmc*/
+ QEMU_CAPS_VIRTIO_TX_ALG, /* -device virtio-net-pci,tx=string */
+
+ QEMU_CAPS_LAST, /* this must always be the last item */
};
-void qemuCapsSet(unsigned long long *caps,
- enum qemuCapsFlags flag);
+virBitmapPtr qemuCapsNew(void);
+
+# define qemuCapsFree(caps) virBitmapFree(caps)
+
+void qemuCapsSet(virBitmapPtr caps,
+ enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1);
-void qemuCapsClear(unsigned long long *caps,
- enum qemuCapsFlags flag);
+void qemuCapsClear(virBitmapPtr caps,
+ enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1);
-bool qemuCapsGet(unsigned long long caps,
+bool qemuCapsGet(virBitmapPtr caps,
enum qemuCapsFlags flag);
virCapsPtr qemuCapsInit(virCapsPtr old_caps);
@@ -111,7 +118,7 @@ int qemuCapsProbeMachineTypes(const char *binary,
int *nmachines);
int qemuCapsProbeCPUModels(const char *qemu,
- unsigned long long qemuCaps,
+ virBitmapPtr qemuCaps,
const char *arch,
unsigned int *count,
const char ***cpus);
@@ -120,16 +127,16 @@ int qemuCapsExtractVersion(virCapsPtr caps,
unsigned int *version);
int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
unsigned int *version,
- unsigned long long *qemuCaps);
+ virBitmapPtr *qemuCaps);
int qemuCapsParseHelpStr(const char *qemu,
const char *str,
- unsigned long long *qemuCaps,
+ virBitmapPtr qemuCaps,
unsigned int *version,
unsigned int *is_kvm,
unsigned int *kvm_version);
int qemuCapsParseDeviceStr(const char *str,
- unsigned long long *qemuCaps);
+ virBitmapPtr qemuCaps);
#endif /* __QEMU_CAPABILITIES_H__*/
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 99e044a..ddd218f 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -109,7 +109,7 @@ int
qemuPhysIfaceConnect(virConnectPtr conn,
struct qemud_driver *driver,
virDomainNetDefPtr net,
- unsigned long long qemuCaps,
+ virBitmapPtr qemuCaps,
const unsigned char *vmuuid,
enum virVMOperationType vmop)
{
@@ -170,7 +170,7 @@ int
qemuNetworkIfaceConnect(virConnectPtr conn,
struct qemud_driver *driver,
virDomainNetDefPtr net,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
char *brname = NULL;
int err;
@@ -305,7 +305,7 @@ cleanup:
static int
qemuOpenVhostNet(virDomainNetDefPtr net,
- unsigned long long qemuCaps,
+ virBitmapPtr qemuCaps,
int *vhostfd)
{
@@ -403,7 +403,7 @@ static int qemuAssignDeviceDiskAliasLegacy(virDomainDiskDefPtr disk)
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
char *ret;
@@ -501,7 +501,7 @@ no_memory:
int
-qemuAssignDeviceDiskAlias(virDomainDiskDefPtr def, unsigned long long qemuCaps)
+qemuAssignDeviceDiskAlias(virDomainDiskDefPtr def, virBitmapPtr qemuCaps)
{
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE)) {
if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
@@ -584,7 +584,7 @@ qemuAssignDeviceControllerAlias(virDomainControllerDefPtr controller)
static int
-qemuAssignDeviceAliases(virDomainDefPtr def, unsigned long long qemuCaps)
+qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps)
{
int i;
@@ -720,7 +720,7 @@ int
qemuDomainAssignPCIAddresses(virDomainDefPtr def)
{
int ret = -1;
- unsigned long long qemuCaps = 0;
+ virBitmapPtr qemuCaps = NULL;
qemuDomainPCIAddressSetPtr addrs = NULL;
if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
@@ -739,6 +739,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def)
ret = 0;
cleanup:
+ qemuCapsFree(qemuCaps);
qemuDomainPCIAddressSetFree(addrs);
return ret;
@@ -1126,7 +1127,7 @@ error:
static int
qemuBuildDeviceAddressStr(virBufferPtr buf,
virDomainDeviceInfoPtr info,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
if (info->addr.pci.domain != 0) {
@@ -1180,7 +1181,7 @@ qemuSafeSerialParamValue(const char *value)
char *
qemuBuildDriveStr(virDomainDiskDefPtr disk,
int bootable,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer opt = VIR_BUFFER_INITIALIZER;
const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
@@ -1396,7 +1397,7 @@ error:
char *
qemuBuildDriveDevStr(virDomainDiskDefPtr disk,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer opt = VIR_BUFFER_INITIALIZER;
const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
@@ -1453,7 +1454,7 @@ error:
char *qemuBuildFSStr(virDomainFSDefPtr fs,
- unsigned long long qemuCaps ATTRIBUTE_UNUSED)
+ virBitmapPtr qemuCaps ATTRIBUTE_UNUSED)
{
virBuffer opt = VIR_BUFFER_INITIALIZER;
@@ -1489,7 +1490,7 @@ error:
char *
qemuBuildFSDevStr(virDomainFSDefPtr fs,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer opt = VIR_BUFFER_INITIALIZER;
@@ -1520,7 +1521,7 @@ error:
char *
qemuBuildControllerDevStr(virDomainControllerDefPtr def,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -1605,7 +1606,7 @@ qemuBuildNicStr(virDomainNetDefPtr net,
char *
qemuBuildNicDevStr(virDomainNetDefPtr net,
int vlan,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *nic;
@@ -1777,7 +1778,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
char *
qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -1808,7 +1809,7 @@ error:
char *
qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -1855,7 +1856,7 @@ error:
char *
qemuBuildSoundDevStr(virDomainSoundDefPtr sound,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *model = virDomainSoundModelTypeToString(sound->model);
@@ -1917,7 +1918,7 @@ error:
static char *
qemuBuildVideoDevStr(virDomainVideoDefPtr video,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
const char *model = qemuVideoTypeToString(video->type);
@@ -1973,7 +1974,7 @@ qemuOpenPCIConfig(virDomainHostdevDefPtr dev)
char *
qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -2066,7 +2067,7 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev)
* host side of the character device */
static char *
qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
bool telnet;
@@ -2244,7 +2245,7 @@ error:
static char *
qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE)
@@ -2482,7 +2483,7 @@ static int
qemuBuildCpuArgStr(const struct qemud_driver *driver,
const virDomainDefPtr def,
const char *emulator,
- unsigned long long qemuCaps,
+ virBitmapPtr qemuCaps,
const struct utsname *ut,
char **opt,
bool *hasHwVirt)
@@ -2607,7 +2608,7 @@ no_memory:
static char *
qemuBuildSmpArgStr(const virDomainDefPtr def,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -2660,7 +2661,7 @@ qemuBuildCommandLine(virConnectPtr conn,
virDomainDefPtr def,
virDomainChrSourceDefPtr monitor_chr,
bool monitor_json,
- unsigned long long qemuCaps,
+ virBitmapPtr qemuCaps,
const char *migrateFrom,
int migrateFd,
virDomainSnapshotObjPtr current_snapshot,
@@ -2698,7 +2699,7 @@ qemuBuildCommandLine(virConnectPtr conn,
*/
if (qemuCapsGet(qemuCaps, QEMU_CAPS_KVM) &&
(def->virtType == VIR_DOMAIN_VIRT_QEMU))
- qemuCapsClear(&qemuCaps, QEMU_CAPS_DRIVE_BOOT);
+ qemuCapsClear(qemuCaps, QEMU_CAPS_DRIVE_BOOT);
switch (def->virtType) {
case VIR_DOMAIN_VIRT_QEMU:
@@ -3241,13 +3242,13 @@ qemuBuildCommandLine(virConnectPtr conn,
if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN) {
withDeviceArg = 1;
} else {
- qemuCapsClear(&qemuCaps, QEMU_CAPS_DEVICE);
+ qemuCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
deviceFlagMasked = true;
}
}
optstr = qemuBuildDriveStr(disk, bootable, qemuCaps);
if (deviceFlagMasked)
- qemuCapsSet(&qemuCaps, QEMU_CAPS_DEVICE);
+ qemuCapsSet(qemuCaps, QEMU_CAPS_DEVICE);
if (!optstr)
goto error;
virCommandAddArg(cmd, optstr);
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 332d5a3..1902472 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -46,7 +46,7 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
virDomainDefPtr def,
virDomainChrSourceDefPtr monitor_chr,
bool monitor_json,
- unsigned long long qemuCaps,
+ virBitmapPtr qemuCaps,
const char *migrateFrom,
int migrateFd,
virDomainSnapshotObjPtr current_snapshot,
@@ -68,44 +68,44 @@ char * qemuBuildNicStr(virDomainNetDefPtr net,
/* Current, best practice */
char * qemuBuildNicDevStr(virDomainNetDefPtr net,
int vlan,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
/* Both legacy & current support */
char *qemuBuildDriveStr(virDomainDiskDefPtr disk,
int bootable,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
char *qemuBuildFSStr(virDomainFSDefPtr fs,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
/* Current, best practice */
char * qemuBuildDriveDevStr(virDomainDiskDefPtr disk,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
char * qemuBuildFSDevStr(virDomainFSDefPtr fs,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
/* Current, best practice */
char * qemuBuildControllerDevStr(virDomainControllerDefPtr def,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
char * qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
char * qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
char * qemuBuildUSBInputDevStr(virDomainInputDefPtr dev);
char * qemuBuildSoundDevStr(virDomainSoundDefPtr sound,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
/* Legacy, pre device support */
char * qemuBuildPCIHostdevPCIDevStr(virDomainHostdevDefPtr dev);
/* Current, best practice */
char * qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev,
const char *configfd,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuOpenPCIConfig(virDomainHostdevDefPtr dev);
@@ -119,13 +119,13 @@ char * qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev);
int qemuNetworkIfaceConnect(virConnectPtr conn,
struct qemud_driver *driver,
virDomainNetDefPtr net,
- unsigned long long qemCmdFlags)
+ virBitmapPtr qemuCaps)
ATTRIBUTE_NONNULL(1);
int qemuPhysIfaceConnect(virConnectPtr conn,
struct qemud_driver *driver,
virDomainNetDefPtr net,
- unsigned long long qemuCaps,
+ virBitmapPtr qemuCaps,
const unsigned char *vmuuid,
enum virVMOperationType vmop);
@@ -156,7 +156,7 @@ int qemuAssignDevicePCISlots(virDomainDefPtr def,
qemuDomainPCIAddressSetPtr ad
int qemuDomainNetVLAN(virDomainNetDefPtr def);
int qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx);
-int qemuAssignDeviceDiskAlias(virDomainDiskDefPtr def, unsigned long long qemuCaps);
+int qemuAssignDeviceDiskAlias(virDomainDiskDefPtr def, virBitmapPtr qemuCaps);
int qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr net, int
idx);
int qemuAssignDeviceControllerAlias(virDomainControllerDefPtr controller);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 6dc356e..e99d740 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -3535,7 +3535,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
struct qemud_driver *driver = conn->privateData;
virDomainDefPtr def = NULL;
virDomainChrSourceDef monConfig;
- unsigned long long qemuCaps;
+ virBitmapPtr qemuCaps = NULL;
virCommandPtr cmd = NULL;
char *ret = NULL;
int i;
@@ -3608,6 +3608,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
cleanup:
qemuDriverUnlock(driver);
+ qemuCapsFree(qemuCaps);
virCommandFree(cmd);
virDomainDefFree(def);
return ret;
@@ -3944,7 +3945,7 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
virDomainDeviceDefPtr dev = NULL;
- unsigned long long qemuCaps;
+ virBitmapPtr qemuCaps = NULL;
virCgroupPtr cgroup = NULL;
int ret = -1;
@@ -4075,6 +4076,7 @@ cleanup:
if (cgroup)
virCgroupFree(&cgroup);
+ qemuCapsFree(qemuCaps);
virDomainDeviceDefFree(dev);
if (vm)
virDomainObjUnlock(vm);
@@ -4102,7 +4104,7 @@ static int qemuDomainUpdateDeviceFlags(virDomainPtr dom,
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
virDomainDeviceDefPtr dev = NULL;
- unsigned long long qemuCaps;
+ virBitmapPtr qemuCaps = NULL;
virCgroupPtr cgroup = NULL;
int ret = -1;
bool force = (flags & VIR_DOMAIN_DEVICE_MODIFY_FORCE) != 0;
@@ -4208,6 +4210,7 @@ cleanup:
if (cgroup)
virCgroupFree(&cgroup);
+ qemuCapsFree(qemuCaps);
virDomainDeviceDefFree(dev);
if (vm)
virDomainObjUnlock(vm);
@@ -4220,7 +4223,7 @@ static int qemudDomainDetachDevice(virDomainPtr dom,
const char *xml) {
struct qemud_driver *driver = dom->conn->privateData;
virDomainObjPtr vm;
- unsigned long long qemuCaps;
+ virBitmapPtr qemuCaps = NULL;
virDomainDeviceDefPtr dev = NULL;
int ret = -1;
@@ -4293,6 +4296,7 @@ endjob:
vm = NULL;
cleanup:
+ qemuCapsFree(qemuCaps);
virDomainDeviceDefFree(dev);
if (vm)
virDomainObjUnlock(vm);
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 31f0ebb..0002af0 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -44,7 +44,7 @@
int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
- unsigned long long qemuCaps,
+ virBitmapPtr qemuCaps,
bool force)
{
virDomainDiskDefPtr origdisk = NULL;
@@ -140,7 +140,7 @@ error:
int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
int i, ret;
const char* type = virDomainDiskBusTypeToString(disk->bus);
@@ -235,7 +235,7 @@ error:
int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainControllerDefPtr controller,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
int i;
int ret = -1;
@@ -300,7 +300,7 @@ static virDomainControllerDefPtr
qemuDomainFindOrCreateSCSIDiskController(struct qemud_driver *driver,
virDomainObjPtr vm,
int controller,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
int i;
virDomainControllerDefPtr cont;
@@ -346,7 +346,7 @@ qemuDomainFindOrCreateSCSIDiskController(struct qemud_driver *driver,
int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
int i;
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -462,7 +462,7 @@ error:
int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int i, ret;
@@ -547,7 +547,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainNetDefPtr net,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
char *tapfd_name = NULL;
@@ -777,7 +777,7 @@ no_memory:
int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
qemuDomainObjPrivatePtr priv = vm->privateData;
int ret;
@@ -872,7 +872,7 @@ error:
int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
int ret;
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -935,7 +935,7 @@ error:
int qemuDomainAttachHostDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
@@ -1130,7 +1130,7 @@ static inline int qemuFindDisk(virDomainDefPtr def, const char
*dst)
int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
int i, ret = -1;
virDomainDiskDefPtr detach = NULL;
@@ -1221,7 +1221,7 @@ cleanup:
int qemuDomainDetachSCSIDiskDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
int i, ret = -1;
virDomainDiskDefPtr detach = NULL;
@@ -1350,7 +1350,7 @@ static bool qemuDomainControllerIsBusy(virDomainObjPtr vm,
int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
int i, ret = -1;
virDomainControllerDefPtr detach = NULL;
@@ -1434,7 +1434,7 @@ cleanup:
int qemuDomainDetachNetDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
int i, ret = -1;
virDomainNetDefPtr detach = NULL;
@@ -1561,7 +1561,7 @@ cleanup:
int qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virDomainHostdevDefPtr detach = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -1661,7 +1661,7 @@ int qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
int qemuDomainDetachHostUsbDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virDomainHostdevDefPtr detach = NULL;
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -1743,7 +1743,7 @@ int qemuDomainDetachHostUsbDevice(struct qemud_driver *driver,
int qemuDomainDetachHostDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
virDomainHostdevDefPtr hostdev = dev->data.hostdev;
int ret;
diff --git a/src/qemu/qemu_hotplug.h b/src/qemu/qemu_hotplug.h
index a5eadd3..984c3b8 100644
--- a/src/qemu/qemu_hotplug.h
+++ b/src/qemu/qemu_hotplug.h
@@ -32,41 +32,41 @@
int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
- unsigned long long qemuCaps,
+ virBitmapPtr qemuCaps,
bool force);
int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainControllerDefPtr controller,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDiskDefPtr disk,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainAttachNetDevice(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainNetDefPtr net,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainAttachHostDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainHostdevDefPtr hostdev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainChangeGraphics(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainGraphicsDefPtr dev);
@@ -78,31 +78,31 @@ int qemuDomainChangeGraphicsPasswords(struct qemud_driver *driver,
int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainDetachSCSIDiskDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainDetachNetDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainDetachHostUsbDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
int qemuDomainDetachHostDevice(struct qemud_driver *driver,
virDomainObjPtr vm,
virDomainDeviceDefPtr dev,
- unsigned long long qemuCaps);
+ virBitmapPtr qemuCaps);
#endif /* __QEMU_HOTPLUG_H__ */
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 3a52bce..822cb18 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -244,7 +244,7 @@ qemuMigrationPrepareTunnel(struct qemud_driver *driver,
int ret = -1;
int internalret;
char *unixfile = NULL;
- unsigned long long qemuCaps;
+ virBitmapPtr qemuCaps = NULL;
qemuDomainObjPrivatePtr priv = NULL;
struct timeval now;
@@ -376,6 +376,7 @@ endjob:
}
cleanup:
+ qemuCapsFree(qemuCaps);
virDomainDefFree(def);
if (unixfile)
unlink(unixfile);
@@ -708,7 +709,7 @@ static int doTunnelMigrate(struct qemud_driver *driver,
virStreamPtr st = NULL;
char *unixfile = NULL;
int internalret;
- unsigned long long qemuCaps;
+ virBitmapPtr qemuCaps = NULL;
int status;
unsigned long long transferred, remaining, total;
unsigned int background_flags = QEMU_MONITOR_MIGRATE_BACKGROUND;
@@ -894,6 +895,7 @@ finish:
cleanup:
VIR_FORCE_CLOSE(client_sock);
VIR_FORCE_CLOSE(qemu_sock);
+ qemuCapsFree(qemuCaps);
if (ddomain)
virUnrefDomain(ddomain);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 12e5595..7879165 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1137,7 +1137,7 @@ static int
qemuProcessInitPasswords(virConnectPtr conn,
struct qemud_driver *driver,
virDomainObjPtr vm,
- unsigned long long qemuCaps)
+ virBitmapPtr qemuCaps)
{
int ret = 0;
qemuDomainObjPrivatePtr priv = vm->privateData;
@@ -1789,7 +1789,7 @@ qemuProcessReconnect(void *payload, const char *name
ATTRIBUTE_UNUSED, void *opa
struct qemuProcessReconnectData *data = opaque;
struct qemud_driver *driver = data->driver;
qemuDomainObjPrivatePtr priv;
- unsigned long long qemuCaps;
+ virBitmapPtr qemuCaps = NULL;
virConnectPtr conn = data->conn;
virDomainObjLock(obj);
@@ -1835,9 +1835,12 @@ qemuProcessReconnect(void *payload, const char *name
ATTRIBUTE_UNUSED, void *opa
if (virDomainObjUnref(obj) > 0)
virDomainObjUnlock(obj);
+
+ qemuCapsFree(qemuCaps);
return;
error:
+ qemuCapsFree(qemuCaps);
if (!virDomainObjIsActive(obj)) {
if (virDomainObjUnref(obj) > 0)
virDomainObjUnlock(obj);
@@ -1879,7 +1882,7 @@ int qemuProcessStart(virConnectPtr conn,
enum virVMOperationType vmop)
{
int ret;
- unsigned long long qemuCaps;
+ virBitmapPtr qemuCaps = NULL;
off_t pos = -1;
char ebuf[1024];
char *pidfile = NULL;
@@ -2220,6 +2223,7 @@ int qemuProcessStart(virConnectPtr conn,
if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0)
goto cleanup;
+ qemuCapsFree(qemuCaps);
virCommandFree(cmd);
VIR_FORCE_CLOSE(logfile);
@@ -2229,6 +2233,7 @@ cleanup:
/* We jump here if we failed to start the VM for any reason, or
* if we failed to initialize the now running VM. kill it off and
* pretend we never started it */
+ qemuCapsFree(qemuCaps);
virCommandFree(cmd);
VIR_FORCE_CLOSE(logfile);
qemuProcessStop(driver, vm, 0);
--
1.7.4.1