[PATCH 06/20] Turn QEMU capabilities object into a full virObjectPtr

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

 



From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>

The current qemu capabilities are stored in a virBitmapPtr
object, whose type is exposed to callers. We want to store
more data besides just the flags, so we need to move to a
struct type. This object will also need to be reference
counted, since we'll be maintaining a cache of data per
binary. This change introduces a 'qemuCapsPtr' virObject
class. Most of the change is just renaming types and
variables in all the callers

Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx>
---
 src/qemu/qemu_capabilities.c | 376 ++++++++++++++++------------
 src/qemu/qemu_capabilities.h |  29 ++-
 src/qemu/qemu_command.c      | 580 +++++++++++++++++++++----------------------
 src/qemu/qemu_command.h      |  53 ++--
 src/qemu/qemu_domain.c       |  16 +-
 src/qemu/qemu_domain.h       |   4 +-
 src/qemu/qemu_driver.c       |  40 +--
 src/qemu/qemu_hotplug.c      | 138 +++++-----
 src/qemu/qemu_migration.c    |  16 +-
 src/qemu/qemu_monitor.c      |   6 +-
 src/qemu/qemu_monitor.h      |   3 +-
 src/qemu/qemu_monitor_json.c |  16 +-
 src/qemu/qemu_monitor_json.h |   4 +-
 src/qemu/qemu_process.c      |  62 ++---
 tests/qemuhelptest.c         |  16 +-
 tests/qemuxml2argvtest.c     |   6 +-
 tests/qemuxmlnstest.c        |   6 +-
 17 files changed, 712 insertions(+), 659 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index ed85b6f..b8c1f36 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -178,6 +178,28 @@ VIR_ENUM_IMPL(qemuCaps, QEMU_CAPS_LAST,
               "disable-s4", /* 105 */
     );
 
+struct _qemuCaps {
+    virObject object;
+
+    virBitmapPtr flags;
+};
+
+
+static virClassPtr qemuCapsClass;
+static void qemuCapsDispose(void *obj);
+
+static int qemuCapsOnceInit(void)
+{
+    if (!(qemuCapsClass = virClassNew("qemuCaps",
+                                      sizeof(qemuCaps),
+                                      qemuCapsDispose)))
+        return -1;
+
+    return 0;
+}
+
+VIR_ONCE_GLOBAL_INIT(qemuCaps)
+
 struct qemu_feature_flags {
     const char *name;
     const int default_on;
@@ -304,7 +326,7 @@ qemuCapsParseMachineTypesStr(const char *output,
 
 int
 qemuCapsProbeMachineTypes(const char *binary,
-                          virBitmapPtr qemuCaps,
+                          qemuCapsPtr caps,
                           virCapsGuestMachinePtr **machines,
                           int *nmachines)
 {
@@ -322,7 +344,7 @@ qemuCapsProbeMachineTypes(const char *binary,
         return -1;
     }
 
-    cmd = qemuCapsProbeCommand(binary, qemuCaps);
+    cmd = qemuCapsProbeCommand(binary, caps);
     virCommandAddArgList(cmd, "-M", "?", NULL);
     virCommandSetOutputBuffer(cmd, &output);
 
@@ -590,7 +612,7 @@ cleanup:
 
 int
 qemuCapsProbeCPUModels(const char *qemu,
-                       virBitmapPtr qemuCaps,
+                       qemuCapsPtr caps,
                        const char *arch,
                        unsigned int *count,
                        const char ***cpus)
@@ -614,7 +636,7 @@ qemuCapsProbeCPUModels(const char *qemu,
         return 0;
     }
 
-    cmd = qemuCapsProbeCommand(qemu, qemuCaps);
+    cmd = qemuCapsProbeCommand(qemu, caps);
     virCommandAddArgList(cmd, "-cpu", "?", NULL);
     virCommandSetOutputBuffer(cmd, &output);
 
@@ -652,8 +674,8 @@ qemuCapsInitGuest(virCapsPtr caps,
     int nmachines = 0;
     struct stat st;
     unsigned int ncpus;
-    virBitmapPtr qemuCaps = NULL;
-    virBitmapPtr kvmCaps = NULL;
+    qemuCapsPtr qemubinCaps = NULL;
+    qemuCapsPtr kvmbinCaps = NULL;
     int ret = -1;
 
     /* Check for existance of base emulator, or alternate base
@@ -669,7 +691,7 @@ qemuCapsInitGuest(virCapsPtr caps,
     /* Ignore binary if extracting version info fails */
     if (binary &&
         qemuCapsExtractVersionInfo(binary, info->arch,
-                                   false, NULL, &qemuCaps) < 0)
+                                   false, NULL, &qemubinCaps) < 0)
         VIR_FREE(binary);
 
     /* qemu-kvm/kvm binaries can only be used if
@@ -692,16 +714,16 @@ qemuCapsInitGuest(virCapsPtr caps,
 
             if (qemuCapsExtractVersionInfo(kvmbin, info->arch,
                                            false, NULL,
-                                           &kvmCaps) < 0) {
+                                           &kvmbinCaps) < 0) {
                 VIR_FREE(kvmbin);
                 continue;
             }
 
             if (!binary) {
                 binary = kvmbin;
-                qemuCaps = kvmCaps;
+                qemubinCaps = kvmbinCaps;
                 kvmbin = NULL;
-                kvmCaps = NULL;
+                kvmbinCaps = NULL;
             }
             break;
         }
@@ -711,13 +733,13 @@ qemuCapsInitGuest(virCapsPtr caps,
         return 0;
 
     if (access("/dev/kvm", F_OK) == 0 &&
-        (qemuCapsGet(qemuCaps, QEMU_CAPS_KVM) ||
-         qemuCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KVM) ||
+        (qemuCapsGet(qemubinCaps, QEMU_CAPS_KVM) ||
+         qemuCapsGet(qemubinCaps, QEMU_CAPS_ENABLE_KVM) ||
          kvmbin))
         haskvm = 1;
 
     if (access("/dev/kqemu", F_OK) == 0 &&
-        qemuCapsGet(qemuCaps, QEMU_CAPS_KQEMU))
+        qemuCapsGet(qemubinCaps, QEMU_CAPS_KQEMU))
         haskqemu = 1;
 
     if (stat(binary, &st) == 0) {
@@ -757,7 +779,7 @@ qemuCapsInitGuest(virCapsPtr caps,
                                             info->wordsize, binary, binary_mtime,
                                             old_caps, &machines, &nmachines);
         if (probe &&
-            qemuCapsProbeMachineTypes(binary, qemuCaps,
+            qemuCapsProbeMachineTypes(binary, qemubinCaps,
                                       &machines, &nmachines) < 0)
             goto error;
     }
@@ -785,7 +807,7 @@ qemuCapsInitGuest(virCapsPtr caps,
         !virCapabilitiesAddGuestFeature(guest, "cpuselection", 1, 0))
         goto error;
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) &&
+    if (qemuCapsGet(qemubinCaps, QEMU_CAPS_BOOTINDEX) &&
         !virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0))
         goto error;
 
@@ -828,7 +850,7 @@ qemuCapsInitGuest(virCapsPtr caps,
                                                     binary_mtime, old_caps,
                                                     &machines, &nmachines);
                 if (probe &&
-                    qemuCapsProbeMachineTypes(kvmbin, qemuCaps,
+                    qemuCapsProbeMachineTypes(kvmbin, kvmbinCaps,
                                               &machines, &nmachines) < 0)
                     goto error;
             }
@@ -872,8 +894,8 @@ qemuCapsInitGuest(virCapsPtr caps,
 cleanup:
     VIR_FREE(binary);
     VIR_FREE(kvmbin);
-    qemuCapsFree(qemuCaps);
-    qemuCapsFree(kvmCaps);
+    virObjectUnref(qemubinCaps);
+    virObjectUnref(kvmbinCaps);
 
     return ret;
 
@@ -1023,122 +1045,122 @@ qemuCapsComputeCmdFlags(const char *help,
                         unsigned int version,
                         unsigned int is_kvm,
                         unsigned int kvm_version,
-                        virBitmapPtr flags,
+                        qemuCapsPtr caps,
                         bool check_yajl ATTRIBUTE_UNUSED)
 {
     const char *p;
     const char *fsdev, *netdev;
 
     if (strstr(help, "-no-kqemu"))
-        qemuCapsSet(flags, QEMU_CAPS_KQEMU);
+        qemuCapsSet(caps, QEMU_CAPS_KQEMU);
     if (strstr(help, "-enable-kqemu"))
-        qemuCapsSet(flags, QEMU_CAPS_ENABLE_KQEMU);
+        qemuCapsSet(caps, QEMU_CAPS_ENABLE_KQEMU);
     if (strstr(help, "-no-kvm"))
-        qemuCapsSet(flags, QEMU_CAPS_KVM);
+        qemuCapsSet(caps, QEMU_CAPS_KVM);
     if (strstr(help, "-enable-kvm"))
-        qemuCapsSet(flags, QEMU_CAPS_ENABLE_KVM);
+        qemuCapsSet(caps, QEMU_CAPS_ENABLE_KVM);
     if (strstr(help, "-no-reboot"))
-        qemuCapsSet(flags, QEMU_CAPS_NO_REBOOT);
+        qemuCapsSet(caps, QEMU_CAPS_NO_REBOOT);
     if (strstr(help, "-name")) {
-        qemuCapsSet(flags, QEMU_CAPS_NAME);
+        qemuCapsSet(caps, QEMU_CAPS_NAME);
         if (strstr(help, ",process="))
-            qemuCapsSet(flags, QEMU_CAPS_NAME_PROCESS);
+            qemuCapsSet(caps, QEMU_CAPS_NAME_PROCESS);
     }
     if (strstr(help, "-uuid"))
-        qemuCapsSet(flags, QEMU_CAPS_UUID);
+        qemuCapsSet(caps, QEMU_CAPS_UUID);
     if (strstr(help, "-xen-domid"))
-        qemuCapsSet(flags, QEMU_CAPS_XEN_DOMID);
+        qemuCapsSet(caps, QEMU_CAPS_XEN_DOMID);
     else if (strstr(help, "-domid"))
-        qemuCapsSet(flags, QEMU_CAPS_DOMID);
+        qemuCapsSet(caps, QEMU_CAPS_DOMID);
     if (strstr(help, "-drive")) {
         const char *cache = strstr(help, "cache=");
 
-        qemuCapsSet(flags, QEMU_CAPS_DRIVE);
+        qemuCapsSet(caps, QEMU_CAPS_DRIVE);
         if (cache && (p = strchr(cache, ']'))) {
             if (memmem(cache, p - cache, "on|off", sizeof("on|off") - 1) == NULL)
-                qemuCapsSet(flags, QEMU_CAPS_DRIVE_CACHE_V2);
+                qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_V2);
             if (memmem(cache, p - cache, "directsync", sizeof("directsync") - 1))
-                qemuCapsSet(flags, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
+                qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC);
             if (memmem(cache, p - cache, "unsafe", sizeof("unsafe") - 1))
-                qemuCapsSet(flags, QEMU_CAPS_DRIVE_CACHE_UNSAFE);
+                qemuCapsSet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE);
         }
         if (strstr(help, "format="))
-            qemuCapsSet(flags, QEMU_CAPS_DRIVE_FORMAT);
+            qemuCapsSet(caps, QEMU_CAPS_DRIVE_FORMAT);
         if (strstr(help, "readonly="))
-            qemuCapsSet(flags, QEMU_CAPS_DRIVE_READONLY);
+            qemuCapsSet(caps, QEMU_CAPS_DRIVE_READONLY);
         if (strstr(help, "aio=threads|native"))
-            qemuCapsSet(flags, QEMU_CAPS_DRIVE_AIO);
+            qemuCapsSet(caps, QEMU_CAPS_DRIVE_AIO);
         if (strstr(help, "copy-on-read=on|off"))
-            qemuCapsSet(flags, QEMU_CAPS_DRIVE_COPY_ON_READ);
+            qemuCapsSet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ);
         if (strstr(help, "bps="))
-            qemuCapsSet(flags, QEMU_CAPS_DRIVE_IOTUNE);
+            qemuCapsSet(caps, QEMU_CAPS_DRIVE_IOTUNE);
     }
     if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) {
         const char *nl = strstr(p, "\n");
 
-        qemuCapsSet(flags, QEMU_CAPS_VGA);
+        qemuCapsSet(caps, QEMU_CAPS_VGA);
 
         if (strstr(p, "|qxl"))
-            qemuCapsSet(flags, QEMU_CAPS_VGA_QXL);
+            qemuCapsSet(caps, QEMU_CAPS_VGA_QXL);
         if ((p = strstr(p, "|none")) && p < nl)
-            qemuCapsSet(flags, QEMU_CAPS_VGA_NONE);
+            qemuCapsSet(caps, QEMU_CAPS_VGA_NONE);
     }
     if (strstr(help, "-spice"))
-        qemuCapsSet(flags, QEMU_CAPS_SPICE);
+        qemuCapsSet(caps, QEMU_CAPS_SPICE);
     if (strstr(help, "boot=on"))
-        qemuCapsSet(flags, QEMU_CAPS_DRIVE_BOOT);
+        qemuCapsSet(caps, QEMU_CAPS_DRIVE_BOOT);
     if (strstr(help, "serial=s"))
-        qemuCapsSet(flags, QEMU_CAPS_DRIVE_SERIAL);
+        qemuCapsSet(caps, QEMU_CAPS_DRIVE_SERIAL);
     if (strstr(help, "-pcidevice"))
-        qemuCapsSet(flags, QEMU_CAPS_PCIDEVICE);
+        qemuCapsSet(caps, QEMU_CAPS_PCIDEVICE);
     if (strstr(help, "-mem-path"))
-        qemuCapsSet(flags, QEMU_CAPS_MEM_PATH);
+        qemuCapsSet(caps, QEMU_CAPS_MEM_PATH);
     if (strstr(help, "-chardev")) {
-        qemuCapsSet(flags, QEMU_CAPS_CHARDEV);
+        qemuCapsSet(caps, QEMU_CAPS_CHARDEV);
         if (strstr(help, "-chardev spicevmc"))
-            qemuCapsSet(flags, QEMU_CAPS_CHARDEV_SPICEVMC);
+            qemuCapsSet(caps, QEMU_CAPS_CHARDEV_SPICEVMC);
     }
     if (strstr(help, "-balloon"))
-        qemuCapsSet(flags, QEMU_CAPS_BALLOON);
+        qemuCapsSet(caps, QEMU_CAPS_BALLOON);
     if (strstr(help, "-device")) {
-        qemuCapsSet(flags, QEMU_CAPS_DEVICE);
+        qemuCapsSet(caps, 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(caps, QEMU_CAPS_DRIVE_READONLY);
     }
     if (strstr(help, "-nodefconfig"))
-        qemuCapsSet(flags, QEMU_CAPS_NODEFCONFIG);
+        qemuCapsSet(caps, QEMU_CAPS_NODEFCONFIG);
     if (strstr(help, "-no-user-config"))
-        qemuCapsSet(flags, QEMU_CAPS_NO_USER_CONFIG);
+        qemuCapsSet(caps, QEMU_CAPS_NO_USER_CONFIG);
     /* The trailing ' ' is important to avoid a bogus match */
     if (strstr(help, "-rtc "))
-        qemuCapsSet(flags, QEMU_CAPS_RTC);
+        qemuCapsSet(caps, QEMU_CAPS_RTC);
     /* to wit */
     if (strstr(help, "-rtc-td-hack"))
-        qemuCapsSet(flags, QEMU_CAPS_RTC_TD_HACK);
+        qemuCapsSet(caps, QEMU_CAPS_RTC_TD_HACK);
     if (strstr(help, "-no-hpet"))
-        qemuCapsSet(flags, QEMU_CAPS_NO_HPET);
+        qemuCapsSet(caps, QEMU_CAPS_NO_HPET);
     if (strstr(help, "-no-acpi"))
-        qemuCapsSet(flags, QEMU_CAPS_NO_ACPI);
+        qemuCapsSet(caps, QEMU_CAPS_NO_ACPI);
     if (strstr(help, "-no-kvm-pit-reinjection"))
-        qemuCapsSet(flags, QEMU_CAPS_NO_KVM_PIT);
+        qemuCapsSet(caps, QEMU_CAPS_NO_KVM_PIT);
     if (strstr(help, "-tdf"))
-        qemuCapsSet(flags, QEMU_CAPS_TDF);
+        qemuCapsSet(caps, QEMU_CAPS_TDF);
     if (strstr(help, "-enable-nesting"))
-        qemuCapsSet(flags, QEMU_CAPS_NESTING);
+        qemuCapsSet(caps, QEMU_CAPS_NESTING);
     if (strstr(help, ",menu=on"))
-        qemuCapsSet(flags, QEMU_CAPS_BOOT_MENU);
+        qemuCapsSet(caps, QEMU_CAPS_BOOT_MENU);
     if ((fsdev = strstr(help, "-fsdev"))) {
-        qemuCapsSet(flags, QEMU_CAPS_FSDEV);
+        qemuCapsSet(caps, QEMU_CAPS_FSDEV);
         if (strstr(fsdev, "readonly"))
-            qemuCapsSet(flags, QEMU_CAPS_FSDEV_READONLY);
+            qemuCapsSet(caps, QEMU_CAPS_FSDEV_READONLY);
         if (strstr(fsdev, "writeout"))
-            qemuCapsSet(flags, QEMU_CAPS_FSDEV_WRITEOUT);
+            qemuCapsSet(caps, QEMU_CAPS_FSDEV_WRITEOUT);
     }
     if (strstr(help, "-smbios type"))
-        qemuCapsSet(flags, QEMU_CAPS_SMBIOS_TYPE);
+        qemuCapsSet(caps, QEMU_CAPS_SMBIOS_TYPE);
 
     if ((netdev = strstr(help, "-netdev"))) {
         /* Disable -netdev on 0.12 since although it exists,
@@ -1147,26 +1169,26 @@ qemuCapsComputeCmdFlags(const char *help,
          * But see below about RHEL build. */
         if (version >= 13000) {
             if (strstr(netdev, "bridge"))
-                qemuCapsSet(flags, QEMU_CAPS_NETDEV_BRIDGE);
-           qemuCapsSet(flags, QEMU_CAPS_NETDEV);
+                qemuCapsSet(caps, QEMU_CAPS_NETDEV_BRIDGE);
+           qemuCapsSet(caps, QEMU_CAPS_NETDEV);
         }
     }
 
     if (strstr(help, "-sdl"))
-        qemuCapsSet(flags, QEMU_CAPS_SDL);
+        qemuCapsSet(caps, QEMU_CAPS_SDL);
     if (strstr(help, "cores=") &&
         strstr(help, "threads=") &&
         strstr(help, "sockets="))
-        qemuCapsSet(flags, QEMU_CAPS_SMP_TOPOLOGY);
+        qemuCapsSet(caps, QEMU_CAPS_SMP_TOPOLOGY);
 
     if (version >= 9000)
-        qemuCapsSet(flags, QEMU_CAPS_VNC_COLON);
+        qemuCapsSet(caps, QEMU_CAPS_VNC_COLON);
 
     if (is_kvm && (version >= 10000 || kvm_version >= 74))
-        qemuCapsSet(flags, QEMU_CAPS_VNET_HDR);
+        qemuCapsSet(caps, QEMU_CAPS_VNET_HDR);
 
     if (strstr(help, ",vhost=")) {
-        qemuCapsSet(flags, QEMU_CAPS_VHOST_NET);
+        qemuCapsSet(caps, QEMU_CAPS_VHOST_NET);
     }
 
     /* Do not use -no-shutdown if qemu doesn't support it or SIGTERM handling
@@ -1174,7 +1196,7 @@ qemuCapsComputeCmdFlags(const char *help,
      * 0.14.* and 0.15.0)
      */
     if (strstr(help, "-no-shutdown") && (version < 14000 || version > 15000))
-        qemuCapsSet(flags, QEMU_CAPS_NO_SHUTDOWN);
+        qemuCapsSet(caps, QEMU_CAPS_NO_SHUTDOWN);
 
     /*
      * Handling of -incoming arg with varying features
@@ -1189,25 +1211,25 @@ 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(caps, QEMU_CAPS_MIGRATE_QEMU_TCP);
+        qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
         if (version >= 12000) {
-            qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_UNIX);
-            qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_FD);
+            qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX);
+            qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_FD);
         }
     } else if (kvm_version >= 79) {
-        qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_TCP);
+        qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP);
         if (kvm_version >= 80)
-            qemuCapsSet(flags, QEMU_CAPS_MIGRATE_QEMU_EXEC);
+            qemuCapsSet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC);
     } else if (kvm_version > 0) {
-        qemuCapsSet(flags, QEMU_CAPS_MIGRATE_KVM_STDIO);
+        qemuCapsSet(caps, QEMU_CAPS_MIGRATE_KVM_STDIO);
     }
 
     if (version >= 10000)
-        qemuCapsSet(flags, QEMU_CAPS_0_10);
+        qemuCapsSet(caps, QEMU_CAPS_0_10);
 
     if (version >= 11000)
-        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_BLK_SG_IO);
+        qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO);
 
     /* While JSON mode was available in 0.12.0, it was too
      * incomplete to contemplate using. The 0.13.0 release
@@ -1220,11 +1242,11 @@ qemuCapsComputeCmdFlags(const char *help,
      */
 #if HAVE_YAJL
     if (version >= 13000) {
-        qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
+        qemuCapsSet(caps, QEMU_CAPS_MONITOR_JSON);
     } else if (version >= 12000 &&
                strstr(help, "libvirt")) {
-        qemuCapsSet(flags, QEMU_CAPS_MONITOR_JSON);
-        qemuCapsSet(flags, QEMU_CAPS_NETDEV);
+        qemuCapsSet(caps, QEMU_CAPS_MONITOR_JSON);
+        qemuCapsSet(caps, QEMU_CAPS_NETDEV);
     }
 #else
     /* Starting with qemu 0.15 and newer, upstream qemu no longer
@@ -1243,12 +1265,12 @@ qemuCapsComputeCmdFlags(const char *help,
                              "compiled with yajl"));
             return -1;
         }
-        qemuCapsSet(flags, QEMU_CAPS_NETDEV);
+        qemuCapsSet(caps, QEMU_CAPS_NETDEV);
     }
 #endif
 
     if (version >= 13000)
-        qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIFUNCTION);
+        qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIFUNCTION);
 
     /* Although very new versions of qemu advertise the presence of
      * the rombar option in the output of "qemu -device pci-assign,?",
@@ -1261,10 +1283,10 @@ qemuCapsComputeCmdFlags(const char *help,
      * log and refuse to start, so it would be immediately obvious).
      */
     if (version >= 12000)
-        qemuCapsSet(flags, QEMU_CAPS_PCI_ROMBAR);
+        qemuCapsSet(caps, QEMU_CAPS_PCI_ROMBAR);
 
     if (version >= 11000)
-        qemuCapsSet(flags, QEMU_CAPS_CPU_HOST);
+        qemuCapsSet(caps, QEMU_CAPS_CPU_HOST);
     return 0;
 }
 
@@ -1294,7 +1316,7 @@ qemuCapsComputeCmdFlags(const char *help,
 
 int qemuCapsParseHelpStr(const char *qemu,
                          const char *help,
-                         virBitmapPtr flags,
+                         qemuCapsPtr caps,
                          unsigned int *version,
                          unsigned int *is_kvm,
                          unsigned int *kvm_version,
@@ -1355,10 +1377,10 @@ int qemuCapsParseHelpStr(const char *qemu,
     *version = (major * 1000 * 1000) + (minor * 1000) + micro;
 
     if (qemuCapsComputeCmdFlags(help, *version, *is_kvm, *kvm_version,
-                                flags, check_yajl) < 0)
+                                caps, check_yajl) < 0)
         goto cleanup;
 
-    strflags = virBitmapString(flags);
+    strflags = virBitmapString(caps->flags);
     VIR_DEBUG("Version %u.%u.%u, cooked version %u, flags %s",
               major, minor, micro, *version, NULLSTR(strflags));
     VIR_FREE(strflags);
@@ -1385,7 +1407,7 @@ cleanup:
 
 static int
 qemuCapsExtractDeviceStr(const char *qemu,
-                         virBitmapPtr flags)
+                         qemuCapsPtr caps)
 {
     char *output = NULL;
     virCommandPtr cmd;
@@ -1399,7 +1421,7 @@ qemuCapsExtractDeviceStr(const char *qemu,
      * understand '-device name,?', and always exits with status 1 for
      * the simpler '-device ?', so this function is really only useful
      * if -help includes "device driver,?".  */
-    cmd = qemuCapsProbeCommand(qemu, flags);
+    cmd = qemuCapsProbeCommand(qemu, caps);
     virCommandAddArgList(cmd,
                          "-device", "?",
                          "-device", "pci-assign,?",
@@ -1414,7 +1436,7 @@ qemuCapsExtractDeviceStr(const char *qemu,
     if (virCommandRun(cmd, NULL) < 0)
         goto cleanup;
 
-    ret = qemuCapsParseDeviceStr(output, flags);
+    ret = qemuCapsParseDeviceStr(output, caps);
 
 cleanup:
     VIR_FREE(output);
@@ -1424,85 +1446,85 @@ cleanup:
 
 
 int
-qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
+qemuCapsParseDeviceStr(const char *str, qemuCapsPtr caps)
 {
     /* Which devices exist. */
     if (strstr(str, "name \"hda-duplex\""))
-        qemuCapsSet(flags, QEMU_CAPS_HDA_DUPLEX);
+        qemuCapsSet(caps, QEMU_CAPS_HDA_DUPLEX);
     if (strstr(str, "name \"hda-micro\""))
-        qemuCapsSet(flags, QEMU_CAPS_HDA_MICRO);
+        qemuCapsSet(caps, QEMU_CAPS_HDA_MICRO);
     if (strstr(str, "name \"ccid-card-emulated\""))
-        qemuCapsSet(flags, QEMU_CAPS_CCID_EMULATED);
+        qemuCapsSet(caps, QEMU_CAPS_CCID_EMULATED);
     if (strstr(str, "name \"ccid-card-passthru\""))
-        qemuCapsSet(flags, QEMU_CAPS_CCID_PASSTHRU);
+        qemuCapsSet(caps, QEMU_CAPS_CCID_PASSTHRU);
 
     if (strstr(str, "name \"piix3-usb-uhci\""))
-        qemuCapsSet(flags, QEMU_CAPS_PIIX3_USB_UHCI);
+        qemuCapsSet(caps, QEMU_CAPS_PIIX3_USB_UHCI);
     if (strstr(str, "name \"piix4-usb-uhci\""))
-        qemuCapsSet(flags, QEMU_CAPS_PIIX4_USB_UHCI);
+        qemuCapsSet(caps, QEMU_CAPS_PIIX4_USB_UHCI);
     if (strstr(str, "name \"usb-ehci\""))
-        qemuCapsSet(flags, QEMU_CAPS_USB_EHCI);
+        qemuCapsSet(caps, QEMU_CAPS_USB_EHCI);
     if (strstr(str, "name \"ich9-usb-ehci1\""))
-        qemuCapsSet(flags, QEMU_CAPS_ICH9_USB_EHCI1);
+        qemuCapsSet(caps, QEMU_CAPS_ICH9_USB_EHCI1);
     if (strstr(str, "name \"vt82c686b-usb-uhci\""))
-        qemuCapsSet(flags, QEMU_CAPS_VT82C686B_USB_UHCI);
+        qemuCapsSet(caps, QEMU_CAPS_VT82C686B_USB_UHCI);
     if (strstr(str, "name \"pci-ohci\""))
-        qemuCapsSet(flags, QEMU_CAPS_PCI_OHCI);
+        qemuCapsSet(caps, QEMU_CAPS_PCI_OHCI);
     if (strstr(str, "name \"nec-usb-xhci\""))
-        qemuCapsSet(flags, QEMU_CAPS_NEC_USB_XHCI);
+        qemuCapsSet(caps, QEMU_CAPS_NEC_USB_XHCI);
     if (strstr(str, "name \"usb-redir\""))
-        qemuCapsSet(flags, QEMU_CAPS_USB_REDIR);
+        qemuCapsSet(caps, QEMU_CAPS_USB_REDIR);
     if (strstr(str, "name \"usb-hub\""))
-        qemuCapsSet(flags, QEMU_CAPS_USB_HUB);
+        qemuCapsSet(caps, QEMU_CAPS_USB_HUB);
     if (strstr(str, "name \"ich9-ahci\""))
-        qemuCapsSet(flags, QEMU_CAPS_ICH9_AHCI);
+        qemuCapsSet(caps, QEMU_CAPS_ICH9_AHCI);
     if (strstr(str, "name \"virtio-blk-s390\"") ||
         strstr(str, "name \"virtio-net-s390\"") ||
         strstr(str, "name \"virtio-serial-s390\""))
-        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_S390);
+        qemuCapsSet(caps, QEMU_CAPS_VIRTIO_S390);
 
     if (strstr(str, "name \"lsi53c895a\""))
-        qemuCapsSet(flags, QEMU_CAPS_SCSI_LSI);
+        qemuCapsSet(caps, QEMU_CAPS_SCSI_LSI);
     if (strstr(str, "name \"virtio-scsi-pci\""))
-        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_SCSI_PCI);
+        qemuCapsSet(caps, QEMU_CAPS_VIRTIO_SCSI_PCI);
 
     /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
-    if (!qemuCapsGet(flags, QEMU_CAPS_CHARDEV_SPICEVMC) &&
+    if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC) &&
         strstr(str, "name \"spicevmc\""))
-        qemuCapsSet(flags, QEMU_CAPS_DEVICE_SPICEVMC);
+        qemuCapsSet(caps, QEMU_CAPS_DEVICE_SPICEVMC);
 
     /* Features of given devices. */
     if (strstr(str, "pci-assign.configfd"))
-        qemuCapsSet(flags, QEMU_CAPS_PCI_CONFIGFD);
+        qemuCapsSet(caps, QEMU_CAPS_PCI_CONFIGFD);
     if (strstr(str, "virtio-blk-pci.multifunction"))
-        qemuCapsSet(flags, QEMU_CAPS_PCI_MULTIFUNCTION);
+        qemuCapsSet(caps, QEMU_CAPS_PCI_MULTIFUNCTION);
     if (strstr(str, "virtio-blk-pci.bootindex")) {
-        qemuCapsSet(flags, QEMU_CAPS_BOOTINDEX);
+        qemuCapsSet(caps, QEMU_CAPS_BOOTINDEX);
         if (strstr(str, "pci-assign.bootindex"))
-            qemuCapsSet(flags, QEMU_CAPS_PCI_BOOTINDEX);
+            qemuCapsSet(caps, QEMU_CAPS_PCI_BOOTINDEX);
     }
     if (strstr(str, "virtio-net-pci.tx="))
-        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_TX_ALG);
+        qemuCapsSet(caps, QEMU_CAPS_VIRTIO_TX_ALG);
     if (strstr(str, "name \"qxl-vga\""))
-        qemuCapsSet(flags, QEMU_CAPS_DEVICE_QXL_VGA);
+        qemuCapsSet(caps, QEMU_CAPS_DEVICE_QXL_VGA);
     if (strstr(str, "virtio-blk-pci.ioeventfd"))
-        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_IOEVENTFD);
+        qemuCapsSet(caps, QEMU_CAPS_VIRTIO_IOEVENTFD);
     if (strstr(str, "name \"sga\""))
-        qemuCapsSet(flags, QEMU_CAPS_SGA);
+        qemuCapsSet(caps, QEMU_CAPS_SGA);
     if (strstr(str, "virtio-blk-pci.event_idx"))
-        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX);
+        qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX);
     if (strstr(str, "virtio-net-pci.event_idx"))
-        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_NET_EVENT_IDX);
+        qemuCapsSet(caps, QEMU_CAPS_VIRTIO_NET_EVENT_IDX);
     if (strstr(str, "virtio-blk-pci.scsi"))
-        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_BLK_SCSI);
+        qemuCapsSet(caps, QEMU_CAPS_VIRTIO_BLK_SCSI);
     if (strstr(str, "scsi-disk.channel"))
-        qemuCapsSet(flags, QEMU_CAPS_SCSI_DISK_CHANNEL);
+        qemuCapsSet(caps, QEMU_CAPS_SCSI_DISK_CHANNEL);
     if (strstr(str, "scsi-block"))
-        qemuCapsSet(flags, QEMU_CAPS_SCSI_BLOCK);
+        qemuCapsSet(caps, QEMU_CAPS_SCSI_BLOCK);
     if (strstr(str, "scsi-cd"))
-        qemuCapsSet(flags, QEMU_CAPS_SCSI_CD);
+        qemuCapsSet(caps, QEMU_CAPS_SCSI_CD);
     if (strstr(str, "ide-cd"))
-        qemuCapsSet(flags, QEMU_CAPS_IDE_CD);
+        qemuCapsSet(caps, QEMU_CAPS_IDE_CD);
     /*
      * the iolimit detection is not really straight forward:
      * in qemu this is a capability of the block layer, if
@@ -1512,11 +1534,11 @@ qemuCapsParseDeviceStr(const char *str, virBitmapPtr flags)
      */
     if (strstr(str, ".logical_block_size") &&
         strstr(str, ".physical_block_size"))
-        qemuCapsSet(flags, QEMU_CAPS_BLOCKIO);
+        qemuCapsSet(caps, QEMU_CAPS_BLOCKIO);
     if (strstr(str, "PIIX4_PM.disable_s3="))
-        qemuCapsSet(flags, QEMU_CAPS_DISABLE_S3);
+        qemuCapsSet(caps, QEMU_CAPS_DISABLE_S3);
     if (strstr(str, "PIIX4_PM.disable_s4="))
-        qemuCapsSet(flags, QEMU_CAPS_DISABLE_S4);
+        qemuCapsSet(caps, QEMU_CAPS_DISABLE_S4);
 
     return 0;
 }
@@ -1525,16 +1547,16 @@ int qemuCapsExtractVersionInfo(const char *qemu,
                                const char *arch,
                                bool check_yajl,
                                unsigned int *retversion,
-                               virBitmapPtr *retflags)
+                               qemuCapsPtr *retcaps)
 {
     int ret = -1;
     unsigned int version, is_kvm, kvm_version;
-    virBitmapPtr flags = NULL;
+    qemuCapsPtr caps = NULL;
     char *help = NULL;
     virCommandPtr cmd;
 
-    if (retflags)
-        *retflags = NULL;
+    if (retcaps)
+        *retcaps = NULL;
     if (retversion)
         *retversion = 0;
 
@@ -1554,8 +1576,8 @@ int qemuCapsExtractVersionInfo(const char *qemu,
     if (virCommandRun(cmd, NULL) < 0)
         goto cleanup;
 
-    if (!(flags = qemuCapsNew()) ||
-        qemuCapsParseHelpStr(qemu, help, flags,
+    if (!(caps = qemuCapsNew()) ||
+        qemuCapsParseHelpStr(qemu, help, caps,
                              &version, &is_kvm, &kvm_version,
                              check_yajl) == -1)
         goto cleanup;
@@ -1563,26 +1585,26 @@ int qemuCapsExtractVersionInfo(const char *qemu,
     /* 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(caps, QEMU_CAPS_PCI_MULTIBUS);
     }
 
     /* S390 and probably other archs do not support no-acpi -
        maybe the qemu option parsing should be re-thought. */
     if (STRPREFIX(arch, "s390"))
-        qemuCapsClear(flags, QEMU_CAPS_NO_ACPI);
+        qemuCapsClear(caps, QEMU_CAPS_NO_ACPI);
 
-    /* qemuCapsExtractDeviceStr will only set additional flags if qemu
+    /* qemuCapsExtractDeviceStr will only set additional caps if qemu
      * understands the 0.13.0+ notion of "-device driver,".  */
-    if (qemuCapsGet(flags, QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(caps, QEMU_CAPS_DEVICE) &&
         strstr(help, "-device driver,?") &&
-        qemuCapsExtractDeviceStr(qemu, flags) < 0)
+        qemuCapsExtractDeviceStr(qemu, caps) < 0)
         goto cleanup;
 
     if (retversion)
         *retversion = version;
-    if (retflags) {
-        *retflags = flags;
-        flags = NULL;
+    if (retcaps) {
+        *retcaps = caps;
+        caps = NULL;
     }
 
     ret = 0;
@@ -1590,7 +1612,7 @@ int qemuCapsExtractVersionInfo(const char *qemu,
 cleanup:
     VIR_FREE(help);
     virCommandFree(cmd);
-    qemuCapsFree(flags);
+    virObjectUnref(caps);
 
     return ret;
 }
@@ -1644,54 +1666,80 @@ int qemuCapsExtractVersion(virCapsPtr caps,
 }
 
 
-virBitmapPtr
+
+
+qemuCapsPtr
 qemuCapsNew(void)
 {
-    virBitmapPtr caps;
+    qemuCapsPtr caps;
 
-    if (!(caps = virBitmapAlloc(QEMU_CAPS_LAST)))
-        virReportOOMError();
+    if (qemuCapsInitialize() < 0)
+        return NULL;
+
+    if (!(caps = virObjectNew(qemuCapsClass)))
+        return NULL;
+
+    if (!(caps->flags = virBitmapAlloc(QEMU_CAPS_LAST)))
+        goto no_memory;
 
     return caps;
+
+no_memory:
+    virReportOOMError();
+    virObjectUnref(caps);
+    return NULL;
 }
 
 
+void qemuCapsDispose(void *obj)
+{
+    qemuCapsPtr caps = obj;
+
+    virBitmapFree(caps->flags);
+}
+
 void
-qemuCapsSet(virBitmapPtr caps,
+qemuCapsSet(qemuCapsPtr caps,
             enum qemuCapsFlags flag)
 {
-    ignore_value(virBitmapSetBit(caps, flag));
+    ignore_value(virBitmapSetBit(caps->flags, flag));
 }
 
 
 void
-qemuCapsSetList(virBitmapPtr caps, ...)
+qemuCapsSetList(qemuCapsPtr caps, ...)
 {
     va_list list;
     int flag;
 
     va_start(list, caps);
     while ((flag = va_arg(list, int)) < QEMU_CAPS_LAST)
-        ignore_value(virBitmapSetBit(caps, flag));
+        ignore_value(virBitmapSetBit(caps->flags, flag));
     va_end(list);
 }
 
 
 void
-qemuCapsClear(virBitmapPtr caps,
+qemuCapsClear(qemuCapsPtr caps,
               enum qemuCapsFlags flag)
 {
-    ignore_value(virBitmapClearBit(caps, flag));
+    ignore_value(virBitmapClearBit(caps->flags, flag));
+}
+
+
+char *qemuCapsFlagsString(qemuCapsPtr caps)
+{
+    return virBitmapString(caps->flags);
 }
 
 
 bool
-qemuCapsGet(virBitmapPtr caps,
+qemuCapsGet(qemuCapsPtr caps,
             enum qemuCapsFlags flag)
 {
     bool b;
 
-    if (!caps || virBitmapGetBit(caps, flag, &b) < 0)
+    if (!caps || virBitmapGetBit(caps->flags, flag, &b) < 0)
         return false;
     else
         return b;
@@ -1700,14 +1748,14 @@ qemuCapsGet(virBitmapPtr caps,
 
 virCommandPtr
 qemuCapsProbeCommand(const char *qemu,
-                     virBitmapPtr qemuCaps)
+                     qemuCapsPtr caps)
 {
     virCommandPtr cmd = virCommandNew(qemu);
 
-    if (qemuCaps) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG))
+    if (caps) {
+        if (qemuCapsGet(caps, QEMU_CAPS_NO_USER_CONFIG))
             virCommandAddArg(cmd, "-no-user-config");
-        else if (qemuCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG))
+        else if (qemuCapsGet(caps, QEMU_CAPS_NODEFCONFIG))
             virCommandAddArg(cmd, "-nodefconfig");
     }
 
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 49d64e5..1e817c6 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -24,7 +24,7 @@
 #ifndef __QEMU_CAPABILITIES_H__
 # define __QEMU_CAPABILITIES_H__
 
-# include "bitmap.h"
+# include "virobject.h"
 # include "capabilities.h"
 # include "command.h"
 
@@ -145,30 +145,33 @@ enum qemuCapsFlags {
     QEMU_CAPS_LAST,                   /* this must always be the last item */
 };
 
-virBitmapPtr qemuCapsNew(void);
+typedef struct _qemuCaps qemuCaps;
+typedef qemuCaps *qemuCapsPtr;
 
-# define qemuCapsFree(caps)  virBitmapFree(caps)
+qemuCapsPtr qemuCapsNew(void);
 
-void qemuCapsSet(virBitmapPtr caps,
+void qemuCapsSet(qemuCapsPtr caps,
                  enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1);
 
-void qemuCapsSetList(virBitmapPtr caps, ...) ATTRIBUTE_NONNULL(1);
+void qemuCapsSetList(qemuCapsPtr caps, ...) ATTRIBUTE_NONNULL(1);
 
-void qemuCapsClear(virBitmapPtr caps,
+void qemuCapsClear(qemuCapsPtr caps,
                    enum qemuCapsFlags flag) ATTRIBUTE_NONNULL(1);
 
-bool qemuCapsGet(virBitmapPtr caps,
+bool qemuCapsGet(qemuCapsPtr caps,
                  enum qemuCapsFlags flag);
 
+char *qemuCapsFlagsString(qemuCapsPtr caps);
+
 virCapsPtr qemuCapsInit(virCapsPtr old_caps);
 
 int qemuCapsProbeMachineTypes(const char *binary,
-                              virBitmapPtr qemuCaps,
+                              qemuCapsPtr caps,
                               virCapsGuestMachinePtr **machines,
                               int *nmachines);
 
 int qemuCapsProbeCPUModels(const char *qemu,
-                           virBitmapPtr qemuCaps,
+                           qemuCapsPtr caps,
                            const char *arch,
                            unsigned int *count,
                            const char ***cpus);
@@ -179,20 +182,20 @@ int qemuCapsExtractVersionInfo(const char *qemu,
                                const char *arch,
                                bool check_yajl,
                                unsigned int *version,
-                               virBitmapPtr *qemuCaps);
+                               qemuCapsPtr *retcaps);
 
 int qemuCapsParseHelpStr(const char *qemu,
                          const char *str,
-                         virBitmapPtr qemuCaps,
+                         qemuCapsPtr caps,
                          unsigned int *version,
                          unsigned int *is_kvm,
                          unsigned int *kvm_version,
                          bool check_yajl);
 int qemuCapsParseDeviceStr(const char *str,
-                           virBitmapPtr qemuCaps);
+                           qemuCapsPtr caps);
 
 virCommandPtr qemuCapsProbeCommand(const char *qemu,
-                                   virBitmapPtr qemuCaps);
+                                   qemuCapsPtr caps);
 
 VIR_ENUM_DECL(qemuCaps);
 
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index a83d6de..5b4aeda 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -149,14 +149,14 @@ int
 qemuPhysIfaceConnect(virDomainDefPtr def,
                      struct qemud_driver *driver,
                      virDomainNetDefPtr net,
-                     virBitmapPtr qemuCaps,
+                     qemuCapsPtr caps,
                      enum virNetDevVPortProfileOp vmop)
 {
     int rc;
     char *res_ifname = NULL;
     int vnet_hdr = 0;
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_VNET_HDR) &&
+    if (qemuCapsGet(caps, QEMU_CAPS_VNET_HDR) &&
         net->model && STREQ(net->model, "virtio"))
         vnet_hdr = 1;
 
@@ -184,7 +184,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
                         virConnectPtr conn,
                         struct qemud_driver *driver,
                         virDomainNetDefPtr net,
-                        virBitmapPtr qemuCaps)
+                        qemuCapsPtr caps)
 {
     char *brname = NULL;
     int err;
@@ -250,7 +250,7 @@ qemuNetworkIfaceConnect(virDomainDefPtr def,
         template_ifname = true;
     }
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_VNET_HDR) &&
+    if (qemuCapsGet(caps, QEMU_CAPS_VNET_HDR) &&
         net->model && STREQ(net->model, "virtio")) {
         tap_create_flags |= VIR_NETDEV_TAP_CREATE_VNET_HDR;
     }
@@ -302,7 +302,7 @@ cleanup:
 int
 qemuOpenVhostNet(virDomainDefPtr def,
                  virDomainNetDefPtr net,
-                 virBitmapPtr qemuCaps,
+                 qemuCapsPtr caps,
                  int *vhostfd)
 {
     *vhostfd = -1;   /* assume we won't use vhost */
@@ -315,9 +315,9 @@ qemuOpenVhostNet(virDomainDefPtr def,
     /* If qemu doesn't support vhost-net mode (including the -netdev command
      * option), don't try to open the device.
      */
-    if (!(qemuCapsGet(qemuCaps, QEMU_CAPS_VHOST_NET) &&
-          qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
-          qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) {
+    if (!(qemuCapsGet(caps, QEMU_CAPS_VHOST_NET) &&
+          qemuCapsGet(caps, QEMU_CAPS_NETDEV) &&
+          qemuCapsGet(caps, QEMU_CAPS_DEVICE))) {
         if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            "%s", _("vhost-net is not supported with "
@@ -400,11 +400,11 @@ static int qemuAssignDeviceDiskAliasLegacy(virDomainDiskDefPtr disk)
 
 
 char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
-                               virBitmapPtr qemuCaps)
+                               qemuCapsPtr caps)
 {
     char *ret;
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
         if (virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) {
             virReportOOMError();
             return NULL;
@@ -474,13 +474,13 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
 
 static int
 qemuSetScsiControllerModel(virDomainDefPtr def,
-                           virBitmapPtr qemuCaps,
+                           qemuCapsPtr caps,
                            int *model)
 {
     if (*model > 0) {
         switch (*model) {
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC:
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_SCSI_LSI)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("This QEMU doesn't support "
                                  "lsi scsi controller"));
@@ -488,7 +488,7 @@ qemuSetScsiControllerModel(virDomainDefPtr def,
             }
             break;
         case VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI:
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_SCSI_PCI)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_VIRTIO_SCSI_PCI)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("This QEMU doesn't support "
                                  "virtio scsi controller"));
@@ -508,7 +508,7 @@ qemuSetScsiControllerModel(virDomainDefPtr def,
         if (STREQ(def->os.arch, "ppc64") &&
             STREQ(def->os.machine, "pseries")) {
             *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_IBMVSCSI;
-        } else if (qemuCapsGet(qemuCaps, QEMU_CAPS_SCSI_LSI)) {
+        } else if (qemuCapsGet(caps, QEMU_CAPS_SCSI_LSI)) {
             *model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
         } else {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -524,7 +524,7 @@ qemuSetScsiControllerModel(virDomainDefPtr def,
 static int
 qemuAssignDeviceDiskAliasCustom(virDomainDefPtr def,
                                 virDomainDiskDefPtr disk,
-                                virBitmapPtr qemuCaps)
+                                qemuCapsPtr caps)
 {
     const char *prefix = virDomainDiskBusTypeToString(disk->bus);
     int controllerModel = -1;
@@ -535,7 +535,7 @@ qemuAssignDeviceDiskAliasCustom(virDomainDefPtr def,
                 virDomainDiskFindControllerModel(def, disk,
                                                  VIR_DOMAIN_CONTROLLER_TYPE_SCSI);
 
-            if ((qemuSetScsiControllerModel(def, qemuCaps, &controllerModel)) < 0)
+            if ((qemuSetScsiControllerModel(def, caps, &controllerModel)) < 0)
                 return -1;
         }
 
@@ -571,11 +571,11 @@ no_memory:
 int
 qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef,
                           virDomainDiskDefPtr def,
-                          virBitmapPtr qemuCaps)
+                          qemuCapsPtr caps)
 {
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE)) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
-            return qemuAssignDeviceDiskAliasCustom(vmdef, def, qemuCaps);
+    if (qemuCapsGet(caps, QEMU_CAPS_DRIVE)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_DEVICE))
+            return qemuAssignDeviceDiskAliasCustom(vmdef, def, caps);
         else
             return qemuAssignDeviceDiskAliasFixed(def);
     } else {
@@ -686,16 +686,16 @@ qemuAssignDeviceControllerAlias(virDomainControllerDefPtr controller)
 
 
 int
-qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps)
+qemuAssignDeviceAliases(virDomainDefPtr def, qemuCapsPtr caps)
 {
     int i;
 
     for (i = 0; i < def->ndisks ; i++) {
-        if (qemuAssignDeviceDiskAlias(def, def->disks[i], qemuCaps) < 0)
+        if (qemuAssignDeviceDiskAlias(def, def->disks[i], caps) < 0)
             return -1;
     }
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_NET_NAME) ||
-        qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_NET_NAME) ||
+        qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
         for (i = 0; i < def->nnets ; i++) {
             /* type='hostdev' interfaces are also on the hostdevs list,
              * and will have their alias assigned with other hostdevs.
@@ -707,7 +707,7 @@ qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps)
         }
     }
 
-    if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
+    if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE))
         return 0;
 
     for (i = 0; i < def->nfss ; i++) {
@@ -811,21 +811,21 @@ qemuDomainPrimeS390VirtioDevices(virDomainDefPtr def,
 }
 
 static int
-qemuDomainAssignS390Addresses(virDomainDefPtr def, virBitmapPtr qemuCaps)
+qemuDomainAssignS390Addresses(virDomainDefPtr def, qemuCapsPtr caps)
 {
     int ret = -1;
-    virBitmapPtr localCaps = NULL;
+    qemuCapsPtr localCaps = NULL;
 
-    if (!qemuCaps) {
+    if (!caps) {
         /* need to get information from real environment */
         if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
                                        false, NULL,
                                        &localCaps) < 0)
             goto cleanup;
-        qemuCaps = localCaps;
+        caps = localCaps;
     }
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_S390)) {
         /* deal with legacy virtio-s390 */
         qemuDomainPrimeS390VirtioDevices(
             def, VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390);
@@ -834,7 +834,7 @@ qemuDomainAssignS390Addresses(virDomainDefPtr def, virBitmapPtr qemuCaps)
     ret = 0;
 
 cleanup:
-    qemuCapsFree(localCaps);
+    virObjectUnref(localCaps);
 
     return ret;
 }
@@ -893,21 +893,21 @@ qemuAssignSpaprVIOAddress(virDomainDefPtr def, virDomainDeviceInfoPtr info,
 }
 
 int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
-                                      virBitmapPtr qemuCaps)
+                                      qemuCapsPtr caps)
 {
     int i, rc = -1;
     int model;
-    virBitmapPtr localCaps = NULL;
+    qemuCapsPtr localCaps = NULL;
 
     /* Default values match QEMU. See spapr_(llan|vscsi|vty).c */
 
-    if (!qemuCaps) {
+    if (!caps) {
         /* need to get information from real environment */
         if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
                                        false, NULL,
                                        &localCaps) < 0)
             goto cleanup;
-        qemuCaps = localCaps;
+        caps = localCaps;
     }
 
     for (i = 0 ; i < def->nnets; i++) {
@@ -923,7 +923,7 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
     for (i = 0 ; i < def->ncontrollers; i++) {
         model = def->controllers[i]->model;
         if (def->controllers[i]->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
-            rc = qemuSetScsiControllerModel(def, qemuCaps, &model);
+            rc = qemuSetScsiControllerModel(def, caps, &model);
             if (rc)
                 goto cleanup;
         }
@@ -954,7 +954,7 @@ int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
     rc = 0;
 
 cleanup:
-    qemuCapsFree(localCaps);
+    virObjectUnref(localCaps);
     return rc;
 }
 
@@ -1065,25 +1065,25 @@ cleanup:
 
 int
 qemuDomainAssignPCIAddresses(virDomainDefPtr def,
-                             virBitmapPtr qemuCaps,
+                             qemuCapsPtr caps,
                              virDomainObjPtr obj)
 {
     int ret = -1;
-    virBitmapPtr localCaps = NULL;
+    qemuCapsPtr localCaps = NULL;
     qemuDomainPCIAddressSetPtr addrs = NULL;
     qemuDomainObjPrivatePtr priv = NULL;
 
-    if (!qemuCaps) {
+    if (!caps) {
         /* need to get information from real environment */
         if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
                                        false,
                                        NULL,
                                        &localCaps) < 0)
             goto cleanup;
-        qemuCaps = localCaps;
+        caps = localCaps;
     }
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
         if (!(addrs = qemuDomainPCIAddressSetCreate(def)))
             goto cleanup;
 
@@ -1107,27 +1107,27 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def,
     ret = 0;
 
 cleanup:
-    qemuCapsFree(localCaps);
+    virObjectUnref(localCaps);
     qemuDomainPCIAddressSetFree(addrs);
 
     return ret;
 }
 
 int qemuDomainAssignAddresses(virDomainDefPtr def,
-                              virBitmapPtr qemuCaps,
+                              qemuCapsPtr caps,
                               virDomainObjPtr obj)
 {
     int rc;
 
-    rc = qemuDomainAssignSpaprVIOAddresses(def, qemuCaps);
+    rc = qemuDomainAssignSpaprVIOAddresses(def, caps);
     if (rc)
         return rc;
 
-    rc = qemuDomainAssignS390Addresses(def, qemuCaps);
+    rc = qemuDomainAssignS390Addresses(def, caps);
     if (rc)
         return rc;
 
-    return qemuDomainAssignPCIAddresses(def, qemuCaps, obj);
+    return qemuDomainAssignPCIAddresses(def, caps, obj);
 }
 
 static void
@@ -1756,7 +1756,7 @@ qemuUsbId(virBufferPtr buf, int idx)
 static int
 qemuBuildDeviceAddressStr(virBufferPtr buf,
                           virDomainDeviceInfoPtr info,
-                          virBitmapPtr qemuCaps)
+                          qemuCapsPtr caps)
 {
     if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
         if (info->addr.pci.domain != 0) {
@@ -1769,7 +1769,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
                            _("Only PCI device addresses with bus=0 are supported"));
             return -1;
         }
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIFUNCTION)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_PCI_MULTIFUNCTION)) {
             if (info->addr.pci.function > 7) {
                 virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                                _("The function of PCI device addresses must "
@@ -1797,7 +1797,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
          * When QEMU grows support for > 1 PCI domain, then pci.0 change
          * to pciNN.0  where NN is the domain number
          */
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_MULTIBUS))
+        if (qemuCapsGet(caps, QEMU_CAPS_PCI_MULTIBUS))
             virBufferAsprintf(buf, ",bus=pci.0");
         else
             virBufferAsprintf(buf, ",bus=pci");
@@ -1823,7 +1823,7 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
 static int
 qemuBuildRomStr(virBufferPtr buf,
                 virDomainDeviceInfoPtr info,
-                virBitmapPtr qemuCaps)
+                qemuCapsPtr caps)
 {
     if (info->rombar || info->romfile) {
         if (info->type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
@@ -1831,7 +1831,7 @@ qemuBuildRomStr(virBufferPtr buf,
                            "%s", _("rombar and romfile are supported only for PCI devices"));
             return -1;
         }
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_ROMBAR)) {
+        if (!qemuCapsGet(caps, QEMU_CAPS_PCI_ROMBAR)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            "%s", _("rombar and romfile not supported in this QEMU binary"));
             return -1;
@@ -1856,9 +1856,9 @@ qemuBuildRomStr(virBufferPtr buf,
 static int
 qemuBuildIoEventFdStr(virBufferPtr buf,
                       enum virDomainIoEventFd use,
-                      virBitmapPtr qemuCaps)
+                      qemuCapsPtr caps)
 {
-    if (use && qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_IOEVENTFD))
+    if (use && qemuCapsGet(caps, QEMU_CAPS_VIRTIO_IOEVENTFD))
         virBufferAsprintf(buf, ",ioeventfd=%s",
                           virDomainIoEventFdTypeToString(use));
     return 0;
@@ -2073,7 +2073,7 @@ char *
 qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
                   virDomainDiskDefPtr disk,
                   bool bootable,
-                  virBitmapPtr qemuCaps)
+                  qemuCapsPtr caps)
 {
     virBuffer opt = VIR_BUFFER_INITIALIZER;
     const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
@@ -2152,7 +2152,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
         break;
 
     case VIR_DOMAIN_DISK_BUS_VIRTIO:
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_S390) &&
+        if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_S390) &&
             (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_VIRTIO_S390)) {
             /* Paranoia - leave in here for now */
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
@@ -2233,24 +2233,24 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
             virBufferEscape(&opt, ',', ",", "file=%s,", disk->src);
         }
     }
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
+    if (qemuCapsGet(caps, QEMU_CAPS_DEVICE))
         virBufferAddLit(&opt, "if=none");
     else
         virBufferAsprintf(&opt, "if=%s", bus);
 
     if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM) {
         if ((disk->bus == VIR_DOMAIN_DISK_BUS_SCSI)) {
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SCSI_CD))
+            if (!qemuCapsGet(caps, QEMU_CAPS_SCSI_CD))
                 virBufferAddLit(&opt, ",media=cdrom");
         } else if (disk->bus == VIR_DOMAIN_DISK_BUS_IDE) {
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_IDE_CD))
+            if (!qemuCapsGet(caps, QEMU_CAPS_IDE_CD))
                 virBufferAddLit(&opt, ",media=cdrom");
         } else {
             virBufferAddLit(&opt, ",media=cdrom");
         }
     }
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
         virBufferAsprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
     } else {
         if (busid == -1 && unitid == -1) {
@@ -2264,13 +2264,13 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
         }
     }
     if (bootable &&
-        qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) &&
+        qemuCapsGet(caps, QEMU_CAPS_DRIVE_BOOT) &&
         (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK ||
          disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) &&
         disk->bus != VIR_DOMAIN_DISK_BUS_IDE)
         virBufferAddLit(&opt, ",boot=on");
     if (disk->readonly &&
-        qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_READONLY))
+        qemuCapsGet(caps, QEMU_CAPS_DRIVE_READONLY))
         virBufferAddLit(&opt, ",readonly=on");
     if (disk->transient) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -2279,7 +2279,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
     }
     if (disk->driverType && *disk->driverType != '\0' &&
         disk->type != VIR_DOMAIN_DISK_TYPE_DIR &&
-        qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_FORMAT))
+        qemuCapsGet(caps, QEMU_CAPS_DRIVE_FORMAT))
         virBufferAsprintf(&opt, ",format=%s", disk->driverType);
 
     /* generate geometry command string */
@@ -2297,7 +2297,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
     }
 
     if (disk->serial &&
-        qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_SERIAL)) {
+        qemuCapsGet(caps, QEMU_CAPS_DRIVE_SERIAL)) {
         if (qemuSafeSerialParamValue(disk->serial) < 0)
             goto error;
         virBufferAsprintf(&opt, ",serial=%s", disk->serial);
@@ -2306,17 +2306,17 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
     if (disk->cachemode) {
         const char *mode = NULL;
 
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_V2)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_DRIVE_CACHE_V2)) {
             mode = qemuDiskCacheV2TypeToString(disk->cachemode);
 
             if (disk->cachemode == VIR_DOMAIN_DISK_CACHE_DIRECTSYNC &&
-                !qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC)) {
+                !qemuCapsGet(caps, QEMU_CAPS_DRIVE_CACHE_DIRECTSYNC)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("disk cache mode 'directsync' is not "
                                  "supported by this QEMU"));
                 goto error;
             } else if (disk->cachemode == VIR_DOMAIN_DISK_CACHE_UNSAFE &&
-                !qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_CACHE_UNSAFE)) {
+                !qemuCapsGet(caps, QEMU_CAPS_DRIVE_CACHE_UNSAFE)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("disk cache mode 'unsafe' is not "
                                  "supported by this QEMU"));
@@ -2332,7 +2332,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
     }
 
     if (disk->copy_on_read) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_COPY_ON_READ)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_DRIVE_COPY_ON_READ)) {
             virBufferAsprintf(&opt, ",copy-on-read=%s",
                               virDomainDiskCopyOnReadTypeToString(disk->copy_on_read));
         } else {
@@ -2342,7 +2342,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
         }
     }
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_MONITOR_JSON)) {
         const char *wpolicy = NULL, *rpolicy = NULL;
 
         if (disk->error_policy)
@@ -2368,7 +2368,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
     }
 
     if (disk->iomode) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_AIO)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_DRIVE_AIO)) {
             virBufferAsprintf(&opt, ",aio=%s",
                               virDomainDiskIoTypeToString(disk->iomode));
         } else {
@@ -2386,7 +2386,7 @@ qemuBuildDriveStr(virConnectPtr conn ATTRIBUTE_UNUSED,
          disk->blkdeviotune.total_iops_sec ||
          disk->blkdeviotune.read_iops_sec ||
          disk->blkdeviotune.write_iops_sec) &&
-        !qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) {
+        !qemuCapsGet(caps, QEMU_CAPS_DRIVE_IOTUNE)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("block I/O throttling not supported with this "
                          "QEMU binary"));
@@ -2439,7 +2439,7 @@ char *
 qemuBuildDriveDevStr(virDomainDefPtr def,
                      virDomainDiskDefPtr disk,
                      int bootindex,
-                     virBitmapPtr qemuCaps)
+                     qemuCapsPtr caps)
 {
     virBuffer opt = VIR_BUFFER_INITIALIZER;
     const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
@@ -2469,7 +2469,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
                            virDomainDiskTypeToString(disk->type));
             goto error;
         }
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SG_IO)) {
+        if (!qemuCapsGet(caps, QEMU_CAPS_VIRTIO_BLK_SG_IO)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("disk device='lun' is not supported by this QEMU"));
             goto error;
@@ -2484,7 +2484,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
             goto error;
         }
 
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_IDE_CD)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_IDE_CD)) {
             if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
                 virBufferAddLit(&opt, "ide-cd");
             else
@@ -2499,7 +2499,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
         break;
     case VIR_DOMAIN_DISK_BUS_SCSI:
         if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SCSI_BLOCK)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_SCSI_BLOCK)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("This QEMU doesn't support scsi-block for "
                                  "lun passthrough"));
@@ -2510,7 +2510,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
         controllerModel =
             virDomainDiskFindControllerModel(def, disk,
                                              VIR_DOMAIN_CONTROLLER_TYPE_SCSI);
-        if ((qemuSetScsiControllerModel(def, qemuCaps, &controllerModel)) < 0)
+        if ((qemuSetScsiControllerModel(def, caps, &controllerModel)) < 0)
             goto error;
 
         if (controllerModel == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC) {
@@ -2524,7 +2524,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
             if (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN) {
                 virBufferAddLit(&opt, "scsi-block");
             } else {
-                if (qemuCapsGet(qemuCaps, QEMU_CAPS_SCSI_CD)) {
+                if (qemuCapsGet(caps, QEMU_CAPS_SCSI_CD)) {
                     if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
                         virBufferAddLit(&opt, "scsi-cd");
                     else
@@ -2539,7 +2539,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
                               disk->info.addr.drive.bus,
                               disk->info.addr.drive.unit);
         } else {
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SCSI_DISK_CHANNEL)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_SCSI_DISK_CHANNEL)) {
                 if (disk->info.addr.drive.target > 7) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("This QEMU doesn't support target "
@@ -2557,7 +2557,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
             }
 
             if (disk->device != VIR_DOMAIN_DISK_DEVICE_LUN) {
-                if (qemuCapsGet(qemuCaps, QEMU_CAPS_SCSI_CD)) {
+                if (qemuCapsGet(caps, QEMU_CAPS_SCSI_CD)) {
                     if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
                         virBufferAddLit(&opt, "scsi-cd");
                     else
@@ -2588,7 +2588,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
             goto error;
         }
 
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_IDE_CD)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_IDE_CD)) {
             if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
                 virBufferAddLit(&opt, "ide-cd");
             else
@@ -2608,13 +2608,13 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
         } else {
             virBufferAddLit(&opt, "virtio-blk-pci");
         }
-        qemuBuildIoEventFdStr(&opt, disk->ioeventfd, qemuCaps);
+        qemuBuildIoEventFdStr(&opt, disk->ioeventfd, caps);
         if (disk->event_idx &&
-            qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX)) {
+            qemuCapsGet(caps, QEMU_CAPS_VIRTIO_BLK_EVENT_IDX)) {
             virBufferAsprintf(&opt, ",event_idx=%s",
                               virDomainVirtioEventIdxTypeToString(disk->event_idx));
         }
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_BLK_SCSI)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_BLK_SCSI)) {
             /* if sg_io is true but the scsi option isn't supported,
              * that means it's just always on in this version of qemu.
              */
@@ -2622,7 +2622,7 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
                               (disk->device == VIR_DOMAIN_DISK_DEVICE_LUN)
                               ? "on" : "off");
         }
-        if (qemuBuildDeviceAddressStr(&opt, &disk->info, qemuCaps) < 0)
+        if (qemuBuildDeviceAddressStr(&opt, &disk->info, caps) < 0)
             goto error;
         break;
     case VIR_DOMAIN_DISK_BUS_USB:
@@ -2635,9 +2635,9 @@ qemuBuildDriveDevStr(virDomainDefPtr def,
     }
     virBufferAsprintf(&opt, ",drive=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
     virBufferAsprintf(&opt, ",id=%s", disk->info.alias);
-    if (bootindex && qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX))
+    if (bootindex && qemuCapsGet(caps, QEMU_CAPS_BOOTINDEX))
         virBufferAsprintf(&opt, ",bootindex=%d", bootindex);
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_BLOCKIO)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_BLOCKIO)) {
         if (disk->blockio.logical_block_size > 0)
             virBufferAsprintf(&opt, ",logical_block_size=%u",
                               disk->blockio.logical_block_size);
@@ -2660,7 +2660,7 @@ error:
 
 
 char *qemuBuildFSStr(virDomainFSDefPtr fs,
-                     virBitmapPtr qemuCaps ATTRIBUTE_UNUSED)
+                     qemuCapsPtr caps ATTRIBUTE_UNUSED)
 {
     virBuffer opt = VIR_BUFFER_INITIALIZER;
     const char *driver = qemuDomainFSDriverTypeToString(fs->fsdriver);
@@ -2699,7 +2699,7 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs,
     }
 
     if (fs->wrpolicy) {
-       if (qemuCapsGet(qemuCaps, QEMU_CAPS_FSDEV_WRITEOUT)) {
+       if (qemuCapsGet(caps, QEMU_CAPS_FSDEV_WRITEOUT)) {
            virBufferAsprintf(&opt, ",writeout=%s", wrpolicy);
        } else {
            virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -2712,7 +2712,7 @@ char *qemuBuildFSStr(virDomainFSDefPtr fs,
     virBufferAsprintf(&opt, ",path=%s", fs->src);
 
     if (fs->readonly) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_FSDEV_READONLY)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_FSDEV_READONLY)) {
             virBufferAddLit(&opt, ",readonly");
         } else {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -2737,7 +2737,7 @@ error:
 
 char *
 qemuBuildFSDevStr(virDomainFSDefPtr fs,
-                  virBitmapPtr qemuCaps)
+                  qemuCapsPtr caps)
 {
     virBuffer opt = VIR_BUFFER_INITIALIZER;
 
@@ -2752,7 +2752,7 @@ qemuBuildFSDevStr(virDomainFSDefPtr fs,
     virBufferAsprintf(&opt, ",fsdev=%s%s", QEMU_FSDEV_HOST_PREFIX, fs->info.alias);
     virBufferAsprintf(&opt, ",mount_tag=%s", fs->dst);
 
-    if (qemuBuildDeviceAddressStr(&opt, &fs->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&opt, &fs->info, caps) < 0)
         goto error;
 
     if (virBufferError(&opt)) {
@@ -2798,11 +2798,11 @@ qemuControllerModelUSBToCaps(int model)
 static int
 qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef,
                              virDomainControllerDefPtr def,
-                             virBitmapPtr qemuCaps,
+                             qemuCapsPtr caps,
                              virBuffer *buf)
 {
     const char *smodel;
-    int model, caps;
+    int model, flags;
 
     model = def->model;
 
@@ -2814,9 +2814,9 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef,
     }
 
     smodel = qemuControllerModelUSBTypeToString(model);
-    caps = qemuControllerModelUSBToCaps(model);
+    flags = qemuControllerModelUSBToCaps(model);
 
-    if (caps == -1 || !qemuCapsGet(qemuCaps, caps)) {
+    if (flags == -1 || !qemuCapsGet(caps, flags)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("%s not supported in this QEMU binary"), smodel);
         return -1;
@@ -2839,7 +2839,7 @@ qemuBuildUSBControllerDevStr(virDomainDefPtr domainDef,
 char *
 qemuBuildControllerDevStr(virDomainDefPtr domainDef,
                           virDomainControllerDefPtr def,
-                          virBitmapPtr qemuCaps,
+                          qemuCapsPtr caps,
                           int *nusbcontroller)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
@@ -2848,7 +2848,7 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
     switch (def->type) {
     case VIR_DOMAIN_CONTROLLER_TYPE_SCSI:
         model = def->model;
-        if ((qemuSetScsiControllerModel(domainDef, qemuCaps, &model)) < 0)
+        if ((qemuSetScsiControllerModel(domainDef, caps, &model)) < 0)
             return NULL;
 
         switch (model) {
@@ -2899,7 +2899,7 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
         break;
 
     case VIR_DOMAIN_CONTROLLER_TYPE_USB:
-        if (qemuBuildUSBControllerDevStr(domainDef, def, qemuCaps, &buf) == -1)
+        if (qemuBuildUSBControllerDevStr(domainDef, def, caps, &buf) == -1)
             goto error;
 
         if (nusbcontroller)
@@ -2916,7 +2916,7 @@ qemuBuildControllerDevStr(virDomainDefPtr domainDef,
         goto error;
     }
 
-    if (qemuBuildDeviceAddressStr(&buf, &def->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, &def->info, caps) < 0)
         goto error;
 
     if (virBufferError(&buf)) {
@@ -2961,7 +2961,7 @@ char *
 qemuBuildNicDevStr(virDomainNetDefPtr net,
                    int vlan,
                    int bootindex,
-                   virBitmapPtr qemuCaps)
+                   qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     const char *nic;
@@ -2983,7 +2983,7 @@ qemuBuildNicDevStr(virDomainNetDefPtr net,
 
     virBufferAdd(&buf, nic, strlen(nic));
     if (usingVirtio && net->driver.virtio.txmode) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_TX_ALG)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_VIRTIO_TX_ALG)) {
             virBufferAddLit(&buf, ",tx=");
             switch (net->driver.virtio.txmode) {
                 case VIR_DOMAIN_NET_VIRTIO_TX_MODE_IOTHREAD:
@@ -3008,9 +3008,9 @@ qemuBuildNicDevStr(virDomainNetDefPtr net,
         }
     }
     if (usingVirtio) {
-        qemuBuildIoEventFdStr(&buf, net->driver.virtio.ioeventfd, qemuCaps);
+        qemuBuildIoEventFdStr(&buf, net->driver.virtio.ioeventfd, caps);
         if (net->driver.virtio.event_idx &&
-            qemuCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_NET_EVENT_IDX)) {
+            qemuCapsGet(caps, QEMU_CAPS_VIRTIO_NET_EVENT_IDX)) {
             virBufferAsprintf(&buf, ",event_idx=%s",
                               virDomainVirtioEventIdxTypeToString(net->driver.virtio.event_idx));
         }
@@ -3024,11 +3024,11 @@ qemuBuildNicDevStr(virDomainNetDefPtr net,
                       net->mac.addr[0], net->mac.addr[1],
                       net->mac.addr[2], net->mac.addr[3],
                       net->mac.addr[4], net->mac.addr[5]);
-    if (qemuBuildDeviceAddressStr(&buf, &net->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, &net->info, caps) < 0)
         goto error;
-    if (qemuBuildRomStr(&buf, &net->info, qemuCaps) < 0)
+    if (qemuBuildRomStr(&buf, &net->info, caps) < 0)
        goto error;
-    if (bootindex && qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX))
+    if (bootindex && qemuCapsGet(caps, QEMU_CAPS_BOOTINDEX))
         virBufferAsprintf(&buf, ",bootindex=%d", bootindex);
 
     if (virBufferError(&buf)) {
@@ -3047,7 +3047,7 @@ error:
 char *
 qemuBuildHostNetStr(virDomainNetDefPtr net,
                     struct qemud_driver *driver,
-                    virBitmapPtr qemuCaps,
+                    qemuCapsPtr caps,
                     char type_sep,
                     int vlan,
                     const char *tapfd,
@@ -3073,7 +3073,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
      */
     case VIR_DOMAIN_NET_TYPE_BRIDGE:
         if (!driver->privileged &&
-            qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE)) {
+            qemuCapsGet(caps, QEMU_CAPS_NETDEV_BRIDGE)) {
             brname = virDomainNetGetActualBridgeName(net);
             virBufferAsprintf(&buf, "bridge%cbr=%s", type_sep, brname);
             type_sep = ',';
@@ -3160,7 +3160,7 @@ qemuBuildHostNetStr(virDomainNetDefPtr net,
 
 char *
 qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev,
-                        virBitmapPtr qemuCaps)
+                        qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
@@ -3172,7 +3172,7 @@ qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev,
     }
 
     virBufferAsprintf(&buf, "%s,id=%s", model, dev->info.alias);
-    if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0)
         goto error;
 
     if (virBufferError(&buf)) {
@@ -3190,13 +3190,13 @@ error:
 
 char *
 qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev,
-                          virBitmapPtr qemuCaps)
+                          qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
     virBufferAddLit(&buf, "virtio-balloon-pci");
     virBufferAsprintf(&buf, ",id=%s", dev->info.alias);
-    if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0)
         goto error;
 
     if (virBufferError(&buf)) {
@@ -3214,7 +3214,7 @@ error:
 
 char *
 qemuBuildUSBInputDevStr(virDomainInputDefPtr dev,
-                        virBitmapPtr qemuCaps)
+                        qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
@@ -3222,7 +3222,7 @@ qemuBuildUSBInputDevStr(virDomainInputDefPtr dev,
                       dev->type == VIR_DOMAIN_INPUT_TYPE_MOUSE ?
                       "usb-mouse" : "usb-tablet", dev->info.alias);
 
-    if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0)
         goto error;
 
     if (virBufferError(&buf)) {
@@ -3240,7 +3240,7 @@ error:
 
 char *
 qemuBuildSoundDevStr(virDomainSoundDefPtr sound,
-                     virBitmapPtr qemuCaps)
+                     qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     const char *model = virDomainSoundModelTypeToString(sound->model);
@@ -3260,7 +3260,7 @@ qemuBuildSoundDevStr(virDomainSoundDefPtr sound,
         model = "intel-hda";
 
     virBufferAsprintf(&buf, "%s,id=%s", model, sound->info.alias);
-    if (qemuBuildDeviceAddressStr(&buf, &sound->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, &sound->info, caps) < 0)
         goto error;
 
     if (virBufferError(&buf)) {
@@ -3293,17 +3293,17 @@ qemuSoundCodecTypeToCaps(int type)
 static char *
 qemuBuildSoundCodecStr(virDomainSoundDefPtr sound,
                        virDomainSoundCodecDefPtr codec,
-                       virBitmapPtr qemuCaps)
+                       qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     const char *stype;
-    int type, caps;
+    int type, flags;
 
     type = codec->type;
     stype = qemuSoundCodecTypeToString(type);
-    caps = qemuSoundCodecTypeToCaps(type);
+    flags = qemuSoundCodecTypeToCaps(type);
 
-    if (caps == -1 || !qemuCapsGet(qemuCaps, caps)) {
+    if (flags == -1 || !qemuCapsGet(caps, flags)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                        _("%s not supported in this QEMU binary"), stype);
         goto error;
@@ -3321,7 +3321,7 @@ error:
 
 static char *
 qemuBuildVideoDevStr(virDomainVideoDefPtr video,
-                     virBitmapPtr qemuCaps)
+                     qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     const char *model = qemuVideoTypeToString(video->type);
@@ -3346,7 +3346,7 @@ qemuBuildVideoDevStr(virDomainVideoDefPtr video,
         virBufferAsprintf(&buf, ",vram_size=%u", video->vram * 1024);
     }
 
-    if (qemuBuildDeviceAddressStr(&buf, &video->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, &video->info, caps) < 0)
         goto error;
 
     if (virBufferError(&buf)) {
@@ -3389,7 +3389,7 @@ qemuOpenPCIConfig(virDomainHostdevDefPtr dev)
 
 char *
 qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd,
-                          virBitmapPtr qemuCaps)
+                          qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
@@ -3403,9 +3403,9 @@ qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev, const char *configfd,
         virBufferAsprintf(&buf, ",configfd=%s", configfd);
     if (dev->info->bootIndex)
         virBufferAsprintf(&buf, ",bootindex=%d", dev->info->bootIndex);
-    if (qemuBuildDeviceAddressStr(&buf, dev->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, dev->info, caps) < 0)
         goto error;
-    if (qemuBuildRomStr(&buf, dev->info, qemuCaps) < 0)
+    if (qemuBuildRomStr(&buf, dev->info, caps) < 0)
        goto error;
 
     if (virBufferError(&buf)) {
@@ -3438,7 +3438,7 @@ qemuBuildPCIHostdevPCIDevStr(virDomainHostdevDefPtr dev)
 
 char *
 qemuBuildRedirdevDevStr(virDomainRedirdevDefPtr dev,
-                        virBitmapPtr qemuCaps)
+                        qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
@@ -3449,7 +3449,7 @@ qemuBuildRedirdevDevStr(virDomainRedirdevDefPtr dev,
         goto error;
     }
 
-    if (!qemuCapsGet(qemuCaps, QEMU_CAPS_USB_REDIR)) {
+    if (!qemuCapsGet(caps, QEMU_CAPS_USB_REDIR)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("USB redirection is not supported "
                          "by this version of QEMU"));
@@ -3460,7 +3460,7 @@ qemuBuildRedirdevDevStr(virDomainRedirdevDefPtr dev,
                       dev->info.alias,
                       dev->info.alias);
 
-    if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0)
         goto error;
 
     if (virBufferError(&buf)) {
@@ -3477,7 +3477,7 @@ error:
 
 char *
 qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev,
-                          virBitmapPtr qemuCaps)
+                          qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
@@ -3493,7 +3493,7 @@ qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev,
                       dev->source.subsys.u.usb.device,
                       dev->info->alias);
 
-    if (qemuBuildDeviceAddressStr(&buf, dev->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, dev->info, caps) < 0)
         goto error;
 
     if (virBufferError(&buf)) {
@@ -3511,7 +3511,7 @@ error:
 
 char *
 qemuBuildHubDevStr(virDomainHubDefPtr dev,
-                   virBitmapPtr qemuCaps)
+                   qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
@@ -3522,7 +3522,7 @@ qemuBuildHubDevStr(virDomainHubDefPtr dev,
         goto error;
     }
 
-    if (!qemuCapsGet(qemuCaps, QEMU_CAPS_USB_HUB)) {
+    if (!qemuCapsGet(caps, QEMU_CAPS_USB_HUB)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("usb-hub not supported by QEMU binary"));
         goto error;
@@ -3530,7 +3530,7 @@ qemuBuildHubDevStr(virDomainHubDefPtr dev,
 
     virBufferAddLit(&buf, "usb-hub");
     virBufferAsprintf(&buf, ",id=%s", dev->info.alias);
-    if (qemuBuildDeviceAddressStr(&buf, &dev->info, qemuCaps) < 0)
+    if (qemuBuildDeviceAddressStr(&buf, &dev->info, caps) < 0)
         goto error;
 
     if (virBufferError(&buf)) {
@@ -3572,7 +3572,7 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev)
  * host side of the character device */
 static char *
 qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias,
-                       virBitmapPtr qemuCaps)
+                       qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     bool telnet;
@@ -3651,7 +3651,7 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias,
         break;
 
     case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV_SPICEVMC)) {
+        if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV_SPICEVMC)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("spicevmc not supported in this QEMU binary"));
             goto error;
@@ -3772,7 +3772,7 @@ error:
 
 static char *
 qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev,
-                                virBitmapPtr qemuCaps)
+                                qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     switch (dev->deviceType) {
@@ -3782,7 +3782,7 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev,
     case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL:
         /* Legacy syntax  '-device spicevmc' */
         if (dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC &&
-            qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC)) {
+            qemuCapsGet(caps, QEMU_CAPS_DEVICE_SPICEVMC)) {
             virBufferAddLit(&buf, "spicevmc");
         } else {
             virBufferAddLit(&buf, "virtserialport");
@@ -3825,7 +3825,7 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev,
 
     if (!(dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL &&
           dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC &&
-          qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC))) {
+          qemuCapsGet(caps, QEMU_CAPS_DEVICE_SPICEVMC))) {
         virBufferAsprintf(&buf, ",chardev=char%s,id=%s",
                           dev->info.alias, dev->info.alias);
         if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL) {
@@ -4031,7 +4031,7 @@ static int
 qemuBuildCpuArgStr(const struct qemud_driver *driver,
                    const virDomainDefPtr def,
                    const char *emulator,
-                   virBitmapPtr qemuCaps,
+                   qemuCapsPtr caps,
                    const struct utsname *ut,
                    char **opt,
                    bool *hasHwVirt,
@@ -4064,7 +4064,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
         int hasSVM;
 
         if (host &&
-            qemuCapsProbeCPUModels(emulator, qemuCaps, host->arch,
+            qemuCapsProbeCPUModels(emulator, caps, host->arch,
                                    &ncpus, &cpus) < 0)
             goto cleanup;
 
@@ -4111,7 +4111,7 @@ qemuBuildCpuArgStr(const struct qemud_driver *driver,
 
         if (cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH) {
             const char *mode = virCPUModeTypeToString(cpu->mode);
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CPU_HOST)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_CPU_HOST)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                _("CPU mode '%s' is not supported by QEMU"
                                  " binary"), mode);
@@ -4221,13 +4221,13 @@ no_memory:
 
 static char *
 qemuBuildSmpArgStr(const virDomainDefPtr def,
-                   virBitmapPtr qemuCaps)
+                   qemuCapsPtr caps)
 {
     virBuffer buf = VIR_BUFFER_INITIALIZER;
 
     virBufferAsprintf(&buf, "%u", def->vcpus);
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_SMP_TOPOLOGY)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_SMP_TOPOLOGY)) {
         if (def->vcpus != def->maxvcpus)
             virBufferAsprintf(&buf, ",maxcpus=%u", def->maxvcpus);
         /* sockets, cores, and threads are either all zero
@@ -4335,7 +4335,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                      virDomainDefPtr def,
                      virDomainChrSourceDefPtr monitor_chr,
                      bool monitor_json,
-                     virBitmapPtr qemuCaps,
+                     qemuCapsPtr caps,
                      const char *migrateFrom,
                      int migrateFd,
                      virDomainSnapshotObjPtr snapshot,
@@ -4367,25 +4367,25 @@ qemuBuildCommandLine(virConnectPtr conn,
      * do not use boot=on for drives when not using KVM since this
      * is not supported at all in upstream QEmu.
      */
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_KVM) &&
+    if (qemuCapsGet(caps, QEMU_CAPS_KVM) &&
         (def->virtType == VIR_DOMAIN_VIRT_QEMU))
-        qemuCapsClear(qemuCaps, QEMU_CAPS_DRIVE_BOOT);
+        qemuCapsClear(caps, QEMU_CAPS_DRIVE_BOOT);
 
     switch (def->virtType) {
     case VIR_DOMAIN_VIRT_QEMU:
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_KQEMU))
+        if (qemuCapsGet(caps, QEMU_CAPS_KQEMU))
             disableKQEMU = 1;
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_KVM))
+        if (qemuCapsGet(caps, QEMU_CAPS_KVM))
             disableKVM = 1;
         break;
 
     case VIR_DOMAIN_VIRT_KQEMU:
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_KVM))
+        if (qemuCapsGet(caps, QEMU_CAPS_KVM))
             disableKVM = 1;
 
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KQEMU)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_ENABLE_KQEMU)) {
             enableKQEMU = 1;
-        } else if (!qemuCapsGet(qemuCaps, QEMU_CAPS_KQEMU)) {
+        } else if (!qemuCapsGet(caps, QEMU_CAPS_KQEMU)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("the QEMU binary %s does not support kqemu"),
                            emulator);
@@ -4393,12 +4393,12 @@ qemuBuildCommandLine(virConnectPtr conn,
         break;
 
     case VIR_DOMAIN_VIRT_KVM:
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_KQEMU))
+        if (qemuCapsGet(caps, QEMU_CAPS_KQEMU))
             disableKQEMU = 1;
 
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_ENABLE_KVM)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_ENABLE_KVM)) {
             enableKVM = 1;
-        } else if (!qemuCapsGet(qemuCaps, QEMU_CAPS_KVM)) {
+        } else if (!qemuCapsGet(caps, QEMU_CAPS_KVM)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("the QEMU binary %s does not support kvm"),
                            emulator);
@@ -4420,10 +4420,10 @@ qemuBuildCommandLine(virConnectPtr conn,
 
     virCommandAddEnvPassCommon(cmd);
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_NAME)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_NAME)) {
         virCommandAddArg(cmd, "-name");
         if (driver->setProcessName &&
-            qemuCapsGet(qemuCaps, QEMU_CAPS_NAME_PROCESS)) {
+            qemuCapsGet(caps, QEMU_CAPS_NAME_PROCESS)) {
             virCommandAddArgFormat(cmd, "%s,process=qemu:%s",
                                    def->name, def->name);
         } else {
@@ -4439,7 +4439,7 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (def->os.machine)
         virCommandAddArgList(cmd, "-M", def->os.machine, NULL);
 
-    if (qemuBuildCpuArgStr(driver, def, emulator, qemuCaps,
+    if (qemuBuildCpuArgStr(driver, def, emulator, caps,
                            &ut, &cpu, &hasHwVirt, !!migrateFrom) < 0)
         goto error;
 
@@ -4447,7 +4447,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         virCommandAddArgList(cmd, "-cpu", cpu, NULL);
         VIR_FREE(cpu);
 
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_NESTING) &&
+        if (qemuCapsGet(caps, QEMU_CAPS_NESTING) &&
             hasHwVirt)
             virCommandAddArg(cmd, "-enable-nesting");
     }
@@ -4485,7 +4485,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                            "%s", _("hugepages are disabled by administrator config"));
             goto error;
         }
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MEM_PATH)) {
+        if (!qemuCapsGet(caps, QEMU_CAPS_MEM_PATH)) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
                            _("hugepage backing not supported by '%s'"),
                            def->emulator);
@@ -4496,7 +4496,7 @@ qemuBuildCommandLine(virConnectPtr conn,
     }
 
     virCommandAddArg(cmd, "-smp");
-    if (!(smp = qemuBuildSmpArgStr(def, qemuCaps)))
+    if (!(smp = qemuBuildSmpArgStr(def, caps)))
         goto error;
     virCommandAddArg(cmd, smp);
     VIR_FREE(smp);
@@ -4505,15 +4505,15 @@ qemuBuildCommandLine(virConnectPtr conn,
         if (qemuBuildNumaArgStr(def, cmd) < 0)
             goto error;
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_UUID))
+    if (qemuCapsGet(caps, QEMU_CAPS_UUID))
         virCommandAddArgList(cmd, "-uuid", uuid, NULL);
     if (def->virtType == VIR_DOMAIN_VIRT_XEN ||
         STREQ(def->os.type, "xen") ||
         STREQ(def->os.type, "linux")) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_DOMID)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_DOMID)) {
             virCommandAddArg(cmd, "-domid");
             virCommandAddArgFormat(cmd, "%d", def->id);
-        } else if (qemuCapsGet(qemuCaps, QEMU_CAPS_XEN_DOMID)) {
+        } else if (qemuCapsGet(caps, QEMU_CAPS_XEN_DOMID)) {
             virCommandAddArg(cmd, "-xen-attach");
             virCommandAddArg(cmd, "-xen-domid");
             virCommandAddArgFormat(cmd, "%d", def->id);
@@ -4530,7 +4530,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         virSysinfoDefPtr source = NULL;
         bool skip_uuid = false;
 
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SMBIOS_TYPE)) {
+        if (!qemuCapsGet(caps, QEMU_CAPS_SMBIOS_TYPE)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("the QEMU binary %s does not support smbios settings"),
                            emulator);
@@ -4583,23 +4583,23 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (!def->graphics)
         virCommandAddArg(cmd, "-nographic");
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
         /* Disable global config files and default devices */
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_NO_USER_CONFIG))
+        if (qemuCapsGet(caps, QEMU_CAPS_NO_USER_CONFIG))
             virCommandAddArg(cmd, "-no-user-config");
-        else if (qemuCapsGet(qemuCaps, QEMU_CAPS_NODEFCONFIG))
+        else if (qemuCapsGet(caps, QEMU_CAPS_NODEFCONFIG))
             virCommandAddArg(cmd, "-nodefconfig");
         virCommandAddArg(cmd, "-nodefaults");
     }
 
     /* Serial graphics adapter */
     if (def->os.bios.useserial == VIR_DOMAIN_BIOS_USESERIAL_YES) {
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+        if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("qemu does not support -device"));
             goto error;
         }
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SGA)) {
+        if (!qemuCapsGet(caps, QEMU_CAPS_SGA)) {
             virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
                            _("qemu does not support SGA"));
             goto error;
@@ -4615,11 +4615,11 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (monitor_chr) {
         char *chrdev;
         /* Use -chardev if it's available */
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV)) {
 
             virCommandAddArg(cmd, "-chardev");
             if (!(chrdev = qemuBuildChrChardevStr(monitor_chr, "monitor",
-                                                  qemuCaps)))
+                                                  caps)))
                 goto error;
             virCommandAddArg(cmd, chrdev);
             VIR_FREE(chrdev);
@@ -4641,7 +4641,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     }
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_RTC)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_RTC)) {
         const char *rtcopt;
         virCommandAddArg(cmd, "-rtc");
         if (!(rtcopt = qemuBuildClockArgStr(&def->clock)))
@@ -4689,7 +4689,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             /* This has already been taken care of (in qemuBuildClockArgStr)
                if QEMU_CAPS_RTC is set (mutually exclusive with
                QEMUD_FLAG_RTC_TD_HACK) */
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_RTC_TD_HACK)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_RTC_TD_HACK)) {
                 switch (def->clock.timers[i]->tickpolicy) {
                 case -1:
                 case VIR_DOMAIN_TIMER_TICKPOLICY_DELAY:
@@ -4705,7 +4705,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                                    virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy));
                 goto error;
                 }
-            } else if (!qemuCapsGet(qemuCaps, QEMU_CAPS_RTC)
+            } else if (!qemuCapsGet(caps, QEMU_CAPS_RTC)
                        && (def->clock.timers[i]->tickpolicy
                            != VIR_DOMAIN_TIMER_TICKPOLICY_DELAY)
                        && (def->clock.timers[i]->tickpolicy != -1)) {
@@ -4724,13 +4724,13 @@ qemuBuildCommandLine(virConnectPtr conn,
             case VIR_DOMAIN_TIMER_TICKPOLICY_DELAY:
                 /* delay is the default if we don't have kernel
                    (-no-kvm-pit), otherwise, the default is catchup. */
-                if (qemuCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT))
+                if (qemuCapsGet(caps, QEMU_CAPS_NO_KVM_PIT))
                     virCommandAddArg(cmd, "-no-kvm-pit-reinjection");
                 break;
             case VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP:
-                if (qemuCapsGet(qemuCaps, QEMU_CAPS_NO_KVM_PIT)) {
+                if (qemuCapsGet(caps, QEMU_CAPS_NO_KVM_PIT)) {
                     /* do nothing - this is default for kvm-pit */
-                } else if (qemuCapsGet(qemuCaps, QEMU_CAPS_TDF)) {
+                } else if (qemuCapsGet(caps, QEMU_CAPS_TDF)) {
                     /* -tdf switches to 'catchup' with userspace pit. */
                     virCommandAddArg(cmd, "-tdf");
                 } else {
@@ -4759,7 +4759,7 @@ qemuBuildCommandLine(virConnectPtr conn,
              * and when -no-hpet doesn't exist is "no". "confusing"?
              * "yes"! */
 
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_NO_HPET)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_NO_HPET)) {
                 if (def->clock.timers[i]->present == 0)
                     virCommandAddArg(cmd, "-no-hpet");
             } else {
@@ -4774,7 +4774,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     }
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_NO_REBOOT) &&
+    if (qemuCapsGet(caps, QEMU_CAPS_NO_REBOOT) &&
         def->onReboot != VIR_DOMAIN_LIFECYCLE_RESTART)
         virCommandAddArg(cmd, "-no-reboot");
 
@@ -4782,16 +4782,16 @@ qemuBuildCommandLine(virConnectPtr conn,
      * when QEMU stops. If we use no-shutdown, then we can
      * watch for this event and do a soft/warm reboot.
      */
-    if (monitor_json && qemuCapsGet(qemuCaps, QEMU_CAPS_NO_SHUTDOWN))
+    if (monitor_json && qemuCapsGet(caps, QEMU_CAPS_NO_SHUTDOWN))
         virCommandAddArg(cmd, "-no-shutdown");
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_NO_ACPI)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_NO_ACPI)) {
         if (!(def->features & (1 << VIR_DOMAIN_FEATURE_ACPI)))
             virCommandAddArg(cmd, "-no-acpi");
     }
 
     if (def->pm.s3) {
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DISABLE_S3)) {
+        if (!qemuCapsGet(caps, QEMU_CAPS_DISABLE_S3)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            "%s", _("setting ACPI S3 not supported"));
             goto error;
@@ -4802,7 +4802,7 @@ qemuBuildCommandLine(virConnectPtr conn,
     }
 
     if (def->pm.s4) {
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DISABLE_S4)) {
+        if (!qemuCapsGet(caps, QEMU_CAPS_DISABLE_S4)) {
          virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            "%s", _("setting ACPI S4 not supported"));
             goto error;
@@ -4822,15 +4822,15 @@ qemuBuildCommandLine(virConnectPtr conn,
             /* def->os.nBootDevs is guaranteed to be > 0 unless per-device boot
              * configuration is used
              */
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_BOOTINDEX)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("hypervisor lacks deviceboot feature"));
                 goto error;
             }
             emitBootindex = true;
-        } else if (qemuCapsGet(qemuCaps, QEMU_CAPS_BOOTINDEX) &&
+        } else if (qemuCapsGet(caps, QEMU_CAPS_BOOTINDEX) &&
                    (def->os.bootmenu != VIR_DOMAIN_BOOT_MENU_ENABLED ||
-                    !qemuCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU))) {
+                    !qemuCapsGet(caps, QEMU_CAPS_BOOT_MENU))) {
             emitBootindex = true;
         }
 
@@ -4861,7 +4861,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
             virCommandAddArg(cmd, "-boot");
 
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_BOOT_MENU) &&
+            if (qemuCapsGet(caps, QEMU_CAPS_BOOT_MENU) &&
                 def->os.bootmenu != VIR_DOMAIN_BOOT_MENU_DEFAULT) {
                 if (def->os.bootmenu == VIR_DOMAIN_BOOT_MENU_ENABLED)
                     virBufferAsprintf(&boot_buf, "order=%s,menu=on", boot);
@@ -4896,7 +4896,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     }
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
         for (i = 0 ; i < def->ncontrollers ; i++) {
             virDomainControllerDefPtr cont = def->controllers[i];
 
@@ -4916,7 +4916,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
             /* Only recent QEMU implements a SATA (AHCI) controller */
             if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
-                if (!qemuCapsGet(qemuCaps, QEMU_CAPS_ICH9_AHCI)) {
+                if (!qemuCapsGet(caps, QEMU_CAPS_ICH9_AHCI)) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("SATA is not supported with this "
                                      "QEMU binary"));
@@ -4926,7 +4926,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
                     virCommandAddArg(cmd, "-device");
                     if (!(devstr = qemuBuildControllerDevStr(def, cont,
-                                                             qemuCaps, NULL)))
+                                                             caps, NULL)))
                         goto error;
 
                     virCommandAddArg(cmd, devstr);
@@ -4934,7 +4934,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                 }
             } else if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
                        cont->model == -1 &&
-                       !qemuCapsGet(qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
+                       !qemuCapsGet(caps, QEMU_CAPS_PIIX3_USB_UHCI)) {
                 if (usblegacy) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("Multiple legacy USB controllers are "
@@ -4946,7 +4946,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                 virCommandAddArg(cmd, "-device");
 
                 char *devstr;
-                if (!(devstr = qemuBuildControllerDevStr(def, cont, qemuCaps,
+                if (!(devstr = qemuBuildControllerDevStr(def, cont, caps,
                                                          &usbcontroller)))
                     goto error;
 
@@ -4957,10 +4957,10 @@ qemuBuildCommandLine(virConnectPtr conn,
     }
 
     /* If QEMU supports -drive param instead of old -hda, -hdb, -cdrom .. */
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_DRIVE)) {
         int bootCD = 0, bootFloppy = 0, bootDisk = 0;
 
-        if ((qemuCapsGet(qemuCaps, QEMU_CAPS_DRIVE_BOOT) || emitBootindex)) {
+        if ((qemuCapsGet(caps, QEMU_CAPS_DRIVE_BOOT) || emitBootindex)) {
             /* bootDevs will get translated into either bootindex=N or boot=on
              * depending on what qemu supports */
             for (i = 0 ; i < def->os.nBootDevs ; i++) {
@@ -4988,7 +4988,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             /* Unless we have -device, then USB disks need special
                handling */
             if ((disk->bus == VIR_DOMAIN_DISK_BUS_USB) &&
-                !qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+                !qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
                     virCommandAddArg(cmd, "-usbdevice");
                     virCommandAddArgFormat(cmd, "disk:%s", disk->src);
@@ -5024,19 +5024,19 @@ qemuBuildCommandLine(virConnectPtr conn,
                devices. Fortunately, those don't need
                static PCI addresses, so we don't really
                care that we can't use -device */
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN) {
                     withDeviceArg = 1;
                 } else {
-                    qemuCapsClear(qemuCaps, QEMU_CAPS_DEVICE);
+                    qemuCapsClear(caps, QEMU_CAPS_DEVICE);
                     deviceFlagMasked = true;
                 }
             }
             optstr = qemuBuildDriveStr(conn, disk,
                                        emitBootindex ? false : !!bootindex,
-                                       qemuCaps);
+                                       caps);
             if (deviceFlagMasked)
-                qemuCapsSet(qemuCaps, QEMU_CAPS_DEVICE);
+                qemuCapsSet(caps, QEMU_CAPS_DEVICE);
             if (!optstr)
                 goto error;
             virCommandAddArg(cmd, optstr);
@@ -5066,7 +5066,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                     virCommandAddArg(cmd, "-device");
 
                     if (!(optstr = qemuBuildDriveDevStr(def, disk, bootindex,
-                                                        qemuCaps)))
+                                                        caps)))
                         goto error;
                     virCommandAddArg(cmd, optstr);
                     VIR_FREE(optstr);
@@ -5198,19 +5198,19 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     }
 
-    if (qemuCapsGet(qemuCaps, QEMU_CAPS_FSDEV)) {
+    if (qemuCapsGet(caps, QEMU_CAPS_FSDEV)) {
         for (i = 0 ; i < def->nfss ; i++) {
             char *optstr;
             virDomainFSDefPtr fs = def->fss[i];
 
             virCommandAddArg(cmd, "-fsdev");
-            if (!(optstr = qemuBuildFSStr(fs, qemuCaps)))
+            if (!(optstr = qemuBuildFSStr(fs, caps)))
                 goto error;
             virCommandAddArg(cmd, optstr);
             VIR_FREE(optstr);
 
             virCommandAddArg(cmd, "-device");
-            if (!(optstr = qemuBuildFSDevStr(fs, qemuCaps)))
+            if (!(optstr = qemuBuildFSDevStr(fs, caps)))
                 goto error;
             virCommandAddArg(cmd, optstr);
             VIR_FREE(optstr);
@@ -5225,7 +5225,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
     if (!def->nnets) {
         /* If we have -device, then we set -nodefault already */
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
+        if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE))
             virCommandAddArgList(cmd, "-net", "none", NULL);
     } else {
         int bootNet = 0;
@@ -5256,8 +5256,8 @@ qemuBuildCommandLine(virConnectPtr conn,
                 bootindex = net->info.bootIndex;
 
             /* VLANs are not used with -netdev, so don't record them */
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
-                qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
+            if (qemuCapsGet(caps, QEMU_CAPS_NETDEV) &&
+                qemuCapsGet(caps, QEMU_CAPS_DEVICE))
                 vlan = -1;
             else
                 vlan = i;
@@ -5318,9 +5318,9 @@ qemuBuildCommandLine(virConnectPtr conn,
                  */
                 if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
                     driver->privileged ||
-                    (!qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV_BRIDGE))) {
+                    (!qemuCapsGet(caps, QEMU_CAPS_NETDEV_BRIDGE))) {
                     int tapfd = qemuNetworkIfaceConnect(def, conn, driver, net,
-                                                        qemuCaps);
+                                                        caps);
                     if (tapfd < 0)
                         goto error;
 
@@ -5333,7 +5333,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                 }
             } else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) {
                 int tapfd = qemuPhysIfaceConnect(def, driver, net,
-                                                 qemuCaps, vmop);
+                                                 caps, vmop);
                 if (tapfd < 0)
                     goto error;
 
@@ -5352,7 +5352,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                    network device */
                 int vhostfd;
 
-                if (qemuOpenVhostNet(def, net, qemuCaps, &vhostfd) < 0)
+                if (qemuOpenVhostNet(def, net, caps, &vhostfd) < 0)
                     goto error;
                 if (vhostfd >= 0) {
                     virCommandTransferFD(cmd, vhostfd);
@@ -5370,19 +5370,19 @@ qemuBuildCommandLine(virConnectPtr conn,
              *
              * NB, no support for -netdev without use of -device
              */
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
-                qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_NETDEV) &&
+                qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 virCommandAddArg(cmd, "-netdev");
-                if (!(host = qemuBuildHostNetStr(net, driver, qemuCaps,
+                if (!(host = qemuBuildHostNetStr(net, driver, caps,
                                                  ',', vlan, tapfd_name,
                                                  vhostfd_name)))
                     goto error;
                 virCommandAddArg(cmd, host);
                 VIR_FREE(host);
             }
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 virCommandAddArg(cmd, "-device");
-                nic = qemuBuildNicDevStr(net, vlan, bootindex, qemuCaps);
+                nic = qemuBuildNicDevStr(net, vlan, bootindex, caps);
                 if (!nic)
                     goto error;
                 virCommandAddArg(cmd, nic);
@@ -5394,10 +5394,10 @@ qemuBuildCommandLine(virConnectPtr conn,
                 virCommandAddArg(cmd, nic);
                 VIR_FREE(nic);
             }
-            if (!(qemuCapsGet(qemuCaps, QEMU_CAPS_NETDEV) &&
-                  qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))) {
+            if (!(qemuCapsGet(caps, QEMU_CAPS_NETDEV) &&
+                  qemuCapsGet(caps, QEMU_CAPS_DEVICE))) {
                 virCommandAddArg(cmd, "-net");
-                if (!(host = qemuBuildHostNetStr(net, driver, qemuCaps,
+                if (!(host = qemuBuildHostNetStr(net, driver, caps,
                                                  ',', vlan, tapfd_name,
                                                  vhostfd_name)))
                     goto error;
@@ -5429,8 +5429,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 
         switch (smartcard->type) {
         case VIR_DOMAIN_SMARTCARD_TYPE_HOST:
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) ||
-                !qemuCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) ||
+                !qemuCapsGet(caps, QEMU_CAPS_CCID_EMULATED)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("this QEMU binary lacks smartcard host "
                                  "mode support"));
@@ -5441,8 +5441,8 @@ qemuBuildCommandLine(virConnectPtr conn,
             break;
 
         case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES:
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) ||
-                !qemuCapsGet(qemuCaps, QEMU_CAPS_CCID_EMULATED)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) ||
+                !qemuCapsGet(caps, QEMU_CAPS_CCID_EMULATED)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("this QEMU binary lacks smartcard host "
                                  "mode support"));
@@ -5477,8 +5477,8 @@ qemuBuildCommandLine(virConnectPtr conn,
             break;
 
         case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) ||
-                !qemuCapsGet(qemuCaps, QEMU_CAPS_CCID_PASSTHRU)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) ||
+                !qemuCapsGet(caps, QEMU_CAPS_CCID_PASSTHRU)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("this QEMU binary lacks smartcard "
                                  "passthrough mode support"));
@@ -5488,7 +5488,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             virCommandAddArg(cmd, "-chardev");
             if (!(devstr = qemuBuildChrChardevStr(&smartcard->data.passthru,
                                                   smartcard->info.alias,
-                                                  qemuCaps))) {
+                                                  caps))) {
                 virBufferFreeAndReset(&opt);
                 goto error;
             }
@@ -5513,7 +5513,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
     if (!def->nserials) {
         /* If we have -device, then we set -nodefault already */
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
+        if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE))
             virCommandAddArgList(cmd, "-serial", "none", NULL);
     } else {
         for (i = 0 ; i < def->nserials ; i++) {
@@ -5521,18 +5521,18 @@ qemuBuildCommandLine(virConnectPtr conn,
             char *devstr;
 
             /* Use -chardev with -device if they are available */
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) &&
-                qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV) &&
+                qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 virCommandAddArg(cmd, "-chardev");
                 if (!(devstr = qemuBuildChrChardevStr(&serial->source,
                                                       serial->info.alias,
-                                                      qemuCaps)))
+                                                      caps)))
                     goto error;
                 virCommandAddArg(cmd, devstr);
                 VIR_FREE(devstr);
 
                 virCommandAddArg(cmd, "-device");
-                if (!(devstr = qemuBuildChrDeviceStr(serial, qemuCaps,
+                if (!(devstr = qemuBuildChrDeviceStr(serial, caps,
                                                      def->os.arch,
                                                      def->os.machine)))
                    goto error;
@@ -5550,7 +5550,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
     if (!def->nparallels) {
         /* If we have -device, then we set -nodefault already */
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
+        if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE))
             virCommandAddArgList(cmd, "-parallel", "none", NULL);
     } else {
         for (i = 0 ; i < def->nparallels ; i++) {
@@ -5558,12 +5558,12 @@ qemuBuildCommandLine(virConnectPtr conn,
             char *devstr;
 
             /* Use -chardev with -device if they are available */
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) &&
-                qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_CHARDEV) &&
+                qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 virCommandAddArg(cmd, "-chardev");
                 if (!(devstr = qemuBuildChrChardevStr(&parallel->source,
                                                       parallel->info.alias,
-                                                      qemuCaps)))
+                                                      caps)))
                     goto error;
                 virCommandAddArg(cmd, devstr);
                 VIR_FREE(devstr);
@@ -5590,8 +5590,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 
         switch(channel->targetType) {
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV) ||
-                !qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_CHARDEV) ||
+                !qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                "%s", _("guestfwd requires QEMU to support -chardev & -device"));
                 goto error;
@@ -5600,7 +5600,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             virCommandAddArg(cmd, "-chardev");
             if (!(devstr = qemuBuildChrChardevStr(&channel->source,
                                                   channel->info.alias,
-                                                  qemuCaps)))
+                                                  caps)))
                 goto error;
             virCommandAddArg(cmd, devstr);
             VIR_FREE(devstr);
@@ -5619,13 +5619,13 @@ qemuBuildCommandLine(virConnectPtr conn,
             break;
 
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("virtio channel requires QEMU to support -device"));
                 goto error;
             }
 
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE_SPICEVMC) &&
+            if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_SPICEVMC) &&
                 channel->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) {
                 /* spicevmc was originally introduced via a -device
                  * with a backend internal to qemu; although we prefer
@@ -5635,7 +5635,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                 virCommandAddArg(cmd, "-chardev");
                 if (!(devstr = qemuBuildChrChardevStr(&channel->source,
                                                       channel->info.alias,
-                                                      qemuCaps)))
+                                                      caps)))
                     goto error;
                 virCommandAddArg(cmd, devstr);
                 VIR_FREE(devstr);
@@ -5643,7 +5643,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
             virCommandAddArg(cmd, "-device");
             if (!(devstr = qemuBuildVirtioSerialPortDevStr(channel,
-                                                           qemuCaps)))
+                                                           caps)))
                 goto error;
             virCommandAddArg(cmd, devstr);
             VIR_FREE(devstr);
@@ -5658,7 +5658,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
         switch(console->targetType) {
         case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("virtio channel requires QEMU to support -device"));
                 goto error;
@@ -5667,14 +5667,14 @@ qemuBuildCommandLine(virConnectPtr conn,
             virCommandAddArg(cmd, "-chardev");
             if (!(devstr = qemuBuildChrChardevStr(&console->source,
                                                   console->info.alias,
-                                                  qemuCaps)))
+                                                  caps)))
                 goto error;
             virCommandAddArg(cmd, devstr);
             VIR_FREE(devstr);
 
             virCommandAddArg(cmd, "-device");
             if (!(devstr = qemuBuildVirtioSerialPortDevStr(console,
-                                                           qemuCaps)))
+                                                           caps)))
                 goto error;
             virCommandAddArg(cmd, devstr);
             VIR_FREE(devstr);
@@ -5699,7 +5699,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         char *optstr;
 
         virCommandAddArg(cmd, "-device");
-        if (!(optstr = qemuBuildHubDevStr(hub, qemuCaps)))
+        if (!(optstr = qemuBuildHubDevStr(hub, caps)))
             goto error;
         virCommandAddArg(cmd, optstr);
         VIR_FREE(optstr);
@@ -5709,10 +5709,10 @@ qemuBuildCommandLine(virConnectPtr conn,
         virDomainInputDefPtr input = def->inputs[i];
 
         if (input->bus == VIR_DOMAIN_INPUT_BUS_USB) {
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 char *optstr;
                 virCommandAddArg(cmd, "-device");
-                if (!(optstr = qemuBuildUSBInputDevStr(input, qemuCaps)))
+                if (!(optstr = qemuBuildUSBInputDevStr(input, caps)))
                     goto error;
                 virCommandAddArg(cmd, optstr);
                 VIR_FREE(optstr);
@@ -5746,7 +5746,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             virBufferAsprintf(&opt, "unix:%s",
                               def->graphics[0]->data.vnc.socket);
 
-        } else if (qemuCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) {
+        } else if (qemuCapsGet(caps, QEMU_CAPS_VNC_COLON)) {
             const char *listenNetwork;
             const char *listenAddr = NULL;
             char *netAddr = NULL;
@@ -5801,7 +5801,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                               def->graphics[0]->data.vnc.port - 5900);
         }
 
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_VNC_COLON)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_VNC_COLON)) {
             if (def->graphics[0]->data.vnc.auth.passwd ||
                 driver->vncPassword)
                 virBufferAddLit(&opt, ",password");
@@ -5846,8 +5846,8 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     } else if ((def->ngraphics == 1) &&
                def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_0_10) &&
-            !qemuCapsGet(qemuCaps, QEMU_CAPS_SDL)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_0_10) &&
+            !qemuCapsGet(caps, QEMU_CAPS_SDL)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                            _("sdl not supported by '%s'"),
                            def->emulator);
@@ -5873,7 +5873,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         /* New QEMU has this flag to let us explicitly ask for
          * SDL graphics. This is better than relying on the
          * default, since the default changes :-( */
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_SDL))
+        if (qemuCapsGet(caps, QEMU_CAPS_SDL))
             virCommandAddArg(cmd, "-sdl");
 
     } else if ((def->ngraphics == 1) &&
@@ -5885,7 +5885,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         int ret;
         int defaultMode = def->graphics[0]->data.spice.defaultMode;
 
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_SPICE)) {
+        if (!qemuCapsGet(caps, QEMU_CAPS_SPICE)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("spice graphics are not supported with this QEMU"));
             goto error;
@@ -6033,12 +6033,12 @@ qemuBuildCommandLine(virConnectPtr conn,
     }
 
     if (def->nvideos > 0) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_VGA)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_VGA)) {
             if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_XEN) {
                 /* nothing - vga has no effect on Xen pvfb */
             } else {
                 if ((def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) &&
-                    !qemuCapsGet(qemuCaps, QEMU_CAPS_VGA_QXL)) {
+                    !qemuCapsGet(caps, QEMU_CAPS_VGA_QXL)) {
                     virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                    _("This QEMU does not support QXL graphics adapters"));
                     goto error;
@@ -6056,7 +6056,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
                 if (def->videos[0]->type == VIR_DOMAIN_VIDEO_TYPE_QXL) {
                     if (def->videos[0]->vram &&
-                        qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+                        qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                         if (def->videos[0]->vram > (UINT_MAX / 1024)) {
                             virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                            _("value for 'vram' must be less than '%u'"),
@@ -6066,7 +6066,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
                         virCommandAddArg(cmd, "-global");
 
-                        if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE_QXL_VGA))
+                        if (qemuCapsGet(caps, QEMU_CAPS_DEVICE_QXL_VGA))
                             virCommandAddArgFormat(cmd, "qxl-vga.vram_size=%u",
                                                    def->videos[0]->vram * 1024);
                         else
@@ -6100,7 +6100,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
 
         if (def->nvideos > 1) {
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 for (i = 1 ; i < def->nvideos ; i++) {
                     char *str;
                     if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
@@ -6112,7 +6112,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
                     virCommandAddArg(cmd, "-device");
 
-                    if (!(str = qemuBuildVideoDevStr(def->videos[i], qemuCaps)))
+                    if (!(str = qemuBuildVideoDevStr(def->videos[i], caps)))
                         goto error;
 
                     virCommandAddArg(cmd, str);
@@ -6127,15 +6127,15 @@ qemuBuildCommandLine(virConnectPtr conn,
 
     } else {
         /* If we have -device, then we set -nodefault already */
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE) &&
-            qemuCapsGet(qemuCaps, QEMU_CAPS_VGA) &&
-            qemuCapsGet(qemuCaps, QEMU_CAPS_VGA_NONE))
+        if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE) &&
+            qemuCapsGet(caps, QEMU_CAPS_VGA) &&
+            qemuCapsGet(caps, QEMU_CAPS_VGA_NONE))
             virCommandAddArgList(cmd, "-vga", "none", NULL);
     }
 
     /* Add sound hardware */
     if (def->nsounds) {
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
             for (i = 0 ; i < def->nsounds ; i++) {
                 virDomainSoundDefPtr sound = def->sounds[i];
                 char *str = NULL;
@@ -6147,7 +6147,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                     virCommandAddArgList(cmd, "-soundhw", "pcspk", NULL);
                 } else {
                     virCommandAddArg(cmd, "-device");
-                    if (!(str = qemuBuildSoundDevStr(sound, qemuCaps)))
+                    if (!(str = qemuBuildSoundDevStr(sound, caps)))
                         goto error;
 
                     virCommandAddArg(cmd, str);
@@ -6158,7 +6158,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
                         for (ii = 0 ; ii < sound->ncodecs ; ii++) {
                             virCommandAddArg(cmd, "-device");
-                            if (!(codecstr = qemuBuildSoundCodecStr(sound, sound->codecs[ii], qemuCaps))) {
+                            if (!(codecstr = qemuBuildSoundCodecStr(sound, sound->codecs[ii], caps))) {
                                 goto error;
 
                             }
@@ -6171,7 +6171,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                                 0
                             };
                             virCommandAddArg(cmd, "-device");
-                            if (!(codecstr = qemuBuildSoundCodecStr(sound, &codec, qemuCaps))) {
+                            if (!(codecstr = qemuBuildSoundCodecStr(sound, &codec, caps))) {
                                 goto error;
 
                             }
@@ -6221,10 +6221,10 @@ qemuBuildCommandLine(virConnectPtr conn,
         virDomainWatchdogDefPtr watchdog = def->watchdog;
         char *optstr;
 
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
             virCommandAddArg(cmd, "-device");
 
-            optstr = qemuBuildWatchdogDevStr(watchdog, qemuCaps);
+            optstr = qemuBuildWatchdogDevStr(watchdog, caps);
             if (!optstr)
                 goto error;
         } else {
@@ -6263,18 +6263,18 @@ qemuBuildCommandLine(virConnectPtr conn,
         virCommandAddArg(cmd, "-chardev");
         if (!(devstr = qemuBuildChrChardevStr(&redirdev->source.chr,
                                               redirdev->info.alias,
-                                              qemuCaps))) {
+                                              caps))) {
             goto error;
         }
 
         virCommandAddArg(cmd, devstr);
         VIR_FREE(devstr);
 
-        if (!qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE))
+        if (!qemuCapsGet(caps, QEMU_CAPS_DEVICE))
             goto error;
 
         virCommandAddArg(cmd, "-device");
-        if (!(devstr = qemuBuildRedirdevDevStr(redirdev, qemuCaps)))
+        if (!(devstr = qemuBuildRedirdevDevStr(redirdev, caps)))
             goto error;
         virCommandAddArg(cmd, devstr);
         VIR_FREE(devstr);
@@ -6293,7 +6293,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                                _("booting from assigned devices is only"
                                  " supported for PCI devices"));
                 goto error;
-            } else if (!qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_BOOTINDEX)) {
+            } else if (!qemuCapsGet(caps, QEMU_CAPS_PCI_BOOTINDEX)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("booting from assigned PCI devices is not"
                                  " supported with this version of qemu"));
@@ -6305,9 +6305,9 @@ qemuBuildCommandLine(virConnectPtr conn,
         if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
             hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
 
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 virCommandAddArg(cmd, "-device");
-                if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev, qemuCaps)))
+                if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev, caps)))
                     goto error;
                 virCommandAddArg(cmd, devstr);
                 VIR_FREE(devstr);
@@ -6323,9 +6323,9 @@ qemuBuildCommandLine(virConnectPtr conn,
         /* PCI */
         if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
             hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
                 char *configfd_name = NULL;
-                if (qemuCapsGet(qemuCaps, QEMU_CAPS_PCI_CONFIGFD)) {
+                if (qemuCapsGet(caps, QEMU_CAPS_PCI_CONFIGFD)) {
                     int configfd = qemuOpenPCIConfig(hostdev);
 
                     if (configfd >= 0) {
@@ -6338,13 +6338,13 @@ qemuBuildCommandLine(virConnectPtr conn,
                     }
                 }
                 virCommandAddArg(cmd, "-device");
-                devstr = qemuBuildPCIHostdevDevStr(hostdev, configfd_name, qemuCaps);
+                devstr = qemuBuildPCIHostdevDevStr(hostdev, configfd_name, caps);
                 VIR_FREE(configfd_name);
                 if (!devstr)
                     goto error;
                 virCommandAddArg(cmd, devstr);
                 VIR_FREE(devstr);
-            } else if (qemuCapsGet(qemuCaps, QEMU_CAPS_PCIDEVICE)) {
+            } else if (qemuCapsGet(caps, QEMU_CAPS_PCIDEVICE)) {
                 virCommandAddArg(cmd, "-pcidevice");
                 if (!(devstr = qemuBuildPCIHostdevPCIDevStr(hostdev)))
                     goto error;
@@ -6364,7 +6364,7 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (migrateFrom) {
         virCommandAddArg(cmd, "-incoming");
         if (STRPREFIX(migrateFrom, "tcp")) {
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_TCP)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_TCP)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                "%s", _("TCP migration is not supported with "
                                        "this QEMU binary"));
@@ -6372,13 +6372,13 @@ qemuBuildCommandLine(virConnectPtr conn,
             }
             virCommandAddArg(cmd, migrateFrom);
         } else if (STREQ(migrateFrom, "stdio")) {
-            if (qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD)) {
+            if (qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_FD)) {
                 virCommandAddArgFormat(cmd, "fd:%d", migrateFd);
                 virCommandPreserveFD(cmd, migrateFd);
-            } else if (qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
+            } else if (qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
                 virCommandAddArg(cmd, "exec:cat");
                 virCommandSetInputFD(cmd, migrateFd);
-            } else if (qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_KVM_STDIO)) {
+            } else if (qemuCapsGet(caps, QEMU_CAPS_MIGRATE_KVM_STDIO)) {
                 virCommandAddArg(cmd, migrateFrom);
                 virCommandSetInputFD(cmd, migrateFd);
             } else {
@@ -6388,7 +6388,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                 goto error;
             }
         } else if (STRPREFIX(migrateFrom, "exec")) {
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                "%s", _("EXEC migration is not supported "
                                        "with this QEMU binary"));
@@ -6396,7 +6396,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             }
             virCommandAddArg(cmd, migrateFrom);
         } else if (STRPREFIX(migrateFrom, "fd")) {
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_FD)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                "%s", _("FD migration is not supported "
                                        "with this QEMU binary"));
@@ -6405,7 +6405,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             virCommandAddArg(cmd, migrateFrom);
             virCommandPreserveFD(cmd, migrateFd);
         } else if (STRPREFIX(migrateFrom, "unix")) {
-            if (!qemuCapsGet(qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) {
+            if (!qemuCapsGet(caps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                "%s", _("UNIX migration is not supported "
                                        "with this QEMU binary"));
@@ -6433,16 +6433,16 @@ qemuBuildCommandLine(virConnectPtr conn,
                            virDomainMemballoonModelTypeToString(def->memballoon->model));
             goto error;
         }
-        if (qemuCapsGet(qemuCaps, QEMU_CAPS_DEVICE)) {
+        if (qemuCapsGet(caps, QEMU_CAPS_DEVICE)) {
             char *optstr;
             virCommandAddArg(cmd, "-device");
 
-            optstr = qemuBuildMemballoonDevStr(def->memballoon, qemuCaps);
+            optstr = qemuBuildMemballoonDevStr(def->memballoon, caps);
             if (!optstr)
                 goto error;
             virCommandAddArg(cmd, optstr);
             VIR_FREE(optstr);
-        } else if (qemuCapsGet(qemuCaps, QEMU_CAPS_BALLOON)) {
+        } else if (qemuCapsGet(caps, QEMU_CAPS_BALLOON)) {
             virCommandAddArgList(cmd, "-balloon", "virtio", NULL);
         }
     }
@@ -6479,7 +6479,7 @@ qemuBuildCommandLine(virConnectPtr conn,
  */
 char *
 qemuBuildChrDeviceStr(virDomainChrDefPtr serial,
-                       virBitmapPtr qemuCaps,
+                       qemuCapsPtr caps,
                        char *os_arch,
                        char *machine)
 {
@@ -6491,7 +6491,7 @@ qemuBuildChrDeviceStr(virDomainChrDefPtr serial,
             serial->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_SPAPRVIO) {
             virBufferAsprintf(&cmd, "spapr-vty,chardev=char%s",
                               serial->info.alias);
-            if (qemuBuildDeviceAddressStr(&cmd, &serial->info, qemuCaps) < 0)
+            if (qemuBuildDeviceAddressStr(&cmd, &serial->info, caps) < 0)
                 goto error;
         }
     } else
diff --git a/src/qemu/qemu_command.h b/src/qemu/qemu_command.h
index 7c5e8dd..e155583 100644
--- a/src/qemu/qemu_command.h
+++ b/src/qemu/qemu_command.h
@@ -29,6 +29,7 @@
 # include "capabilities.h"
 # include "qemu_conf.h"
 # include "qemu_domain.h"
+# include "qemu_capabilities.h"
 
 /* Config type for XML import/export conversions */
 # define QEMU_CONFIG_FORMAT_ARGV "qemu-argv"
@@ -53,7 +54,7 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
                                    virDomainDefPtr def,
                                    virDomainChrSourceDefPtr monitor_chr,
                                    bool monitor_json,
-                                   virBitmapPtr qemuCaps,
+                                   qemuCapsPtr caps,
                                    const char *migrateFrom,
                                    int migrateFd,
                                    virDomainSnapshotObjPtr current_snapshot,
@@ -63,14 +64,14 @@ virCommandPtr qemuBuildCommandLine(virConnectPtr conn,
 /* Generate string for arch-specific '-device' parameter */
 char *
 qemuBuildChrDeviceStr (virDomainChrDefPtr serial,
-                       virBitmapPtr qemuCaps,
+                       qemuCapsPtr caps,
                        char *os_arch,
                        char *machine);
 
 /* With vlan == -1, use netdev syntax, else old hostnet */
 char * qemuBuildHostNetStr(virDomainNetDefPtr net,
                            struct qemud_driver *driver,
-                           virBitmapPtr qemuCaps,
+                           qemuCapsPtr caps,
                            char type_sep,
                            int vlan,
                            const char *tapfd,
@@ -85,50 +86,50 @@ char * qemuBuildNicStr(virDomainNetDefPtr net,
 char * qemuBuildNicDevStr(virDomainNetDefPtr net,
                           int vlan,
                           int bootindex,
-                          virBitmapPtr qemuCaps);
+                          qemuCapsPtr caps);
 
 char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
-                               virBitmapPtr qemuCaps);
+                               qemuCapsPtr caps);
 
 /* Both legacy & current support */
 char *qemuBuildDriveStr(virConnectPtr conn,
                         virDomainDiskDefPtr disk,
                         bool bootable,
-                        virBitmapPtr qemuCaps);
+                        qemuCapsPtr caps);
 char *qemuBuildFSStr(virDomainFSDefPtr fs,
-                     virBitmapPtr qemuCaps);
+                     qemuCapsPtr caps);
 
 /* Current, best practice */
 char * qemuBuildDriveDevStr(virDomainDefPtr def,
                             virDomainDiskDefPtr disk,
                             int bootindex,
-                            virBitmapPtr qemuCaps);
+                            qemuCapsPtr caps);
 char * qemuBuildFSDevStr(virDomainFSDefPtr fs,
-                         virBitmapPtr qemuCaps);
+                         qemuCapsPtr caps);
 /* Current, best practice */
 char * qemuBuildControllerDevStr(virDomainDefPtr domainDef,
                                  virDomainControllerDefPtr def,
-                                 virBitmapPtr qemuCaps,
+                                 qemuCapsPtr caps,
                                  int *nusbcontroller);
 
 char * qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev,
-                               virBitmapPtr qemuCaps);
+                               qemuCapsPtr caps);
 
 char * qemuBuildMemballoonDevStr(virDomainMemballoonDefPtr dev,
-                                 virBitmapPtr qemuCaps);
+                                 qemuCapsPtr caps);
 
 char * qemuBuildUSBInputDevStr(virDomainInputDefPtr dev,
-                               virBitmapPtr qemuCaps);
+                               qemuCapsPtr caps);
 
 char * qemuBuildSoundDevStr(virDomainSoundDefPtr sound,
-                            virBitmapPtr qemuCaps);
+                            qemuCapsPtr caps);
 
 /* Legacy, pre device support */
 char * qemuBuildPCIHostdevPCIDevStr(virDomainHostdevDefPtr dev);
 /* Current, best practice */
 char * qemuBuildPCIHostdevDevStr(virDomainHostdevDefPtr dev,
                                  const char *configfd,
-                                 virBitmapPtr qemuCaps);
+                                 qemuCapsPtr caps);
 
 int qemuOpenPCIConfig(virDomainHostdevDefPtr dev);
 
@@ -136,28 +137,28 @@ int qemuOpenPCIConfig(virDomainHostdevDefPtr dev);
 char * qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev);
 /* Current, best practice */
 char * qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev,
-                                 virBitmapPtr qemuCaps);
+                                 qemuCapsPtr caps);
 
-char * qemuBuildHubDevStr(virDomainHubDefPtr dev, virBitmapPtr qemuCaps);
-char * qemuBuildRedirdevDevStr(virDomainRedirdevDefPtr dev, virBitmapPtr qemuCaps);
+char * qemuBuildHubDevStr(virDomainHubDefPtr dev, qemuCapsPtr caps);
+char * qemuBuildRedirdevDevStr(virDomainRedirdevDefPtr dev, qemuCapsPtr caps);
 
 
 int qemuNetworkIfaceConnect(virDomainDefPtr def,
                             virConnectPtr conn,
                             struct qemud_driver *driver,
                             virDomainNetDefPtr net,
-                            virBitmapPtr qemuCaps)
+                            qemuCapsPtr caps)
     ATTRIBUTE_NONNULL(2);
 
 int qemuPhysIfaceConnect(virDomainDefPtr def,
                          struct qemud_driver *driver,
                          virDomainNetDefPtr net,
-                         virBitmapPtr qemuCaps,
+                         qemuCapsPtr caps,
                          enum virNetDevVPortProfileOp vmop);
 
 int qemuOpenVhostNet(virDomainDefPtr def,
                      virDomainNetDefPtr net,
-                     virBitmapPtr qemuCaps,
+                     qemuCapsPtr caps,
                      int *vhostfd);
 
 int qemudCanonicalizeMachine(struct qemud_driver *driver,
@@ -185,13 +186,13 @@ virDomainDefPtr qemuParseCommandLinePid(virCapsPtr caps,
                                         bool *monJSON);
 
 int qemuDomainAssignAddresses(virDomainDefPtr def,
-                              virBitmapPtr qemuCaps,
+                              qemuCapsPtr caps,
                               virDomainObjPtr);
 int qemuDomainAssignSpaprVIOAddresses(virDomainDefPtr def,
-                                      virBitmapPtr qemuCaps);
+                                      qemuCapsPtr caps);
 
 int qemuDomainAssignPCIAddresses(virDomainDefPtr def,
-                                 virBitmapPtr qemuCaps,
+                                 qemuCapsPtr caps,
                                  virDomainObjPtr obj);
 qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def);
 int qemuDomainPCIAddressReserveFunction(qemuDomainPCIAddressSetPtr addrs,
@@ -213,12 +214,12 @@ int qemuDomainPCIAddressReleaseSlot(qemuDomainPCIAddressSetPtr addrs, int slot);
 void qemuDomainPCIAddressSetFree(qemuDomainPCIAddressSetPtr addrs);
 int  qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs);
 
-int qemuAssignDeviceAliases(virDomainDefPtr def, virBitmapPtr qemuCaps);
+int qemuAssignDeviceAliases(virDomainDefPtr def, qemuCapsPtr caps);
 int qemuDomainNetVLAN(virDomainNetDefPtr def);
 int qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx);
 int qemuAssignDeviceDiskAlias(virDomainDefPtr vmdef,
                               virDomainDiskDefPtr def,
-                              virBitmapPtr qemuCaps);
+                              qemuCapsPtr caps);
 int qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr hostdev, int idx);
 int qemuAssignDeviceControllerAlias(virDomainControllerDefPtr controller);
 int qemuAssignDeviceRedirdevAlias(virDomainDefPtr def, virDomainRedirdevDefPtr redirdev, int idx);
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0ae30b7..44124f4 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -230,7 +230,7 @@ static void qemuDomainObjPrivateFree(void *data)
 {
     qemuDomainObjPrivatePtr priv = data;
 
-    qemuCapsFree(priv->qemuCaps);
+    virObjectUnref(priv->caps);
 
     qemuDomainPCIAddressSetFree(priv->pciaddrs);
     virDomainChrSourceDefFree(priv->monConfig);
@@ -290,11 +290,11 @@ static int qemuDomainObjPrivateXMLFormat(virBufferPtr buf, void *data)
         virBufferAddLit(buf, "  </vcpus>\n");
     }
 
-    if (priv->qemuCaps) {
+    if (priv->caps) {
         int i;
         virBufferAddLit(buf, "  <qemuCaps>\n");
         for (i = 0 ; i < QEMU_CAPS_LAST ; i++) {
-            if (qemuCapsGet(priv->qemuCaps, i)) {
+            if (qemuCapsGet(priv->caps, i)) {
                 virBufferAsprintf(buf, "    <flag name='%s'/>\n",
                                   qemuCapsTypeToString(i));
             }
@@ -335,7 +335,7 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
     char *tmp;
     int n, i;
     xmlNodePtr *nodes = NULL;
-    virBitmapPtr qemuCaps = NULL;
+    qemuCapsPtr caps = NULL;
 
     if (VIR_ALLOC(priv->monConfig) < 0) {
         virReportOOMError();
@@ -407,7 +407,7 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
         goto error;
     }
     if (n > 0) {
-        if (!(qemuCaps = qemuCapsNew()))
+        if (!(caps = qemuCapsNew()))
             goto error;
 
         for (i = 0 ; i < n ; i++) {
@@ -421,11 +421,11 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
                     goto error;
                 }
                 VIR_FREE(str);
-                qemuCapsSet(qemuCaps, flag);
+                qemuCapsSet(caps, flag);
             }
         }
 
-        priv->qemuCaps = qemuCaps;
+        priv->caps = caps;
     }
     VIR_FREE(nodes);
 
@@ -476,7 +476,7 @@ error:
     virDomainChrSourceDefFree(priv->monConfig);
     priv->monConfig = NULL;
     VIR_FREE(nodes);
-    qemuCapsFree(qemuCaps);
+    virObjectUnref(caps);
     return -1;
 }
 
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index dff53cf..8ee2541 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -30,7 +30,7 @@
 # include "qemu_monitor.h"
 # include "qemu_agent.h"
 # include "qemu_conf.h"
-# include "bitmap.h"
+# include "qemu_capabilities.h"
 # include "virconsole.h"
 
 # define QEMU_EXPECTED_VIRT_TYPES      \
@@ -139,7 +139,7 @@ struct _qemuDomainObjPrivate {
     qemuDomainPCIAddressSetPtr pciaddrs;
     int persistentAddrs;
 
-    virBitmapPtr qemuCaps;
+    qemuCapsPtr caps;
     char *lockState;
 
     bool fakeReboot;
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 8e8e00c..affb226 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1805,8 +1805,8 @@ qemuDomainReboot(virDomainPtr dom, unsigned int flags)
         }
     } else {
 #if HAVE_YAJL
-        if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON)) {
-            if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
+        if (qemuCapsGet(priv->caps, QEMU_CAPS_MONITOR_JSON)) {
+            if (!qemuCapsGet(priv->caps, QEMU_CAPS_NO_SHUTDOWN)) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                _("Reboot is not supported with this QEMU binary"));
                 goto cleanup;
@@ -2328,7 +2328,7 @@ static int qemudDomainGetInfo(virDomainPtr dom,
         if ((vm->def->memballoon != NULL) &&
             (vm->def->memballoon->model == VIR_DOMAIN_MEMBALLOON_MODEL_NONE)) {
             info->memory = vm->def->mem.max_balloon;
-        } else if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BALLOON_EVENT)) {
+        } else if (qemuCapsGet(priv->caps, QEMU_CAPS_BALLOON_EVENT)) {
             info->memory = vm->def->mem.cur_balloon;
         } else if (qemuDomainJobAllowed(priv, QEMU_JOB_QUERY)) {
             if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_QUERY) < 0)
@@ -3116,7 +3116,7 @@ static int qemuDumpToFd(struct qemud_driver *driver, virDomainObjPtr vm,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     int ret = -1;
 
-    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DUMP_GUEST_MEMORY)) {
+    if (!qemuCapsGet(priv->caps, QEMU_CAPS_DUMP_GUEST_MEMORY)) {
         virReportError(VIR_ERR_NO_SUPPORT, "%s",
                        _("dump-guest-memory is not supported"));
         return -1;
@@ -5047,7 +5047,7 @@ static char *qemuDomainGetXMLDesc(virDomainPtr dom,
     /* Refresh current memory based on balloon info if supported */
     if ((vm->def->memballoon != NULL) &&
         (vm->def->memballoon->model != VIR_DOMAIN_MEMBALLOON_MODEL_NONE) &&
-        !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BALLOON_EVENT) &&
+        !qemuCapsGet(priv->caps, QEMU_CAPS_BALLOON_EVENT) &&
         (virDomainObjIsActive(vm))) {
         /* Don't delay if someone's using the monitor, just use
          * existing most recent data instead */
@@ -5133,7 +5133,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
     struct qemud_driver *driver = conn->privateData;
     virDomainDefPtr def = NULL;
     virDomainChrSourceDef monConfig;
-    virBitmapPtr qemuCaps = NULL;
+    qemuCapsPtr caps = NULL;
     bool monitor_json = false;
     virCommandPtr cmd = NULL;
     char *ret = NULL;
@@ -5225,19 +5225,19 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
     if (qemuCapsExtractVersionInfo(def->emulator, def->os.arch,
                                    false,
                                    NULL,
-                                   &qemuCaps) < 0)
+                                   &caps) < 0)
         goto cleanup;
 
-    monitor_json = qemuCapsGet(qemuCaps, QEMU_CAPS_MONITOR_JSON);
+    monitor_json = qemuCapsGet(caps, QEMU_CAPS_MONITOR_JSON);
 
     if (qemuProcessPrepareMonitorChr(driver, &monConfig, def->name) < 0)
         goto cleanup;
 
-    if (qemuAssignDeviceAliases(def, qemuCaps) < 0)
+    if (qemuAssignDeviceAliases(def, caps) < 0)
         goto cleanup;
 
     if (!(cmd = qemuBuildCommandLine(conn, driver, def,
-                                     &monConfig, monitor_json, qemuCaps,
+                                     &monConfig, monitor_json, caps,
                                      NULL, -1, NULL, VIR_NETDEV_VPORT_PROFILE_OP_NO_OP)))
         goto cleanup;
 
@@ -5246,7 +5246,7 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
 cleanup:
     qemuDriverUnlock(driver);
 
-    qemuCapsFree(qemuCaps);
+    virObjectUnref(caps);
     virCommandFree(cmd);
     virDomainDefFree(def);
     return ret;
@@ -10580,7 +10580,7 @@ qemuDomainSnapshotDiskPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def,
     int external = 0;
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
-    if (allow_reuse && !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
+    if (allow_reuse && !qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("reuse is not supported with this QEMU binary"));
         goto cleanup;
@@ -10661,7 +10661,7 @@ qemuDomainSnapshotDiskPrepare(virDomainObjPtr vm, virDomainSnapshotDefPtr def,
     }
     if (active) {
         if (external == 1 ||
-            qemuCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
+            qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION)) {
             *flags |= VIR_DOMAIN_SNAPSHOT_CREATE_ATOMIC;
         } else if (atomic && external > 1) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@@ -10934,7 +10934,7 @@ qemuDomainSnapshotCreateDiskActive(virConnectPtr conn,
             goto cleanup;
         }
     }
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION)) {
         actions = virJSONValueNewArray();
         if (!actions) {
             virReportOOMError();
@@ -11034,7 +11034,7 @@ cleanup:
     }
 
     if (vm && (ret == 0 ||
-               !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_TRANSACTION))) {
+               !qemuCapsGet(priv->caps, QEMU_CAPS_TRANSACTION))) {
         if (virDomainSaveStatus(driver->caps, driver->stateDir, vm) < 0 ||
             (persist &&
              virDomainSaveConfig(driver->configDir, vm->newDef) < 0))
@@ -12616,9 +12616,9 @@ qemuDomainBlockJobImpl(virDomainPtr dom, const char *path, const char *base,
     }
 
     priv = vm->privateData;
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_BLOCKJOB_ASYNC)) {
         async = true;
-    } else if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC)) {
+    } else if (!qemuCapsGet(priv->caps, QEMU_CAPS_BLOCKJOB_SYNC)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("block jobs not supported with this QEMU binary"));
         goto cleanup;
@@ -12880,7 +12880,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom,
         goto cleanup;
     }
     priv = vm->privateData;
-    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE)) {
+    if (!qemuCapsGet(priv->caps, QEMU_CAPS_DRIVE_IOTUNE)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("block I/O throttling not supported with this "
                          "QEMU binary"));
@@ -13733,7 +13733,7 @@ qemuDomainPMSuspendForDuration(virDomainPtr dom,
         goto cleanup;
     }
 
-    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP) &&
+    if (!qemuCapsGet(priv->caps, QEMU_CAPS_WAKEUP) &&
         (target == VIR_NODE_SUSPEND_TARGET_MEM ||
          target == VIR_NODE_SUSPEND_TARGET_HYBRID)) {
         virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, "%s",
@@ -13829,7 +13829,7 @@ qemuDomainPMWakeup(virDomainPtr dom,
 
     priv = vm->privateData;
 
-    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_WAKEUP)) {
+    if (!qemuCapsGet(priv->caps, QEMU_CAPS_WAKEUP)) {
        virReportError(VIR_ERR_OPERATION_INVALID, "%s",
                       _("Unable to wake up domain due to "
                         "missing system_wakeup monitor command"));
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index a8a904c..a792456 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -98,7 +98,7 @@ int qemuDomainChangeEjectableMedia(struct qemud_driver *driver,
         return -1;
     }
 
-    if (!(driveAlias = qemuDeviceDriveHostAlias(origdisk, priv->qemuCaps)))
+    if (!(driveAlias = qemuDeviceDriveHostAlias(origdisk, priv->caps)))
         goto error;
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
@@ -227,17 +227,17 @@ int qemuDomainAttachPciDiskDevice(virConnectPtr conn,
         return -1;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &disk->info) < 0)
             goto error;
         releaseaddr = true;
-        if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
+        if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->caps) < 0)
             goto error;
 
-        if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
+        if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->caps)))
             goto error;
 
-        if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->qemuCaps)))
+        if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->caps)))
             goto error;
     }
 
@@ -247,7 +247,7 @@ int qemuDomainAttachPciDiskDevice(virConnectPtr conn,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
             ret = qemuMonitorAddDevice(priv->mon, devstr);
@@ -287,7 +287,7 @@ error:
     VIR_FREE(devstr);
     VIR_FREE(drivestr);
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
         (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
         releaseaddr &&
         qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
@@ -322,7 +322,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
         return -1;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &controller->info) < 0)
             goto cleanup;
         releaseaddr = true;
@@ -331,13 +331,13 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
 
         if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_USB &&
             controller->model == -1 &&
-            !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_PIIX3_USB_UHCI)) {
+            !qemuCapsGet(priv->caps, QEMU_CAPS_PIIX3_USB_UHCI)) {
             virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                            _("USB controller hotplug unsupported in this QEMU binary"));
             goto cleanup;
         }
 
-        if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->qemuCaps, NULL))) {
+        if (!(devstr = qemuBuildControllerDevStr(vm->def, controller, priv->caps, NULL))) {
             goto cleanup;
         }
     }
@@ -348,7 +348,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDevice(priv->mon, devstr);
     } else {
         ret = qemuMonitorAttachPCIDiskController(priv->mon,
@@ -364,7 +364,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
 
 cleanup:
     if ((ret != 0) &&
-        qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+        qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
         (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
         releaseaddr &&
         qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
@@ -461,14 +461,14 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn,
         goto error;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
-        if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
+        if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->caps) < 0)
             goto error;
-        if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->qemuCaps)))
+        if (!(devstr = qemuBuildDriveDevStr(vm->def, disk, 0, priv->caps)))
             goto error;
     }
 
-    if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
+    if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->caps)))
         goto error;
 
     for (i = 0 ; i <= disk->info.addr.drive.controller ; i++) {
@@ -494,7 +494,7 @@ int qemuDomainAttachSCSIDisk(virConnectPtr conn,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
             ret = qemuMonitorAddDevice(priv->mon, devstr);
@@ -583,12 +583,12 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn,
         goto error;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
-        if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->qemuCaps) < 0)
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
+        if (qemuAssignDeviceDiskAlias(vm->def, disk, priv->caps) < 0)
             goto error;
-        if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->qemuCaps)))
+        if (!(drivestr = qemuBuildDriveStr(conn, disk, false, priv->caps)))
             goto error;
-        if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->qemuCaps)))
+        if (!(devstr = qemuBuildDriveDevStr(NULL, disk, 0, priv->caps)))
             goto error;
     }
 
@@ -598,7 +598,7 @@ int qemuDomainAttachUsbMassstorageDevice(virConnectPtr conn,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
             ret = qemuMonitorAddDevice(priv->mon, devstr);
@@ -688,7 +688,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
         goto cleanup;
     }
 
-    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_HOST_NET_ADD)) {
+    if (!qemuCapsGet(priv->caps, QEMU_CAPS_HOST_NET_ADD)) {
         virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                        _("installed qemu version does not support host_net_add"));
         goto cleanup;
@@ -703,38 +703,38 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
          */
         if (actualType == VIR_DOMAIN_NET_TYPE_NETWORK ||
             driver->privileged ||
-            (!qemuCapsGet (priv->qemuCaps, QEMU_CAPS_NETDEV_BRIDGE))) {
+            (!qemuCapsGet (priv->caps, QEMU_CAPS_NETDEV_BRIDGE))) {
             if ((tapfd = qemuNetworkIfaceConnect(vm->def, conn, driver, net,
-                                                 priv->qemuCaps)) < 0)
+                                                 priv->caps)) < 0)
                 goto cleanup;
             iface_connected = true;
-            if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, &vhostfd) < 0)
+            if (qemuOpenVhostNet(vm->def, net, priv->caps, &vhostfd) < 0)
                 goto cleanup;
         }
     } else if (actualType == VIR_DOMAIN_NET_TYPE_DIRECT) {
         if ((tapfd = qemuPhysIfaceConnect(vm->def, driver, net,
-                                          priv->qemuCaps,
+                                          priv->caps,
                                           VIR_NETDEV_VPORT_PROFILE_OP_CREATE)) < 0)
             goto cleanup;
         iface_connected = true;
-        if (qemuOpenVhostNet(vm->def, net, priv->qemuCaps, &vhostfd) < 0)
+        if (qemuOpenVhostNet(vm->def, net, priv->caps, &vhostfd) < 0)
             goto cleanup;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NET_NAME) ||
-        qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_NET_NAME) ||
+        qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceNetAlias(vm->def, net, -1) < 0)
             goto cleanup;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
         qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &net->info) < 0)
         goto cleanup;
 
     releaseaddr = true;
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
-        qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) &&
+        qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         vlan = -1;
     } else {
         vlan = qemuDomainNetVLAN(net);
@@ -756,22 +756,22 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
             goto no_memory;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
-        qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
-        if (!(netstr = qemuBuildHostNetStr(net, driver, priv->qemuCaps,
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) &&
+        qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
+        if (!(netstr = qemuBuildHostNetStr(net, driver, priv->caps,
                                            ',', -1, tapfd_name,
                                            vhostfd_name)))
             goto cleanup;
     } else {
-        if (!(netstr = qemuBuildHostNetStr(net, driver, priv->qemuCaps,
+        if (!(netstr = qemuBuildHostNetStr(net, driver, priv->caps,
                                            ' ', vlan, tapfd_name,
                                            vhostfd_name)))
             goto cleanup;
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
-        qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) &&
+        qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorAddNetdev(priv->mon, netstr, tapfd, tapfd_name,
                                  vhostfd, vhostfd_name) < 0) {
             qemuDomainObjExitMonitorWithDriver(driver, vm);
@@ -797,8 +797,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
         goto cleanup;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
-        if (!(nicstr = qemuBuildNicDevStr(net, vlan, 0, priv->qemuCaps)))
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
+        if (!(nicstr = qemuBuildNicDevStr(net, vlan, 0, priv->caps)))
             goto try_remove;
     } else {
         if (!(nicstr = qemuBuildNicStr(net, NULL, vlan)))
@@ -806,7 +806,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) {
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             virDomainAuditNet(vm, NULL, net, "attach", false);
@@ -833,7 +833,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
         } else {
             qemuDomainObjEnterMonitorWithDriver(driver, vm);
 
-            if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
+            if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV)) {
                 if (qemuMonitorSetLink(priv->mon, net->info.alias, VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) < 0) {
                     qemuDomainObjExitMonitorWithDriver(driver, vm);
                     virDomainAuditNet(vm, NULL, net, "attach", false);
@@ -857,7 +857,7 @@ cleanup:
     if (!ret) {
         vm->def->nets[vm->def->nnets++] = net;
     } else {
-        if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+        if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
             (net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
             releaseaddr &&
             qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
@@ -890,8 +890,8 @@ try_remove:
         goto cleanup;
 
     if (vlan < 0) {
-        if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
-            qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+        if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) &&
+            qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
             char *netdev_name;
             if (virAsprintf(&netdev_name, "host%s", net->info.alias) < 0)
                 goto no_memory;
@@ -943,13 +943,13 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
                                      &hostdev, 1) < 0)
         return -1;
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
             goto error;
         if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, hostdev->info) < 0)
             goto error;
         releaseaddr = true;
-        if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_PCI_CONFIGFD)) {
+        if (qemuCapsGet(priv->caps, QEMU_CAPS_PCI_CONFIGFD)) {
             configfd = qemuOpenPCIConfig(hostdev);
             if (configfd >= 0) {
                 if (virAsprintf(&configfd_name, "fd-%s",
@@ -967,7 +967,7 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
         }
 
         if (!(devstr = qemuBuildPCIHostdevDevStr(hostdev, configfd_name,
-                                                 priv->qemuCaps)))
+                                                 priv->caps)))
             goto error;
 
         qemuDomainObjEnterMonitorWithDriver(driver, vm);
@@ -999,7 +999,7 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
     return 0;
 
 error:
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
         (hostdev->info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
         releaseaddr &&
         qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
@@ -1024,10 +1024,10 @@ int qemuDomainAttachRedirdevDevice(struct qemud_driver *driver,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     char *devstr = NULL;
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceRedirdevAlias(vm->def, redirdev, -1) < 0)
             goto error;
-        if (!(devstr = qemuBuildRedirdevDevStr(redirdev, priv->qemuCaps)))
+        if (!(devstr = qemuBuildRedirdevDevStr(redirdev, priv->caps)))
             goto error;
     }
 
@@ -1037,7 +1037,7 @@ int qemuDomainAttachRedirdevDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE))
         ret = qemuMonitorAddDevice(priv->mon, devstr);
     else
         goto error;
@@ -1067,10 +1067,10 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     char *devstr = NULL;
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
             goto error;
-        if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev, priv->qemuCaps)))
+        if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev, priv->caps)))
             goto error;
     }
 
@@ -1102,7 +1102,7 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE))
         ret = qemuMonitorAddDevice(priv->mon, devstr);
     else
         ret = qemuMonitorAddUSBDeviceExact(priv->mon,
@@ -1696,7 +1696,7 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             virDomainAuditDisk(vm, detach->src, NULL, "detach", false);
@@ -1718,7 +1718,7 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
 
     virDomainAuditDisk(vm, detach->src, NULL, "detach", true);
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
         qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
                                         detach->info.addr.pci.slot) < 0)
         VIR_WARN("Unable to release PCI address on %s", dev->data.disk->src);
@@ -1766,7 +1766,7 @@ int qemuDomainDetachDiskDevice(struct qemud_driver *driver,
         goto cleanup;
     }
 
-    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (!qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        _("Underlying qemu does not support %s disk removal"),
                        virDomainDiskBusTypeToString(dev->data.disk->bus));
@@ -1921,13 +1921,13 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
         goto cleanup;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceControllerAlias(detach) < 0)
             goto cleanup;
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             goto cleanup;
@@ -1944,7 +1944,7 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
     virDomainControllerRemove(vm->def, idx);
     virDomainControllerDefFree(detach);
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
         qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
                                         detach->info.addr.pci.slot) < 0)
         VIR_WARN("Unable to release PCI address on controller");
@@ -1982,7 +1982,7 @@ qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorDelDevice(priv->mon, detach->info->alias);
     } else {
         ret = qemuMonitorRemovePCIDevice(priv->mon, &detach->info->addr.pci);
@@ -2017,7 +2017,7 @@ qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
         ret = -1;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
         qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
                                         detach->info->addr.pci.slot) < 0)
         VIR_WARN("Unable to release PCI address on host device");
@@ -2041,7 +2041,7 @@ qemuDomainDetachHostUsbDevice(struct qemud_driver *driver,
         return -1;
     }
 
-    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (!qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         virReportError(VIR_ERR_OPERATION_FAILED,
                        "%s", _("device cannot be detached with this QEMU version"));
         return -1;
@@ -2232,7 +2232,7 @@ qemuDomainDetachNetDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             virDomainAuditNet(vm, detach, NULL, "detach", false);
@@ -2247,8 +2247,8 @@ qemuDomainDetachNetDevice(struct qemud_driver *driver,
         }
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV) &&
-        qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV) &&
+        qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) {
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             virDomainAuditNet(vm, detach, NULL, "detach", false);
@@ -2265,7 +2265,7 @@ qemuDomainDetachNetDevice(struct qemud_driver *driver,
 
     virDomainAuditNet(vm, detach, NULL, "detach", true);
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE) &&
         qemuDomainPCIAddressReleaseSlot(priv->pciaddrs,
                                         detach->info.addr.pci.slot) < 0)
         VIR_WARN("Unable to release PCI address on NIC");
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 1b21ef6..99fc8ce 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -1905,7 +1905,7 @@ qemuMigrationRun(struct qemud_driver *driver,
         break;
 
     case MIGRATION_DEST_UNIX:
-        if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) {
+        if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_UNIX)) {
             ret = qemuMonitorMigrateToUnix(priv->mon, migrate_flags,
                                            spec->dest.unix_socket.file);
         } else {
@@ -2058,7 +2058,7 @@ static int doNativeMigrate(struct qemud_driver *driver,
     if (!uribits)
         return -1;
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD))
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD))
         spec.destType = MIGRATION_DEST_CONNECT_HOST;
     else
         spec.destType = MIGRATION_DEST_HOST;
@@ -2099,9 +2099,9 @@ static int doTunnelMigrate(struct qemud_driver *driver,
               driver, vm, st, NULLSTR(cookiein), cookieinlen,
               cookieout, cookieoutlen, flags, resource);
 
-    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
-        !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_UNIX) &&
-        !qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
+    if (!qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
+        !qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_UNIX) &&
+        !qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
         virReportError(VIR_ERR_OPERATION_FAILED, "%s",
                        _("Source qemu is too old to support tunnelled migration"));
         return -1;
@@ -2110,7 +2110,7 @@ static int doTunnelMigrate(struct qemud_driver *driver,
     spec.fwdType = MIGRATION_FWD_STREAM;
     spec.fwd.stream = st;
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD)) {
         int fds[2];
 
         spec.destType = MIGRATION_DEST_FD;
@@ -3192,7 +3192,7 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
         qemuDomainObjExitMonitorWithDriver(driver, vm);
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
         (!compressor || pipe(pipeFD) == 0)) {
         /* All right! We can use fd migration, which means that qemu
          * doesn't have to open() the file, so while we still have to
@@ -3243,7 +3243,7 @@ qemuMigrationToFile(struct qemud_driver *driver, virDomainObjPtr vm,
     if (!compressor) {
         const char *args[] = { "cat", NULL };
 
-        if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
+        if (qemuCapsGet(priv->caps, QEMU_CAPS_MIGRATE_QEMU_FD) &&
             priv->monConfig->type == VIR_DOMAIN_CHR_TYPE_UNIX) {
             rc = qemuMonitorMigrateToFd(priv->mon,
                                         QEMU_MONITOR_MIGRATE_BACKGROUND,
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index e04af72..f8d717f 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -1127,7 +1127,7 @@ int qemuMonitorEmitBalloonChange(qemuMonitorPtr mon,
 
 
 int qemuMonitorSetCapabilities(qemuMonitorPtr mon,
-                               virBitmapPtr qemuCaps)
+                               qemuCapsPtr caps)
 {
     int ret;
     VIR_DEBUG("mon=%p", mon);
@@ -1143,11 +1143,11 @@ int qemuMonitorSetCapabilities(qemuMonitorPtr mon,
         if (ret < 0)
             goto cleanup;
 
-        ret = qemuMonitorJSONCheckCommands(mon, qemuCaps);
+        ret = qemuMonitorJSONCheckCommands(mon, caps);
         if (ret < 0)
             goto cleanup;
 
-        ret = qemuMonitorJSONCheckEvents(mon, qemuCaps);
+        ret = qemuMonitorJSONCheckEvents(mon, caps);
         if (ret < 0)
             goto cleanup;
     } else {
diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h
index 0f7ca2d..f206d49 100644
--- a/src/qemu/qemu_monitor.h
+++ b/src/qemu/qemu_monitor.h
@@ -27,6 +27,7 @@
 
 # include "internal.h"
 
+# include "qemu_capabilities.h"
 # include "domain_conf.h"
 # include "qemu_conf.h"
 # include "bitmap.h"
@@ -156,7 +157,7 @@ qemuMonitorPtr qemuMonitorOpenFD(virDomainObjPtr vm,
 void qemuMonitorClose(qemuMonitorPtr mon);
 
 int qemuMonitorSetCapabilities(qemuMonitorPtr mon,
-                               virBitmapPtr qemuCaps);
+                               qemuCapsPtr caps);
 
 int qemuMonitorCheckHMP(qemuMonitorPtr mon, const char *cmd);
 
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 10a68c6..11b85d9 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -974,7 +974,7 @@ qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon)
  */
 int
 qemuMonitorJSONCheckCommands(qemuMonitorPtr mon,
-                             virBitmapPtr qemuCaps)
+                             qemuCapsPtr caps)
 {
     int ret = -1;
     virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("query-commands", NULL);
@@ -1003,15 +1003,15 @@ qemuMonitorJSONCheckCommands(qemuMonitorPtr mon,
             goto cleanup;
 
         if (STREQ(name, "system_wakeup"))
-            qemuCapsSet(qemuCaps, QEMU_CAPS_WAKEUP);
+            qemuCapsSet(caps, QEMU_CAPS_WAKEUP);
         else if (STREQ(name, "transaction"))
-            qemuCapsSet(qemuCaps, QEMU_CAPS_TRANSACTION);
+            qemuCapsSet(caps, QEMU_CAPS_TRANSACTION);
         else if (STREQ(name, "block_job_cancel"))
-            qemuCapsSet(qemuCaps, QEMU_CAPS_BLOCKJOB_SYNC);
+            qemuCapsSet(caps, QEMU_CAPS_BLOCKJOB_SYNC);
         else if (STREQ(name, "block-job-cancel"))
-            qemuCapsSet(qemuCaps, QEMU_CAPS_BLOCKJOB_ASYNC);
+            qemuCapsSet(caps, QEMU_CAPS_BLOCKJOB_ASYNC);
         else if (STREQ(name, "dump-guest-memory"))
-            qemuCapsSet(qemuCaps, QEMU_CAPS_DUMP_GUEST_MEMORY);
+            qemuCapsSet(caps, QEMU_CAPS_DUMP_GUEST_MEMORY);
     }
 
     ret = 0;
@@ -1025,7 +1025,7 @@ cleanup:
 
 int
 qemuMonitorJSONCheckEvents(qemuMonitorPtr mon,
-                           virBitmapPtr qemuCaps)
+                           qemuCapsPtr caps)
 {
     int ret = -1;
     virJSONValuePtr cmd = qemuMonitorJSONMakeCommand("query-events", NULL);
@@ -1061,7 +1061,7 @@ qemuMonitorJSONCheckEvents(qemuMonitorPtr mon,
             goto cleanup;
 
         if (STREQ(name, "BALLOON_CHANGE"))
-            qemuCapsSet(qemuCaps, QEMU_CAPS_BALLOON_EVENT);
+            qemuCapsSet(caps, QEMU_CAPS_BALLOON_EVENT);
     }
 
     ret = 0;
diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h
index f6e34f4..d092b88 100644
--- a/src/qemu/qemu_monitor_json.h
+++ b/src/qemu/qemu_monitor_json.h
@@ -43,9 +43,9 @@ int qemuMonitorJSONHumanCommandWithFd(qemuMonitorPtr mon,
 int qemuMonitorJSONSetCapabilities(qemuMonitorPtr mon);
 
 int qemuMonitorJSONCheckCommands(qemuMonitorPtr mon,
-                                 virBitmapPtr qemuCaps);
+                                 qemuCapsPtr caps);
 int qemuMonitorJSONCheckEvents(qemuMonitorPtr mon,
-                               virBitmapPtr qemuCaps);
+                               qemuCapsPtr caps);
 
 int qemuMonitorJSONStartCPUs(qemuMonitorPtr mon,
                              virConnectPtr conn);
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 77d679a..5ac1d2b 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1262,7 +1262,7 @@ qemuConnectMonitor(struct qemud_driver *driver, virDomainObjPtr vm)
 
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    ret = qemuMonitorSetCapabilities(priv->mon, priv->qemuCaps);
+    ret = qemuMonitorSetCapabilities(priv->mon, priv->caps);
     qemuDomainObjExitMonitorWithDriver(driver, vm);
 
 error:
@@ -1472,10 +1472,10 @@ qemuProcessLookupPTYs(virDomainChrDefPtr *devices,
 
 static int
 qemuProcessFindCharDevicePTYsMonitor(virDomainObjPtr vm,
-                                     virBitmapPtr qemuCaps,
+                                     qemuCapsPtr caps,
                                      virHashTablePtr paths)
 {
-    bool chardevfmt = qemuCapsGet(qemuCaps, QEMU_CAPS_CHARDEV);
+    bool chardevfmt = qemuCapsGet(caps, QEMU_CAPS_CHARDEV);
 
     if (qemuProcessLookupPTYs(vm->def->serials, vm->def->nserials,
                               paths, chardevfmt) < 0)
@@ -1584,7 +1584,7 @@ qemuProcessReadLogFD(int logfd, char *buf, int maxlen, int off)
 static int
 qemuProcessWaitForMonitor(struct qemud_driver* driver,
                           virDomainObjPtr vm,
-                          virBitmapPtr qemuCaps,
+                          qemuCapsPtr caps,
                           off_t pos)
 {
     char *buf = NULL;
@@ -1629,7 +1629,7 @@ qemuProcessWaitForMonitor(struct qemud_driver* driver,
 
     VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret);
     if (ret == 0)
-        ret = qemuProcessFindCharDevicePTYsMonitor(vm, qemuCaps, paths);
+        ret = qemuProcessFindCharDevicePTYsMonitor(vm, caps, paths);
 
 cleanup:
     virHashFree(paths);
@@ -1930,7 +1930,7 @@ qemuProcessSetLinkStates(virDomainObjPtr vm)
         if (def->nets[i]->linkstate == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN) {
             VIR_DEBUG("Setting link state: %s", def->nets[i]->info.alias);
 
-            if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NETDEV)) {
+            if (!qemuCapsGet(priv->caps, QEMU_CAPS_NETDEV)) {
                 virReportError(VIR_ERR_NO_SUPPORT, "%s",
                                _("Setting of link state is not supported by this qemu"));
                 return -1;
@@ -2091,7 +2091,7 @@ qemuProcessInitPasswords(virConnectPtr conn,
     if (ret < 0)
         goto cleanup;
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         int i;
 
         for (i = 0 ; i < vm->def->ndisks ; i++) {
@@ -3163,11 +3163,11 @@ qemuProcessReconnect(void *opaque)
     /* If upgrading from old libvirtd we won't have found any
      * caps in the domain status, so re-query them
      */
-    if (!priv->qemuCaps &&
+    if (!priv->caps &&
         qemuCapsExtractVersionInfo(obj->def->emulator, obj->def->os.arch,
                                    false,
                                    NULL,
-                                   &priv->qemuCaps) < 0)
+                                   &priv->caps) < 0)
         goto error;
 
     /* In case the domain shutdown while we were not running,
@@ -3183,8 +3183,8 @@ qemuProcessReconnect(void *opaque)
         goto endjob;
     }
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE))
-        if ((qemuDomainAssignAddresses(obj->def, priv->qemuCaps, obj)) < 0)
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE))
+        if ((qemuDomainAssignAddresses(obj->def, priv->caps, obj)) < 0)
             goto error;
 
     if (virSecurityManagerReserveLabel(driver->securityManager, obj->def, obj->pid) < 0)
@@ -3256,7 +3256,7 @@ error:
              * to remove danger of it ending up running twice if
              * user tries to start it again later
              */
-            if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_NO_SHUTDOWN)) {
+            if (qemuCapsGet(priv->caps, QEMU_CAPS_NO_SHUTDOWN)) {
                 /* If we couldn't get the monitor and qemu supports
                  * no-shutdown, we can safely say that the domain
                  * crashed ... */
@@ -3563,15 +3563,15 @@ int qemuProcessStart(virConnectPtr conn,
     }
 
     VIR_DEBUG("Determining emulator version");
-    qemuCapsFree(priv->qemuCaps);
-    priv->qemuCaps = NULL;
+    virObjectUnref(priv->caps);
+    priv->caps = NULL;
     if (qemuCapsExtractVersionInfo(vm->def->emulator, vm->def->os.arch,
                                    true,
                                    NULL,
-                                   &priv->qemuCaps) < 0)
+                                   &priv->caps) < 0)
         goto cleanup;
 
-    if (qemuAssignDeviceAliases(vm->def, priv->qemuCaps) < 0)
+    if (qemuAssignDeviceAliases(vm->def, priv->caps) < 0)
         goto cleanup;
 
     VIR_DEBUG("Checking for CDROM and floppy presence");
@@ -3616,7 +3616,7 @@ int qemuProcessStart(virConnectPtr conn,
     if (qemuProcessPrepareMonitorChr(driver, priv->monConfig, vm->def->name) < 0)
         goto cleanup;
 
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_MONITOR_JSON))
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_MONITOR_JSON))
         priv->monJSON = 1;
     else
         priv->monJSON = 0;
@@ -3647,15 +3647,15 @@ int qemuProcessStart(virConnectPtr conn,
      * we also need to populate the PCi address set cache for later
      * use in hotplug
      */
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         VIR_DEBUG("Assigning domain PCI addresses");
-        if ((qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm)) < 0)
+        if ((qemuDomainAssignAddresses(vm->def, priv->caps, vm)) < 0)
             goto cleanup;
     }
 
     VIR_DEBUG("Building emulator command line");
     if (!(cmd = qemuBuildCommandLine(conn, driver, vm->def, priv->monConfig,
-                                     priv->monJSON != 0, priv->qemuCaps,
+                                     priv->monJSON != 0, priv->caps,
                                      migrateFrom, stdin_fd, snapshot, vmop)))
         goto cleanup;
 
@@ -3800,7 +3800,7 @@ int qemuProcessStart(virConnectPtr conn,
         goto cleanup;
 
     VIR_DEBUG("Waiting for monitor to show up");
-    if (qemuProcessWaitForMonitor(driver, vm, priv->qemuCaps, pos) < 0)
+    if (qemuProcessWaitForMonitor(driver, vm, priv->caps, pos) < 0)
         goto cleanup;
 
     /* Failure to connect to agent shouldn't be fatal */
@@ -3837,7 +3837,7 @@ int qemuProcessStart(virConnectPtr conn,
 
     /* If we have -device, then addresses are assigned explicitly.
      * If not, then we have to detect dynamic ones here */
-    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (!qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         VIR_DEBUG("Determining domain device PCI addresses");
         if (qemuProcessInitPCIAddresses(driver, vm) < 0)
             goto cleanup;
@@ -4222,8 +4222,8 @@ retry:
     virDomainObjSetState(vm, VIR_DOMAIN_SHUTOFF, reason);
     VIR_FREE(priv->vcpupids);
     priv->nvcpupids = 0;
-    qemuCapsFree(priv->qemuCaps);
-    priv->qemuCaps = NULL;
+    virObjectUnref(priv->caps);
+    priv->caps = NULL;
     VIR_FREE(priv->pidfile);
 
     /* The "release" hook cleans up additional resources */
@@ -4333,13 +4333,13 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
         goto cleanup;
 
     VIR_DEBUG("Determining emulator version");
-    qemuCapsFree(priv->qemuCaps);
-    priv->qemuCaps = NULL;
+    virObjectUnref(priv->caps);
+    priv->caps = NULL;
     if (qemuCapsExtractVersionInfo(vm->def->emulator,
                                    vm->def->os.arch,
                                    false,
                                    NULL,
-                                   &priv->qemuCaps) < 0)
+                                   &priv->caps) < 0)
         goto cleanup;
 
     VIR_DEBUG("Preparing monitor state");
@@ -4356,9 +4356,9 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
      * we also need to populate the PCi address set cache for later
      * use in hotplug
      */
-    if (qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         VIR_DEBUG("Assigning domain PCI addresses");
-        if ((qemuDomainAssignAddresses(vm->def, priv->qemuCaps, vm)) < 0)
+        if ((qemuDomainAssignAddresses(vm->def, priv->caps, vm)) < 0)
             goto cleanup;
     }
 
@@ -4380,7 +4380,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
     vm->pid = pid;
 
     VIR_DEBUG("Waiting for monitor to show up");
-    if (qemuProcessWaitForMonitor(driver, vm, priv->qemuCaps, -1) < 0)
+    if (qemuProcessWaitForMonitor(driver, vm, priv->caps, -1) < 0)
         goto cleanup;
 
     /* Failure to connect to agent shouldn't be fatal */
@@ -4397,7 +4397,7 @@ int qemuProcessAttach(virConnectPtr conn ATTRIBUTE_UNUSED,
 
     /* If we have -device, then addresses are assigned explicitly.
      * If not, then we have to detect dynamic ones here */
-    if (!qemuCapsGet(priv->qemuCaps, QEMU_CAPS_DEVICE)) {
+    if (!qemuCapsGet(priv->caps, QEMU_CAPS_DEVICE)) {
         VIR_DEBUG("Determining domain device PCI addresses");
         if (qemuProcessInitPCIAddresses(driver, vm) < 0)
             goto cleanup;
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 0d884f4..748c43f 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -11,14 +11,14 @@
 
 struct testInfo {
     const char *name;
-    virBitmapPtr flags;
+    qemuCapsPtr flags;
     unsigned int version;
     unsigned int is_kvm;
     unsigned int kvm_version;
 };
 
-static void printMismatchedFlags(virBitmapPtr got,
-                                 virBitmapPtr expect)
+static void printMismatchedFlags(qemuCapsPtr got,
+                                 qemuCapsPtr expect)
 {
     int i;
 
@@ -38,7 +38,7 @@ static int testHelpStrParsing(const void *data)
     char *path = NULL;
     char *help = NULL;
     unsigned int version, is_kvm, kvm_version;
-    virBitmapPtr flags = NULL;
+    qemuCapsPtr flags = NULL;
     int ret = -1;
     char *got = NULL;
     char *expected = NULL;
@@ -75,8 +75,8 @@ static int testHelpStrParsing(const void *data)
             goto cleanup;
     }
 
-    got = virBitmapString(flags);
-    expected = virBitmapString(info->flags);
+    got = qemuCapsFlagsString(flags);
+    expected = qemuCapsFlagsString(info->flags);
     if (!got || !expected)
         goto cleanup;
 
@@ -116,7 +116,7 @@ static int testHelpStrParsing(const void *data)
 cleanup:
     VIR_FREE(path);
     VIR_FREE(help);
-    qemuCapsFree(flags);
+    virObjectUnref(flags);
     VIR_FREE(got);
     VIR_FREE(expected);
     return ret;
@@ -138,7 +138,7 @@ mymain(void)
         if (virtTestRun("QEMU Help String Parsing " name,                   \
                         1, testHelpStrParsing, &info) < 0)                  \
             ret = -1;                                                       \
-        qemuCapsFree(info.flags);                                           \
+        virObjectUnref(info.flags);                                         \
     } while (0)
 
     DO_TEST("qemu-0.9.1", 9001, 0, 0,
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 47c3f6c..11b9aab 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -78,7 +78,7 @@ typedef enum {
 
 static int testCompareXMLToArgvFiles(const char *xml,
                                      const char *cmdline,
-                                     virBitmapPtr extraFlags,
+                                     qemuCapsPtr extraFlags,
                                      const char *migrateFrom,
                                      int migrateFd,
                                      virQemuXML2ArgvTestFlags flags)
@@ -235,7 +235,7 @@ out:
 
 struct testInfo {
     const char *name;
-    virBitmapPtr extraFlags;
+    qemuCapsPtr extraFlags;
     const char *migrateFrom;
     int migrateFd;
     unsigned int flags;
@@ -311,7 +311,7 @@ mymain(void)
         if (virtTestRun("QEMU XML-2-ARGV " name,                        \
                         1, testCompareXMLToArgvHelper, &info) < 0)      \
             ret = -1;                                                   \
-        qemuCapsFree(info.extraFlags);                                  \
+        virObjectUnref(info.extraFlags);                                \
     } while (0)
 
 # define DO_TEST(name, ...)                                             \
diff --git a/tests/qemuxmlnstest.c b/tests/qemuxmlnstest.c
index 253c89e..43b5fe6 100644
--- a/tests/qemuxmlnstest.c
+++ b/tests/qemuxmlnstest.c
@@ -25,7 +25,7 @@ static struct qemud_driver driver;
 
 static int testCompareXMLToArgvFiles(const char *xml,
                                      const char *cmdline,
-                                     virBitmapPtr extraFlags,
+                                     qemuCapsPtr extraFlags,
                                      const char *migrateFrom,
                                      int migrateFd,
                                      bool json,
@@ -164,7 +164,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
 
 struct testInfo {
     const char *name;
-    virBitmapPtr extraFlags;
+    qemuCapsPtr extraFlags;
     const char *migrateFrom;
     int migrateFd;
     bool json;
@@ -238,7 +238,7 @@ mymain(void)
         if (virtTestRun("QEMU XML-2-ARGV " name,                        \
                         1, testCompareXMLToArgvHelper, &info) < 0)      \
             ret = -1;                                                   \
-        qemuCapsFree(info.extraFlags);                                  \
+        virObjectUnref(info.extraFlags);                                \
     } while (0)
 
 # define DO_TEST(name, expectError, ...)                                \
-- 
1.7.11.4

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