[PATCH v2 4/7] qemu: Use helper functions for handling cmd line capabilities

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

 



---
Notes:
    Version 2:
    - rebased to current master

 src/qemu/qemu_capabilities.c |  156 ++++++++++++++-----------
 src/qemu/qemu_capabilities.h |    9 ++
 src/qemu/qemu_command.c      |  263 +++++++++++++++++++++--------------------
 src/qemu/qemu_hotplug.c      |   86 +++++++-------
 src/qemu/qemu_migration.c    |   12 +-
 src/qemu/qemu_process.c      |   10 +-
 tests/qemuhelptest.c         |    2 +-
 tests/qemuxml2argvtest.c     |    4 +-
 8 files changed, 291 insertions(+), 251 deletions(-)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6959cec..94a2289 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -400,7 +400,7 @@ qemuCapsProbeCPUModels(const char *qemu,
     }
 
     cmd = virCommandNewArgList(qemu, "-cpu", "?", NULL);
-    if (qemuCmdFlags & QEMU_CAPS_NODEFCONFIG)
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NODEFCONFIG))
         virCommandAddArg(cmd, "-nodefconfig");
     virCommandAddEnvPassCommon(cmd);
     virCommandSetOutputBuffer(cmd, &output);
@@ -559,7 +559,7 @@ qemuCapsInitGuest(virCapsPtr caps,
         goto error;
 
     if (qemuCapsExtractVersionInfo(binary, info->arch, NULL, &qemuCmdFlags) < 0 ||
-        ((qemuCmdFlags & QEMU_CAPS_BOOTINDEX) &&
+        (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_BOOTINDEX) &&
          !virCapabilitiesAddGuestFeature(guest, "deviceboot", 1, 0)))
         goto error;
 
@@ -791,119 +791,119 @@ qemuCapsComputeCmdFlags(const char *help,
     const char *p;
 
     if (strstr(help, "-no-kqemu"))
-        flags |= QEMU_CAPS_KQEMU;
+        qemuCapsSet(&flags, QEMU_CAPS_KQEMU);
     if (strstr(help, "-enable-kqemu"))
-        flags |= QEMU_CAPS_ENABLE_KQEMU;
+        qemuCapsSet(&flags, QEMU_CAPS_ENABLE_KQEMU);
     if (strstr(help, "-no-kvm"))
-        flags |= QEMU_CAPS_KVM;
+        qemuCapsSet(&flags, QEMU_CAPS_KVM);
     if (strstr(help, "-enable-kvm"))
-        flags |= QEMU_CAPS_ENABLE_KVM;
+        qemuCapsSet(&flags, QEMU_CAPS_ENABLE_KVM);
     if (strstr(help, "-no-reboot"))
-        flags |= QEMU_CAPS_NO_REBOOT;
+        qemuCapsSet(&flags, QEMU_CAPS_NO_REBOOT);
     if (strstr(help, "-name")) {
-        flags |= QEMU_CAPS_NAME;
+        qemuCapsSet(&flags, QEMU_CAPS_NAME);
         if (strstr(help, ",process="))
-            flags |= QEMU_CAPS_NAME_PROCESS;
+            qemuCapsSet(&flags, QEMU_CAPS_NAME_PROCESS);
     }
     if (strstr(help, "-uuid"))
-        flags |= QEMU_CAPS_UUID;
+        qemuCapsSet(&flags, QEMU_CAPS_UUID);
     if (strstr(help, "-xen-domid"))
-        flags |= QEMU_CAPS_XEN_DOMID;
+        qemuCapsSet(&flags, QEMU_CAPS_XEN_DOMID);
     else if (strstr(help, "-domid"))
-        flags |= QEMU_CAPS_DOMID;
+        qemuCapsSet(&flags, QEMU_CAPS_DOMID);
     if (strstr(help, "-drive")) {
-        flags |= QEMU_CAPS_DRIVE;
+        qemuCapsSet(&flags, QEMU_CAPS_DRIVE);
         if (strstr(help, "cache=") &&
             !strstr(help, "cache=on|off"))
-            flags |= QEMU_CAPS_DRIVE_CACHE_V2;
+            qemuCapsSet(&flags, QEMU_CAPS_DRIVE_CACHE_V2);
         if (strstr(help, "format="))
-            flags |= QEMU_CAPS_DRIVE_FORMAT;
+            qemuCapsSet(&flags, QEMU_CAPS_DRIVE_FORMAT);
         if (strstr(help, "readonly="))
-            flags |= QEMU_CAPS_DRIVE_READONLY;
+            qemuCapsSet(&flags, QEMU_CAPS_DRIVE_READONLY);
         if (strstr(help, "aio=threads|native"))
-            flags |= QEMU_CAPS_DRIVE_AIO;
+            qemuCapsSet(&flags, QEMU_CAPS_DRIVE_AIO);
     }
     if ((p = strstr(help, "-vga")) && !strstr(help, "-std-vga")) {
         const char *nl = strstr(p, "\n");
 
-        flags |= QEMU_CAPS_VGA;
+        qemuCapsSet(&flags, QEMU_CAPS_VGA);
 
         if (strstr(p, "|qxl"))
-            flags |= QEMU_CAPS_VGA_QXL;
+            qemuCapsSet(&flags, QEMU_CAPS_VGA_QXL);
         if ((p = strstr(p, "|none")) && p < nl)
-            flags |= QEMU_CAPS_VGA_NONE;
+            qemuCapsSet(&flags, QEMU_CAPS_VGA_NONE);
     }
     if (strstr(help, "-spice"))
-        flags |= QEMU_CAPS_SPICE;
+        qemuCapsSet(&flags, QEMU_CAPS_SPICE);
     if (strstr(help, "boot=on"))
-        flags |= QEMU_CAPS_DRIVE_BOOT;
+        qemuCapsSet(&flags, QEMU_CAPS_DRIVE_BOOT);
     if (strstr(help, "serial=s"))
-        flags |= QEMU_CAPS_DRIVE_SERIAL;
+        qemuCapsSet(&flags, QEMU_CAPS_DRIVE_SERIAL);
     if (strstr(help, "-pcidevice"))
-        flags |= QEMU_CAPS_PCIDEVICE;
+        qemuCapsSet(&flags, QEMU_CAPS_PCIDEVICE);
     if (strstr(help, "-mem-path"))
-        flags |= QEMU_CAPS_MEM_PATH;
+        qemuCapsSet(&flags, QEMU_CAPS_MEM_PATH);
     if (strstr(help, "-chardev")) {
-        flags |= QEMU_CAPS_CHARDEV;
+        qemuCapsSet(&flags, QEMU_CAPS_CHARDEV);
         if (strstr(help, "-chardev spicevmc"))
-            flags |= QEMU_CAPS_CHARDEV_SPICEVMC;
+            qemuCapsSet(&flags, QEMU_CAPS_CHARDEV_SPICEVMC);
     }
     if (strstr(help, "-balloon"))
-        flags |= QEMU_CAPS_BALLOON;
+        qemuCapsSet(&flags, QEMU_CAPS_BALLOON);
     if (strstr(help, "-device")) {
-        flags |= QEMU_CAPS_DEVICE;
+        qemuCapsSet(&flags, QEMU_CAPS_DEVICE);
         /*
          * When -device was introduced, qemu already supported drive's
          * readonly option but didn't advertise that.
          */
-        flags |= QEMU_CAPS_DRIVE_READONLY;
+        qemuCapsSet(&flags, QEMU_CAPS_DRIVE_READONLY);
     }
     if (strstr(help, "-nodefconfig"))
-        flags |= QEMU_CAPS_NODEFCONFIG;
+        qemuCapsSet(&flags, QEMU_CAPS_NODEFCONFIG);
     /* The trailing ' ' is important to avoid a bogus match */
     if (strstr(help, "-rtc "))
-        flags |= QEMU_CAPS_RTC;
+        qemuCapsSet(&flags, QEMU_CAPS_RTC);
     /* to wit */
     if (strstr(help, "-rtc-td-hack"))
-        flags |= QEMU_CAPS_RTC_TD_HACK;
+        qemuCapsSet(&flags, QEMU_CAPS_RTC_TD_HACK);
     if (strstr(help, "-no-hpet"))
-        flags |= QEMU_CAPS_NO_HPET;
+        qemuCapsSet(&flags, QEMU_CAPS_NO_HPET);
     if (strstr(help, "-no-kvm-pit-reinjection"))
-        flags |= QEMU_CAPS_NO_KVM_PIT;
+        qemuCapsSet(&flags, QEMU_CAPS_NO_KVM_PIT);
     if (strstr(help, "-tdf"))
-        flags |= QEMU_CAPS_TDF;
+        qemuCapsSet(&flags, QEMU_CAPS_TDF);
     if (strstr(help, "-enable-nesting"))
-        flags |= QEMU_CAPS_NESTING;
+        qemuCapsSet(&flags, QEMU_CAPS_NESTING);
     if (strstr(help, ",menu=on"))
-        flags |= QEMU_CAPS_BOOT_MENU;
+        qemuCapsSet(&flags, QEMU_CAPS_BOOT_MENU);
     if (strstr(help, "-fsdev"))
-        flags |= QEMU_CAPS_FSDEV;
+        qemuCapsSet(&flags, QEMU_CAPS_FSDEV);
     if (strstr(help, "-smbios type"))
-        flags |= QEMU_CAPS_SMBIOS_TYPE;
+        qemuCapsSet(&flags, QEMU_CAPS_SMBIOS_TYPE);
 
     if (strstr(help, "-netdev")) {
         /* Disable -netdev on 0.12 since although it exists,
          * the corresponding netdev_add/remove monitor commands
          * do not, and we need them to be able todo hotplug */
         if (version >= 13000)
-            flags |= QEMU_CAPS_NETDEV;
+            qemuCapsSet(&flags, QEMU_CAPS_NETDEV);
     }
 
     if (strstr(help, "-sdl"))
-        flags |= QEMU_CAPS_SDL;
+        qemuCapsSet(&flags, QEMU_CAPS_SDL);
     if (strstr(help, "cores=") &&
         strstr(help, "threads=") &&
         strstr(help, "sockets="))
-        flags |= QEMU_CAPS_SMP_TOPOLOGY;
+        qemuCapsSet(&flags, QEMU_CAPS_SMP_TOPOLOGY);
 
     if (version >= 9000)
-        flags |= QEMU_CAPS_VNC_COLON;
+        qemuCapsSet(&flags, QEMU_CAPS_VNC_COLON);
 
     if (is_kvm && (version >= 10000 || kvm_version >= 74))
-        flags |= QEMU_CAPS_VNET_HDR;
+        qemuCapsSet(&flags, QEMU_CAPS_VNET_HDR);
 
     if (is_kvm && strstr(help, ",vhost=")) {
-        flags |= QEMU_CAPS_VNET_HOST;
+        qemuCapsSet(&flags, QEMU_CAPS_VNET_HOST);
     }
 
     /*
@@ -919,22 +919,22 @@ qemuCapsComputeCmdFlags(const char *help,
      * while waiting for data, so pretend it doesn't exist
      */
     if (version >= 10000) {
-        flags |= QEMU_CAPS_MIGRATE_QEMU_TCP;
-        flags |= QEMU_CAPS_MIGRATE_QEMU_EXEC;
+        qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_TCP);
+        qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_EXEC);
         if (version >= 12000) {
-            flags |= QEMU_CAPS_MIGRATE_QEMU_UNIX;
-            flags |= QEMU_CAPS_MIGRATE_QEMU_FD;
+            qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_UNIX);
+            qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_FD);
         }
     } else if (kvm_version >= 79) {
-        flags |= QEMU_CAPS_MIGRATE_QEMU_TCP;
+        qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_TCP);
         if (kvm_version >= 80)
-            flags |= QEMU_CAPS_MIGRATE_QEMU_EXEC;
+            qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_QEMU_EXEC);
     } else if (kvm_version > 0) {
-        flags |= QEMU_CAPS_MIGRATE_KVM_STDIO;
+        qemuCapsSet(&flags, QEMU_CAPS_MIGRATE_KVM_STDIO);
     }
 
     if (version >= 10000)
-        flags |= QEMU_CAPS_0_10;
+        qemuCapsSet(&flags, QEMU_CAPS_0_10);
 
     /* While JSON mode was available in 0.12.0, it was too
      * incomplete to contemplate using. The 0.13.0 release
@@ -943,7 +943,7 @@ qemuCapsComputeCmdFlags(const char *help,
      * the downside.
      */
      if (version >= 13000)
-        flags |= QEMU_CAPS_MONITOR_JSON;
+        qemuCapsSet(&flags, QEMU_CAPS_MONITOR_JSON);
 
     return flags;
 }
@@ -1098,26 +1098,26 @@ qemuCapsParseDeviceStr(const char *str, unsigned long long *flags)
 {
     /* Which devices exist. */
     if (strstr(str, "name \"hda-duplex\""))
-        *flags |= QEMU_CAPS_HDA_DUPLEX;
+        qemuCapsSet(flags, QEMU_CAPS_HDA_DUPLEX);
     if (strstr(str, "name \"ccid-card-emulated\""))
-        *flags |= QEMU_CAPS_CCID_EMULATED;
+        qemuCapsSet(flags, QEMU_CAPS_CCID_EMULATED);
     if (strstr(str, "name \"ccid-card-passthru\""))
-        *flags |= QEMU_CAPS_CCID_PASSTHRU;
+        qemuCapsSet(flags, QEMU_CAPS_CCID_PASSTHRU);
     /* Prefer -chardev spicevmc (detected earlier) over -device spicevmc */
-    if (!(*flags & QEMU_CAPS_CHARDEV_SPICEVMC) &&
+    if (!qemuCapsGet(*flags, QEMU_CAPS_CHARDEV_SPICEVMC) &&
         strstr(str, "name \"spicevmc\""))
-        *flags |= QEMU_CAPS_DEVICE_SPICEVMC;
+        qemuCapsSet(flags, QEMU_CAPS_DEVICE_SPICEVMC);
 
     /* Features of given devices. */
     if (strstr(str, "pci-assign.configfd"))
-        *flags |= QEMU_CAPS_PCI_CONFIGFD;
+        qemuCapsSet(flags, QEMU_CAPS_PCI_CONFIGFD);
     if (strstr(str, "virtio-blk-pci.bootindex")) {
-        *flags |= QEMU_CAPS_BOOTINDEX;
+        qemuCapsSet(flags, QEMU_CAPS_BOOTINDEX);
         if (strstr(str, "pci-assign.bootindex"))
-            *flags |= QEMU_CAPS_PCI_BOOTINDEX;
+            qemuCapsSet(flags, QEMU_CAPS_PCI_BOOTINDEX);
     }
     if (strstr(str, "virtio-net-pci.tx="))
-        *flags |= QEMU_CAPS_VIRTIO_TX_ALG;
+        qemuCapsSet(flags, QEMU_CAPS_VIRTIO_TX_ALG);
 
     return 0;
 }
@@ -1161,12 +1161,12 @@ int qemuCapsExtractVersionInfo(const char *qemu, const char *arch,
     /* Currently only x86_64 and i686 support PCI-multibus. */
     if (STREQLEN(arch, "x86_64", 6) ||
         STREQLEN(arch, "i686", 4)) {
-        flags |= QEMU_CAPS_PCI_MULTIBUS;
+        qemuCapsSet(&flags, QEMU_CAPS_PCI_MULTIBUS);
     }
 
     /* qemuCapsExtractDeviceStr will only set additional flags if qemu
      * understands the 0.13.0+ notion of "-device driver,".  */
-    if ((flags & QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(flags, QEMU_CAPS_DEVICE) &&
         strstr(help, "-device driver,?") &&
         qemuCapsExtractDeviceStr(qemu, &flags) < 0)
         goto cleanup;
@@ -1231,3 +1231,27 @@ int qemuCapsExtractVersion(virCapsPtr caps,
 
     return 0;
 }
+
+
+void
+qemuCapsSet(unsigned long long *caps,
+            enum qemuCapsFlags flag)
+{
+    *caps |= flag;
+}
+
+
+void
+qemuCapsClear(unsigned long long *caps,
+              enum qemuCapsFlags flag)
+{
+    *caps &= ~flag;
+}
+
+
+bool
+qemuCapsGet(unsigned long long caps,
+            enum qemuCapsFlags flag)
+{
+    return !!(caps & flag);
+}
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 9a7898a..6752136 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -95,6 +95,15 @@ enum qemuCapsFlags {
     QEMU_CAPS_VIRTIO_TX_ALG = (1LL << 58), /* -device virtio-net-pci,tx=string */
 };
 
+void qemuCapsSet(unsigned long long *caps,
+                 enum qemuCapsFlags flag);
+
+void qemuCapsClear(unsigned long long *caps,
+                   enum qemuCapsFlags flag);
+
+bool qemuCapsGet(unsigned long long caps,
+                 enum qemuCapsFlags flag);
+
 virCapsPtr qemuCapsInit(virCapsPtr old_caps);
 
 int qemuCapsProbeMachineTypes(const char *binary,
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 983ccfa..b8bdbb1 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -119,7 +119,7 @@ qemuPhysIfaceConnect(virConnectPtr conn,
     int vnet_hdr = 0;
     int err;
 
-    if (qemuCmdFlags & QEMU_CAPS_VNET_HDR &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_VNET_HDR) &&
         net->model && STREQ(net->model, "virtio"))
         vnet_hdr = 1;
 
@@ -241,7 +241,7 @@ qemuNetworkIfaceConnect(virConnectPtr conn,
         template_ifname = 1;
     }
 
-    if (qemuCmdFlags & QEMU_CAPS_VNET_HDR &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_VNET_HDR) &&
         net->model && STREQ(net->model, "virtio"))
         vnet_hdr = 1;
 
@@ -319,9 +319,9 @@ qemuOpenVhostNet(virDomainNetDefPtr net,
     /* If qemu doesn't support vhost-net mode (including the -netdev command
      * option), don't try to open the device.
      */
-    if (!(qemuCmdFlags & QEMU_CAPS_VNET_HOST &&
-          qemuCmdFlags & QEMU_CAPS_NETDEV &&
-          qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+    if (!(qemuCapsGet(qemuCmdFlags, QEMU_CAPS_VNET_HOST) &&
+          qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NETDEV) &&
+          qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE))) {
         if (net->driver.virtio.name == VIR_DOMAIN_NET_BACKEND_TYPE_VHOST) {
             qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                             "%s", _("vhost-net is not supported with "
@@ -407,7 +407,7 @@ char *qemuDeviceDriveHostAlias(virDomainDiskDefPtr disk,
 {
     char *ret;
 
-    if (qemudCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemudCmdFlags, QEMU_CAPS_DEVICE)) {
         if (virAsprintf(&ret, "%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias) < 0) {
             virReportOOMError();
             return NULL;
@@ -503,8 +503,8 @@ no_memory:
 int
 qemuAssignDeviceDiskAlias(virDomainDiskDefPtr def, unsigned long long qemuCmdFlags)
 {
-    if (qemuCmdFlags & QEMU_CAPS_DRIVE) {
-        if (qemuCmdFlags & QEMU_CAPS_DEVICE)
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DRIVE)) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE))
             return qemuAssignDeviceDiskAliasCustom(def);
         else
             return qemuAssignDeviceDiskAliasFixed(def);
@@ -592,15 +592,15 @@ qemuAssignDeviceAliases(virDomainDefPtr def, unsigned long long qemuCmdFlags)
         if (qemuAssignDeviceDiskAlias(def->disks[i], qemuCmdFlags) < 0)
             return -1;
     }
-    if ((qemuCmdFlags & QEMU_CAPS_NET_NAME) ||
-        (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NET_NAME) ||
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         for (i = 0; i < def->nnets ; i++) {
             if (qemuAssignDeviceNetAlias(def, def->nets[i], i) < 0)
                 return -1;
         }
     }
 
-    if (!(qemuCmdFlags & QEMU_CAPS_DEVICE))
+    if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE))
         return 0;
 
     for (i = 0; i < def->nfss ; i++) {
@@ -728,7 +728,7 @@ qemuDomainAssignPCIAddresses(virDomainDefPtr def)
                                    &qemuCmdFlags) < 0)
         goto cleanup;
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (!(addrs = qemuDomainPCIAddressSetCreate(def)))
             goto cleanup;
 
@@ -1151,7 +1151,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 (qemuCmdFlags & QEMU_CAPS_PCI_MULTIBUS)
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_PCI_MULTIBUS))
             virBufferVSprintf(buf, ",bus=pci.0,addr=0x%x", info->addr.pci.slot);
         else
             virBufferVSprintf(buf, ",bus=pci,addr=0x%x", info->addr.pci.slot);
@@ -1311,7 +1311,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
             virBufferVSprintf(&opt, "file=%s,", disk->src);
         }
     }
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE)
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE))
         virBufferAddLit(&opt, "if=none");
     else
         virBufferVSprintf(&opt, "if=%s", bus);
@@ -1319,7 +1319,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
     if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
         virBufferAddLit(&opt, ",media=cdrom");
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         virBufferVSprintf(&opt, ",id=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
     } else {
         if (busid == -1 && unitid == -1) {
@@ -1337,14 +1337,14 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
         disk->bus != VIR_DOMAIN_DISK_BUS_IDE)
         virBufferAddLit(&opt, ",boot=on");
     if (disk->readonly &&
-        qemuCmdFlags & QEMU_CAPS_DRIVE_READONLY)
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DRIVE_READONLY))
         virBufferAddLit(&opt, ",readonly=on");
     if (disk->driverType && *disk->driverType != '\0' &&
         disk->type != VIR_DOMAIN_DISK_TYPE_DIR &&
-        qemuCmdFlags & QEMU_CAPS_DRIVE_FORMAT)
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DRIVE_FORMAT))
         virBufferVSprintf(&opt, ",format=%s", disk->driverType);
     if (disk->serial &&
-        (qemuCmdFlags & QEMU_CAPS_DRIVE_SERIAL)) {
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DRIVE_SERIAL)) {
         if (qemuSafeSerialParamValue(disk->serial) < 0)
             goto error;
         virBufferVSprintf(&opt, ",serial=%s", disk->serial);
@@ -1352,7 +1352,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
 
     if (disk->cachemode) {
         const char *mode =
-            (qemuCmdFlags & QEMU_CAPS_DRIVE_CACHE_V2) ?
+            qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DRIVE_CACHE_V2) ?
             qemuDiskCacheV2TypeToString(disk->cachemode) :
             qemuDiskCacheV1TypeToString(disk->cachemode);
 
@@ -1361,7 +1361,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
         virBufferAddLit(&opt, ",cache=off");
     }
 
-    if (qemuCmdFlags & QEMU_CAPS_MONITOR_JSON) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MONITOR_JSON)) {
         if (disk->error_policy) {
             virBufferVSprintf(&opt, ",werror=%s,rerror=%s",
                               virDomainDiskErrorPolicyTypeToString(disk->error_policy),
@@ -1370,7 +1370,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
     }
 
     if (disk->iomode) {
-        if (qemuCmdFlags & QEMU_CAPS_DRIVE_AIO) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DRIVE_AIO)) {
             virBufferVSprintf(&opt, ",aio=%s",
                               virDomainDiskIoTypeToString(disk->iomode));
         } else {
@@ -1436,7 +1436,7 @@ qemuBuildDriveDevStr(virDomainDiskDefPtr disk,
     }
     virBufferVSprintf(&opt, ",drive=%s%s", QEMU_DRIVE_HOST_PREFIX, disk->info.alias);
     virBufferVSprintf(&opt, ",id=%s", disk->info.alias);
-    if (disk->bootIndex && (qemuCmdFlags & QEMU_CAPS_BOOTINDEX))
+    if (disk->bootIndex && qemuCapsGet(qemuCmdFlags, QEMU_CAPS_BOOTINDEX))
         virBufferVSprintf(&opt, ",bootindex=%d", disk->bootIndex);
 
     if (virBufferError(&opt)) {
@@ -1622,7 +1622,7 @@ qemuBuildNicDevStr(virDomainNetDefPtr net,
 
     virBufferAdd(&buf, nic, strlen(nic));
     if (usingVirtio && net->driver.virtio.txmode) {
-        if (qemuCmdFlags & QEMU_CAPS_VIRTIO_TX_ALG) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_VIRTIO_TX_ALG)) {
             virBufferAddLit(&buf, ",tx=");
             switch (net->driver.virtio.txmode) {
                 case VIR_DOMAIN_NET_VIRTIO_TX_MODE_IOTHREAD:
@@ -1657,7 +1657,7 @@ qemuBuildNicDevStr(virDomainNetDefPtr net,
                       net->mac[4], net->mac[5]);
     if (qemuBuildDeviceAddressStr(&buf, &net->info, qemuCmdFlags) < 0)
         goto error;
-    if (net->bootIndex && (qemuCmdFlags & QEMU_CAPS_BOOTINDEX))
+    if (net->bootIndex && qemuCapsGet(qemuCmdFlags, QEMU_CAPS_BOOTINDEX))
         virBufferVSprintf(&buf, ",bootindex=%d", net->bootIndex);
 
     if (virBufferError(&buf)) {
@@ -2134,7 +2134,7 @@ qemuBuildChrChardevStr(virDomainChrSourceDefPtr dev, const char *alias,
         break;
 
     case VIR_DOMAIN_CHR_TYPE_SPICEVMC:
-        if (!(qemuCmdFlags & QEMU_CAPS_CHARDEV_SPICEVMC)) {
+        if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CHARDEV_SPICEVMC)) {
             qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                             _("spicevmc not supported in this QEMU binary"));
             goto error;
@@ -2249,7 +2249,7 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev,
     virBuffer buf = VIR_BUFFER_INITIALIZER;
     if (dev->deviceType == VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE)
         virBufferAddLit(&buf, "virtconsole");
-    else if ((qemuCmdFlags & QEMU_CAPS_DEVICE_SPICEVMC) &&
+    else if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE_SPICEVMC) &&
              dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC)
         virBufferAddLit(&buf, "spicevmc");
     else
@@ -2282,7 +2282,7 @@ qemuBuildVirtioSerialPortDevStr(virDomainChrDefPtr dev,
                         dev->target.name);
         goto error;
     }
-    if ((qemuCmdFlags & QEMU_CAPS_DEVICE_SPICEVMC) &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE_SPICEVMC) &&
         dev->source.type == VIR_DOMAIN_CHR_TYPE_SPICEVMC) {
         virBufferVSprintf(&buf, ",id=%s", dev->info.alias);
     } else {
@@ -2613,7 +2613,7 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
 
     virBufferVSprintf(&buf, "%u", def->vcpus);
 
-    if ((qemuCmdFlags & QEMU_CAPS_SMP_TOPOLOGY)) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_SMP_TOPOLOGY)) {
         if (def->vcpus != def->maxvcpus)
             virBufferVSprintf(&buf, ",maxcpus=%u", def->maxvcpus);
         /* sockets, cores, and threads are either all zero
@@ -2696,26 +2696,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 ((qemuCmdFlags & QEMU_CAPS_KVM) &&
-        (def->virtType == VIR_DOMAIN_VIRT_QEMU) &&
-        (qemuCmdFlags & QEMU_CAPS_DRIVE_BOOT))
-        qemuCmdFlags -= QEMU_CAPS_DRIVE_BOOT;
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_KVM) &&
+        (def->virtType == VIR_DOMAIN_VIRT_QEMU))
+        qemuCapsClear(&qemuCmdFlags, QEMU_CAPS_DRIVE_BOOT);
 
     switch (def->virtType) {
     case VIR_DOMAIN_VIRT_QEMU:
-        if (qemuCmdFlags & QEMU_CAPS_KQEMU)
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_KQEMU))
             disableKQEMU = 1;
-        if (qemuCmdFlags & QEMU_CAPS_KVM)
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_KVM))
             disableKVM = 1;
         break;
 
     case VIR_DOMAIN_VIRT_KQEMU:
-        if (qemuCmdFlags & QEMU_CAPS_KVM)
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_KVM))
             disableKVM = 1;
 
-        if (qemuCmdFlags & QEMU_CAPS_ENABLE_KQEMU) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_ENABLE_KQEMU)) {
             enableKQEMU = 1;
-        } else if (!(qemuCmdFlags & QEMU_CAPS_KQEMU)) {
+        } else if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_KQEMU)) {
             qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                             _("the QEMU binary %s does not support kqemu"),
                             emulator);
@@ -2723,12 +2722,12 @@ qemuBuildCommandLine(virConnectPtr conn,
         break;
 
     case VIR_DOMAIN_VIRT_KVM:
-        if (qemuCmdFlags & QEMU_CAPS_KQEMU)
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_KQEMU))
             disableKQEMU = 1;
 
-        if (qemuCmdFlags & QEMU_CAPS_ENABLE_KVM) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_ENABLE_KVM)) {
             enableKVM = 1;
-        } else if (!(qemuCmdFlags & QEMU_CAPS_KVM)) {
+        } else if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_KVM)) {
             qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                             _("the QEMU binary %s does not support kvm"),
                             emulator);
@@ -2765,7 +2764,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         virCommandAddArgList(cmd, "-cpu", cpu, NULL);
         VIR_FREE(cpu);
 
-        if ((qemuCmdFlags & QEMU_CAPS_NESTING) &&
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NESTING) &&
             hasHwVirt)
             virCommandAddArg(cmd, "-enable-nesting");
     }
@@ -2796,7 +2795,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                             "%s", _("hugepages are disabled by administrator config"));
             goto error;
         }
-        if (!(qemuCmdFlags & QEMU_CAPS_MEM_PATH)) {
+        if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MEM_PATH)) {
             qemuReportError(VIR_ERR_INTERNAL_ERROR,
                             _("hugepage backing not supported by '%s'"),
                             def->emulator);
@@ -2812,25 +2811,25 @@ qemuBuildCommandLine(virConnectPtr conn,
     virCommandAddArg(cmd, smp);
     VIR_FREE(smp);
 
-    if (qemuCmdFlags & QEMU_CAPS_NAME) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NAME)) {
         virCommandAddArg(cmd, "-name");
         if (driver->setProcessName &&
-            (qemuCmdFlags & QEMU_CAPS_NAME_PROCESS)) {
+            qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NAME_PROCESS)) {
             virCommandAddArgFormat(cmd, "%s,process=qemu:%s",
                                    def->name, def->name);
         } else {
             virCommandAddArg(cmd, def->name);
         }
     }
-    if (qemuCmdFlags & QEMU_CAPS_UUID)
+    if (qemuCapsGet(qemuCmdFlags, 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 (qemuCmdFlags & QEMU_CAPS_DOMID) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DOMID)) {
             virCommandAddArg(cmd, "-domid");
             virCommandAddArgFormat(cmd, "%d", def->id);
-        } else if (qemuCmdFlags & QEMU_CAPS_XEN_DOMID) {
+        } else if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_XEN_DOMID)) {
             virCommandAddArg(cmd, "-xen-attach");
             virCommandAddArg(cmd, "-xen-domid");
             virCommandAddArgFormat(cmd, "%d", def->id);
@@ -2847,7 +2846,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         virSysinfoDefPtr source = NULL;
         bool skip_uuid = false;
 
-        if (!(qemuCmdFlags & QEMU_CAPS_SMBIOS_TYPE)) {
+        if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_SMBIOS_TYPE)) {
             qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                     _("the QEMU binary %s does not support smbios settings"),
                             emulator);
@@ -2900,8 +2899,8 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (!def->graphics)
         virCommandAddArg(cmd, "-nographic");
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
-        if (qemuCmdFlags & QEMU_CAPS_NODEFCONFIG)
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NODEFCONFIG))
             virCommandAddArg(cmd,
                              "-nodefconfig"); /* Disable global config files */
         virCommandAddArg(cmd,
@@ -2911,7 +2910,7 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (monitor_chr) {
         char *chrdev;
         /* Use -chardev if it's available */
-        if (qemuCmdFlags & QEMU_CAPS_CHARDEV) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CHARDEV)) {
 
             virCommandAddArg(cmd, "-chardev");
             if (!(chrdev = qemuBuildChrChardevStr(monitor_chr, "monitor",
@@ -2937,7 +2936,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     }
 
-    if (qemuCmdFlags & QEMU_CAPS_RTC) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_RTC)) {
         const char *rtcopt;
         virCommandAddArg(cmd, "-rtc");
         if (!(rtcopt = qemuBuildClockArgStr(&def->clock)))
@@ -2981,7 +2980,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 (qemuCmdFlags & QEMU_CAPS_RTC_TD_HACK) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_RTC_TD_HACK)) {
                 switch (def->clock.timers[i]->tickpolicy) {
                 case -1:
                 case VIR_DOMAIN_TIMER_TICKPOLICY_DELAY:
@@ -2997,7 +2996,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                                     virDomainTimerTickpolicyTypeToString(def->clock.timers[i]->tickpolicy));
                 goto error;
                 }
-            } else if (!(qemuCmdFlags & QEMU_CAPS_RTC)
+            } else if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_RTC)
                        && (def->clock.timers[i]->tickpolicy
                            != VIR_DOMAIN_TIMER_TICKPOLICY_DELAY)
                        && (def->clock.timers[i]->tickpolicy != -1)) {
@@ -3016,13 +3015,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 (qemuCmdFlags & QEMU_CAPS_NO_KVM_PIT)
+                if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NO_KVM_PIT))
                     virCommandAddArg(cmd, "-no-kvm-pit-reinjection");
                 break;
             case VIR_DOMAIN_TIMER_TICKPOLICY_CATCHUP:
-                if (qemuCmdFlags & QEMU_CAPS_NO_KVM_PIT) {
+                if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NO_KVM_PIT)) {
                     /* do nothing - this is default for kvm-pit */
-                } else if (qemuCmdFlags & QEMU_CAPS_TDF) {
+                } else if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_TDF)) {
                     /* -tdf switches to 'catchup' with userspace pit. */
                     virCommandAddArg(cmd, "-tdf");
                 } else {
@@ -3051,7 +3050,7 @@ qemuBuildCommandLine(virConnectPtr conn,
              * and when -no-hpet doesn't exist is "no". "confusing"?
              * "yes"! */
 
-            if (qemuCmdFlags & QEMU_CAPS_NO_HPET) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NO_HPET)) {
                 if (def->clock.timers[i]->present == 0)
                     virCommandAddArg(cmd, "-no-hpet");
             } else {
@@ -3066,7 +3065,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     }
 
-    if ((qemuCmdFlags & QEMU_CAPS_NO_REBOOT) &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NO_REBOOT) &&
         def->onReboot != VIR_DOMAIN_LIFECYCLE_RESTART)
         virCommandAddArg(cmd, "-no-reboot");
 
@@ -3099,7 +3098,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
             boot[def->os.nBootDevs] = '\0';
 
-            if (qemuCmdFlags & QEMU_CAPS_BOOT_MENU &&
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_BOOT_MENU) &&
                 def->os.bootmenu != VIR_DOMAIN_BOOT_MENU_DEFAULT) {
                 if (def->os.bootmenu == VIR_DOMAIN_BOOT_MENU_ENABLED)
                     virBufferVSprintf(&boot_buf, "order=%s,menu=on", boot);
@@ -3110,7 +3109,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             }
 
             virCommandAddArgBuffer(cmd, &boot_buf);
-        } else if (!(qemuCmdFlags & QEMU_CAPS_BOOTINDEX)) {
+        } else if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_BOOTINDEX)) {
             /* def->os.nBootDevs is guaranteed to be > 0 unless per-device boot
              * configuration is used
              */
@@ -3141,7 +3140,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     }
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         for (i = 0 ; i < def->ncontrollers ; i++) {
             virDomainControllerDefPtr cont = def->controllers[i];
 
@@ -3171,11 +3170,12 @@ qemuBuildCommandLine(virConnectPtr conn,
     }
 
     /* If QEMU supports -drive param instead of old -hda, -hdb, -cdrom .. */
-    if (qemuCmdFlags & QEMU_CAPS_DRIVE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DRIVE)) {
         int bootCD = 0, bootFloppy = 0, bootDisk = 0;
 
         /* If QEMU supports boot=on for -drive param... */
-        if (qemuCmdFlags & QEMU_CAPS_DRIVE_BOOT && !def->os.kernel) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DRIVE_BOOT) &&
+            !def->os.kernel) {
             for (i = 0 ; i < def->os.nBootDevs ; i++) {
                 switch (def->os.bootDevs[i]) {
                 case VIR_DOMAIN_BOOT_CDROM:
@@ -3196,12 +3196,13 @@ qemuBuildCommandLine(virConnectPtr conn,
             int bootable = 0;
             virDomainDiskDefPtr disk = def->disks[i];
             int withDeviceArg = 0;
+            bool deviceFlagMasked = false;
             int j;
 
             /* Unless we have -device, then USB disks need special
                handling */
             if ((disk->bus == VIR_DOMAIN_DISK_BUS_USB) &&
-                !(qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+                !qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
                     virCommandAddArg(cmd, "-usbdevice");
                     virCommandAddArgFormat(cmd, "disk:%s", disk->src);
@@ -3236,12 +3237,18 @@ 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 ((qemuCmdFlags & QEMU_CAPS_DEVICE) &&
-                (disk->bus != VIR_DOMAIN_DISK_BUS_XEN))
-                withDeviceArg = 1;
-            if (!(optstr = qemuBuildDriveStr(disk, bootable,
-                                             (withDeviceArg ? qemuCmdFlags :
-                                              (qemuCmdFlags & ~QEMU_CAPS_DEVICE)))))
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
+                if (disk->bus != VIR_DOMAIN_DISK_BUS_XEN) {
+                    withDeviceArg = 1;
+                } else {
+                    qemuCapsClear(&qemuCmdFlags, QEMU_CAPS_DEVICE);
+                    deviceFlagMasked = true;
+                }
+            }
+            optstr = qemuBuildDriveStr(disk, bootable, qemuCmdFlags);
+            if (deviceFlagMasked)
+                qemuCapsSet(&qemuCmdFlags, QEMU_CAPS_DEVICE);
+            if (!optstr)
                 goto error;
             virCommandAddArg(cmd, optstr);
             VIR_FREE(optstr);
@@ -3276,7 +3283,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                                            disk->info.alias);
 
                     if (disk->bootIndex &&
-                        (qemuCmdFlags & QEMU_CAPS_BOOTINDEX)) {
+                        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_BOOTINDEX)) {
                         virCommandAddArg(cmd, "-global");
                         virCommandAddArgFormat(cmd, "isa-fdc.bootindex%c=%d",
                                                disk->info.addr.drive.unit
@@ -3401,7 +3408,7 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (has_rbd_hosts)
         virCommandAddEnvBuffer(cmd, &rbd_hosts);
 
-    if (qemuCmdFlags & QEMU_CAPS_FSDEV) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_FSDEV)) {
         for (i = 0 ; i < def->nfss ; i++) {
             char *optstr;
             virDomainFSDefPtr fs = def->fss[i];
@@ -3428,7 +3435,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
     if (!def->nnets) {
         /* If we have -device, then we set -nodefault already */
-        if (!(qemuCmdFlags & QEMU_CAPS_DEVICE))
+        if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE))
             virCommandAddArgList(cmd, "-net", "none", NULL);
     } else {
         for (i = 0 ; i < def->nnets ; i++) {
@@ -3439,8 +3446,8 @@ qemuBuildCommandLine(virConnectPtr conn,
             int vlan;
 
             /* VLANs are not used with -netdev, so don't record them */
-            if ((qemuCmdFlags & QEMU_CAPS_NETDEV) &&
-                (qemuCmdFlags & QEMU_CAPS_DEVICE))
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NETDEV) &&
+                qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE))
                 vlan = -1;
             else
                 vlan = i;
@@ -3499,8 +3506,8 @@ qemuBuildCommandLine(virConnectPtr conn,
              *
              * NB, no support for -netdev without use of -device
              */
-            if ((qemuCmdFlags & QEMU_CAPS_NETDEV) &&
-                (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NETDEV) &&
+                qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 virCommandAddArg(cmd, "-netdev");
                 if (!(host = qemuBuildHostNetStr(net, ',', vlan,
                                                  tapfd_name, vhostfd_name)))
@@ -3508,7 +3515,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                 virCommandAddArg(cmd, host);
                 VIR_FREE(host);
             }
-            if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 virCommandAddArg(cmd, "-device");
                 if (!(nic = qemuBuildNicDevStr(net, vlan, qemuCmdFlags)))
                     goto error;
@@ -3521,8 +3528,8 @@ qemuBuildCommandLine(virConnectPtr conn,
                 virCommandAddArg(cmd, nic);
                 VIR_FREE(nic);
             }
-            if (!((qemuCmdFlags & QEMU_CAPS_NETDEV) &&
-                  (qemuCmdFlags & QEMU_CAPS_DEVICE))) {
+            if (!(qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NETDEV) &&
+                  qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE))) {
                 virCommandAddArg(cmd, "-net");
                 if (!(host = qemuBuildHostNetStr(net, ',', vlan,
                                                  tapfd_name, vhostfd_name)))
@@ -3555,8 +3562,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 
         switch (smartcard->type) {
         case VIR_DOMAIN_SMARTCARD_TYPE_HOST:
-            if (!(qemuCmdFlags & QEMU_CAPS_CHARDEV) ||
-                !(qemuCmdFlags & QEMU_CAPS_CCID_EMULATED)) {
+            if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CHARDEV) ||
+                !qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CCID_EMULATED)) {
                 qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                 _("this QEMU binary lacks smartcard host "
                                   "mode support"));
@@ -3567,8 +3574,8 @@ qemuBuildCommandLine(virConnectPtr conn,
             break;
 
         case VIR_DOMAIN_SMARTCARD_TYPE_HOST_CERTIFICATES:
-            if (!(qemuCmdFlags & QEMU_CAPS_CHARDEV) ||
-                !(qemuCmdFlags & QEMU_CAPS_CCID_EMULATED)) {
+            if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CHARDEV) ||
+                !qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CCID_EMULATED)) {
                 qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                 _("this QEMU binary lacks smartcard host "
                                   "mode support"));
@@ -3603,8 +3610,8 @@ qemuBuildCommandLine(virConnectPtr conn,
             break;
 
         case VIR_DOMAIN_SMARTCARD_TYPE_PASSTHROUGH:
-            if (!(qemuCmdFlags & QEMU_CAPS_CHARDEV) ||
-                !(qemuCmdFlags & QEMU_CAPS_CCID_PASSTHRU)) {
+            if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CHARDEV) ||
+                !qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CCID_PASSTHRU)) {
                 qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                 _("this QEMU binary lacks smartcard "
                                   "passthrough mode support"));
@@ -3639,7 +3646,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
     if (!def->nserials) {
         /* If we have -device, then we set -nodefault already */
-        if (!(qemuCmdFlags & QEMU_CAPS_DEVICE))
+        if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE))
             virCommandAddArgList(cmd, "-serial", "none", NULL);
     } else {
         for (i = 0 ; i < def->nserials ; i++) {
@@ -3647,8 +3654,8 @@ qemuBuildCommandLine(virConnectPtr conn,
             char *devstr;
 
             /* Use -chardev with -device if they are available */
-            if ((qemuCmdFlags & QEMU_CAPS_CHARDEV) &&
-                (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CHARDEV) &&
+                qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 virCommandAddArg(cmd, "-chardev");
                 if (!(devstr = qemuBuildChrChardevStr(&serial->source,
                                                       serial->info.alias,
@@ -3672,7 +3679,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
     if (!def->nparallels) {
         /* If we have -device, then we set -nodefault already */
-        if (!(qemuCmdFlags & QEMU_CAPS_DEVICE))
+        if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE))
             virCommandAddArgList(cmd, "-parallel", "none", NULL);
     } else {
         for (i = 0 ; i < def->nparallels ; i++) {
@@ -3680,8 +3687,8 @@ qemuBuildCommandLine(virConnectPtr conn,
             char *devstr;
 
             /* Use -chardev with -device if they are available */
-            if ((qemuCmdFlags & QEMU_CAPS_CHARDEV) &&
-                (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CHARDEV) &&
+                qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 virCommandAddArg(cmd, "-chardev");
                 if (!(devstr = qemuBuildChrChardevStr(&parallel->source,
                                                       parallel->info.alias,
@@ -3710,8 +3717,8 @@ qemuBuildCommandLine(virConnectPtr conn,
 
         switch(channel->targetType) {
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_GUESTFWD:
-            if (!(qemuCmdFlags & QEMU_CAPS_CHARDEV) ||
-                !(qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+            if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_CHARDEV) ||
+                !qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                 "%s", _("guestfwd requires QEMU to support -chardev & -device"));
                 goto error;
@@ -3739,13 +3746,13 @@ qemuBuildCommandLine(virConnectPtr conn,
             break;
 
         case VIR_DOMAIN_CHR_CHANNEL_TARGET_TYPE_VIRTIO:
-            if (!(qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+            if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                     _("virtio channel requires QEMU to support -device"));
                 goto error;
             }
 
-            if ((qemuCmdFlags & QEMU_CAPS_DEVICE_SPICEVMC) &&
+            if (qemuCapsGet(qemuCmdFlags, 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
@@ -3778,7 +3785,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
         switch(console->targetType) {
         case VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_VIRTIO:
-            if (!(qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+            if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
                     _("virtio channel requires QEMU to support -device"));
                 goto error;
@@ -3816,7 +3823,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         virDomainInputDefPtr input = def->inputs[i];
 
         if (input->bus == VIR_DOMAIN_INPUT_BUS_USB) {
-            if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 char *optstr;
                 virCommandAddArg(cmd, "-device");
                 if (!(optstr = qemuBuildUSBInputDevStr(input)))
@@ -3853,7 +3860,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             virBufferVSprintf(&opt, "unix:%s",
                               def->graphics[0]->data.vnc.socket);
 
-        } else if (qemuCmdFlags & QEMU_CAPS_VNC_COLON) {
+        } else if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_VNC_COLON)) {
             if (def->graphics[0]->data.vnc.listenAddr)
                 virBufferAdd(&opt, def->graphics[0]->data.vnc.listenAddr, -1);
             else if (driver->vncListen)
@@ -3867,7 +3874,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                               def->graphics[0]->data.vnc.port - 5900);
         }
 
-        if (qemuCmdFlags & QEMU_CAPS_VNC_COLON) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_VNC_COLON)) {
             if (def->graphics[0]->data.vnc.auth.passwd ||
                 driver->vncPassword)
                 virBufferAddLit(&opt, ",password");
@@ -3912,8 +3919,8 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
     } else if ((def->ngraphics == 1) &&
                def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SDL) {
-        if ((qemuCmdFlags & QEMU_CAPS_0_10) &&
-            !(qemuCmdFlags & QEMU_CAPS_SDL)) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_0_10) &&
+            !qemuCapsGet(qemuCmdFlags, QEMU_CAPS_SDL)) {
             qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                             _("sdl not supported by '%s'"),
                             def->emulator);
@@ -3939,14 +3946,14 @@ 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 (qemuCmdFlags & QEMU_CAPS_SDL)
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_SDL))
             virCommandAddArg(cmd, "-sdl");
 
     } else if ((def->ngraphics == 1) &&
                def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_SPICE) {
         virBuffer opt = VIR_BUFFER_INITIALIZER;
 
-        if (!(qemuCmdFlags & QEMU_CAPS_SPICE)) {
+        if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_SPICE)) {
             qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                             _("spice graphics are not supported with this QEMU"));
             goto error;
@@ -4005,12 +4012,12 @@ qemuBuildCommandLine(virConnectPtr conn,
     }
 
     if (def->nvideos > 0) {
-        if (qemuCmdFlags & QEMU_CAPS_VGA) {
+        if (qemuCapsGet(qemuCmdFlags, 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) &&
-                    !(qemuCmdFlags & QEMU_CAPS_VGA_QXL)) {
+                    !qemuCapsGet(qemuCmdFlags, QEMU_CAPS_VGA_QXL)) {
                     qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                     _("This QEMU does not support QXL graphics adapters"));
                     goto error;
@@ -4051,7 +4058,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         }
 
         if (def->nvideos > 1) {
-            if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 for (i = 1 ; i < def->nvideos ; i++) {
                     char *str;
                     if (def->videos[i]->type != VIR_DOMAIN_VIDEO_TYPE_QXL) {
@@ -4078,15 +4085,15 @@ qemuBuildCommandLine(virConnectPtr conn,
 
     } else {
         /* If we have -device, then we set -nodefault already */
-        if (!(qemuCmdFlags & QEMU_CAPS_DEVICE) &&
-            (qemuCmdFlags & QEMU_CAPS_VGA) &&
-            (qemuCmdFlags & QEMU_CAPS_VGA_NONE))
+        if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE) &&
+            qemuCapsGet(qemuCmdFlags, QEMU_CAPS_VGA) &&
+            qemuCapsGet(qemuCmdFlags, QEMU_CAPS_VGA_NONE))
             virCommandAddArgList(cmd, "-vga", "none", NULL);
     }
 
     /* Add sound hardware */
     if (def->nsounds) {
-        if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
             for (i = 0 ; i < def->nsounds ; i++) {
                 virDomainSoundDefPtr sound = def->sounds[i];
                 char *str = NULL;
@@ -4105,7 +4112,7 @@ qemuBuildCommandLine(virConnectPtr conn,
 
                     if (sound->model == VIR_DOMAIN_SOUND_MODEL_ICH6) {
                         char *codecstr = NULL;
-                        if (!(qemuCmdFlags & QEMU_CAPS_HDA_DUPLEX)) {
+                        if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_HDA_DUPLEX)) {
                             qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                     _("this QEMU binary lacks hda support"));
                             goto error;
@@ -4161,7 +4168,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         virDomainWatchdogDefPtr watchdog = def->watchdog;
         char *optstr;
 
-        if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
             virCommandAddArg(cmd, "-device");
 
             optstr = qemuBuildWatchdogDevStr(watchdog, qemuCmdFlags);
@@ -4207,7 +4214,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                                 _("booting from assigned devices is only"
                                   " supported for PCI devices"));
                 goto error;
-            } else if (!(qemuCmdFlags & QEMU_CAPS_PCI_BOOTINDEX)) {
+            } else if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_PCI_BOOTINDEX)) {
                 qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                                 _("booting from assigned PCI devices is not"
                                   " supported with this version of qemu"));
@@ -4219,7 +4226,7 @@ qemuBuildCommandLine(virConnectPtr conn,
         if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
             hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_USB) {
 
-            if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 virCommandAddArg(cmd, "-device");
                 if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev)))
                     goto error;
@@ -4237,9 +4244,9 @@ qemuBuildCommandLine(virConnectPtr conn,
         /* PCI */
         if (hostdev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
             hostdev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI) {
-            if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
                 char *configfd_name = NULL;
-                if (qemuCmdFlags & QEMU_CAPS_PCI_CONFIGFD) {
+                if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_PCI_CONFIGFD)) {
                     int configfd = qemuOpenPCIConfig(hostdev);
 
                     if (configfd >= 0) {
@@ -4258,7 +4265,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                     goto error;
                 virCommandAddArg(cmd, devstr);
                 VIR_FREE(devstr);
-            } else if (qemuCmdFlags & QEMU_CAPS_PCIDEVICE) {
+            } else if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_PCIDEVICE)) {
                 virCommandAddArg(cmd, "-pcidevice");
                 if (!(devstr = qemuBuildPCIHostdevPCIDevStr(hostdev)))
                     goto error;
@@ -4278,7 +4285,7 @@ qemuBuildCommandLine(virConnectPtr conn,
     if (migrateFrom) {
         virCommandAddArg(cmd, "-incoming");
         if (STRPREFIX(migrateFrom, "tcp")) {
-            if (!(qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_TCP)) {
+            if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_TCP)) {
                 qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                 "%s", _("TCP migration is not supported with "
                                         "this QEMU binary"));
@@ -4286,13 +4293,13 @@ qemuBuildCommandLine(virConnectPtr conn,
             }
             virCommandAddArg(cmd, migrateFrom);
         } else if (STREQ(migrateFrom, "stdio")) {
-            if (qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_FD) {
+            if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_FD)) {
                 virCommandAddArgFormat(cmd, "fd:%d", migrateFd);
                 virCommandPreserveFD(cmd, migrateFd);
-            } else if (qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_EXEC) {
+            } else if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
                 virCommandAddArg(cmd, "exec:cat");
                 virCommandSetInputFD(cmd, migrateFd);
-            } else if (qemuCmdFlags & QEMU_CAPS_MIGRATE_KVM_STDIO) {
+            } else if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_KVM_STDIO)) {
                 virCommandAddArg(cmd, migrateFrom);
                 virCommandSetInputFD(cmd, migrateFd);
             } else {
@@ -4302,7 +4309,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                 goto error;
             }
         } else if (STRPREFIX(migrateFrom, "exec")) {
-            if (!(qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
+            if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
                 qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                 "%s", _("EXEC migration is not supported "
                                         "with this QEMU binary"));
@@ -4310,7 +4317,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             }
             virCommandAddArg(cmd, migrateFrom);
         } else if (STRPREFIX(migrateFrom, "fd")) {
-            if (!(qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_FD)) {
+            if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_FD)) {
                 qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                 "%s", _("FD migration is not supported "
                                         "with this QEMU binary"));
@@ -4319,7 +4326,7 @@ qemuBuildCommandLine(virConnectPtr conn,
             virCommandAddArg(cmd, migrateFrom);
             virCommandPreserveFD(cmd, migrateFd);
         } else if (STRPREFIX(migrateFrom, "unix")) {
-            if (!(qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_UNIX)) {
+            if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_UNIX)) {
                 qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED,
                                 "%s", _("UNIX migration is not supported "
                                         "with this QEMU binary"));
@@ -4347,7 +4354,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                             virDomainMemballoonModelTypeToString(def->memballoon->model));
             goto error;
         }
-        if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
             char *optstr;
             virCommandAddArg(cmd, "-device");
 
@@ -4356,7 +4363,7 @@ qemuBuildCommandLine(virConnectPtr conn,
                 goto error;
             virCommandAddArg(cmd, optstr);
             VIR_FREE(optstr);
-        } else if (qemuCmdFlags & QEMU_CAPS_BALLOON) {
+        } else if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_BALLOON)) {
             virCommandAddArgList(cmd, "-balloon", "virtio", NULL);
         }
     }
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
index 499880b..642e8f1 100644
--- a/src/qemu/qemu_hotplug.c
+++ b/src/qemu/qemu_hotplug.c
@@ -160,7 +160,7 @@ int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
                                         vm, disk) < 0)
         return -1;
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &disk->info) < 0)
             goto error;
         if (qemuAssignDeviceDiskAlias(disk, qemuCmdFlags) < 0)
@@ -179,7 +179,7 @@ int qemuDomainAttachPciDiskDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
             ret = qemuMonitorAddDevice(priv->mon, devstr);
@@ -219,7 +219,7 @@ error:
     VIR_FREE(devstr);
     VIR_FREE(drivestr);
 
-    if ((qemuCmdFlags & QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE) &&
         (disk->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
         qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &disk->info) < 0)
         VIR_WARN("Unable to release PCI address on %s", disk->src);
@@ -253,7 +253,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
         }
     }
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &controller->info) < 0)
             goto cleanup;
         if (qemuAssignDeviceControllerAlias(controller) < 0)
@@ -270,7 +270,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDevice(priv->mon, devstr);
     } else {
         ret = qemuMonitorAttachPCIDiskController(priv->mon,
@@ -286,7 +286,7 @@ int qemuDomainAttachPciControllerDevice(struct qemud_driver *driver,
 
 cleanup:
     if ((ret != 0) &&
-        (qemuCmdFlags & QEMU_CAPS_DEVICE) &&
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE) &&
         (controller->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
         qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &controller->info) < 0)
         VIR_WARN0("Unable to release PCI address on controller");
@@ -376,7 +376,7 @@ int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
         goto error;
     }
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceDiskAlias(disk, qemuCmdFlags) < 0)
             goto error;
         if (!(devstr = qemuBuildDriveDevStr(disk, qemuCmdFlags)))
@@ -409,7 +409,7 @@ int qemuDomainAttachSCSIDisk(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
             ret = qemuMonitorAddDevice(priv->mon, devstr);
@@ -487,7 +487,7 @@ int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
         goto error;
     }
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceDiskAlias(disk, qemuCmdFlags) < 0)
             goto error;
         if (!(drivestr = qemuBuildDriveStr(disk, 0, qemuCmdFlags)))
@@ -502,7 +502,7 @@ int qemuDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         ret = qemuMonitorAddDrive(priv->mon, drivestr);
         if (ret == 0) {
             ret = qemuMonitorAddDevice(priv->mon, devstr);
@@ -558,7 +558,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
     virDomainDevicePCIAddress guestAddr;
     int vlan;
 
-    if (!(qemuCmdFlags & QEMU_CAPS_HOST_NET_ADD)) {
+    if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_HOST_NET_ADD)) {
         qemuReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
                         _("installed qemu version does not support host_net_add"));
         return -1;
@@ -595,18 +595,18 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
     if (VIR_REALLOC_N(vm->def->nets, vm->def->nnets+1) < 0)
         goto no_memory;
 
-    if ((qemuCmdFlags & QEMU_CAPS_NET_NAME) ||
-        (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NET_NAME) ||
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceNetAlias(vm->def, net, -1) < 0)
             goto cleanup;
     }
 
-    if ((qemuCmdFlags & QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE) &&
         qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &net->info) < 0)
         goto cleanup;
 
-    if ((qemuCmdFlags & QEMU_CAPS_NETDEV) &&
-        (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NETDEV) &&
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         vlan = -1;
     } else {
         vlan = qemuDomainNetVLAN(net);
@@ -637,8 +637,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
     }
 
     /* FIXME - need to support vhost-net here (5th arg) */
-    if ((qemuCmdFlags & QEMU_CAPS_NETDEV) &&
-        (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NETDEV) &&
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (!(netstr = qemuBuildHostNetStr(net, ',',
                                            -1, tapfd_name, 0)))
             goto try_tapfd_close;
@@ -649,8 +649,8 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if ((qemuCmdFlags & QEMU_CAPS_NETDEV) &&
-        (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NETDEV) &&
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorAddNetdev(priv->mon, netstr) < 0) {
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             qemuDomainNetAudit(vm, NULL, net, "attach", false);
@@ -673,7 +673,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
         goto cleanup;
     }
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (!(nicstr = qemuBuildNicDevStr(net, vlan, qemuCmdFlags)))
             goto try_remove;
     } else {
@@ -682,7 +682,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorAddDevice(priv->mon, nicstr) < 0) {
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             qemuDomainNetAudit(vm, NULL, net, "attach", false);
@@ -708,7 +708,7 @@ int qemuDomainAttachNetDevice(virConnectPtr conn,
 
 cleanup:
     if ((ret != 0) &&
-        (qemuCmdFlags & QEMU_CAPS_DEVICE) &&
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE) &&
         (net->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
         qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &net->info) < 0)
         VIR_WARN0("Unable to release PCI address on NIC");
@@ -728,8 +728,8 @@ try_remove:
         goto cleanup;
 
     if (vlan < 0) {
-        if ((qemuCmdFlags & QEMU_CAPS_NETDEV) &&
-            (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NETDEV) &&
+            qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
             char *netdev_name;
             if (virAsprintf(&netdev_name, "host%s", net->info.alias) < 0)
                 goto no_memory;
@@ -793,12 +793,12 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
     if (qemuPrepareHostdevPCIDevices(driver, &hostdev, 1) < 0)
         return -1;
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
             goto error;
         if (qemuDomainPCIAddressEnsureAddr(priv->pciaddrs, &hostdev->info) < 0)
             goto error;
-        if (qemuCmdFlags & QEMU_CAPS_PCI_CONFIGFD) {
+        if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_PCI_CONFIGFD)) {
             configfd = qemuOpenPCIConfig(hostdev);
             if (configfd >= 0) {
                 if (virAsprintf(&configfd_name, "fd-%s",
@@ -854,7 +854,7 @@ int qemuDomainAttachHostPciDevice(struct qemud_driver *driver,
     return 0;
 
 error:
-    if ((qemuCmdFlags & QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE) &&
         (hostdev->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) &&
         qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &hostdev->info) < 0)
         VIR_WARN0("Unable to release PCI address on host device");
@@ -878,7 +878,7 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
     qemuDomainObjPrivatePtr priv = vm->privateData;
     char *devstr = NULL;
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceHostdevAlias(vm->def, hostdev, -1) < 0)
             goto error;
         if (!(devstr = qemuBuildUSBHostdevDevStr(hostdev)))
@@ -910,7 +910,7 @@ int qemuDomainAttachHostUsbDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE)
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE))
         ret = qemuMonitorAddDevice(priv->mon, devstr);
     else
         ret = qemuMonitorAddUSBDeviceExact(priv->mon,
@@ -1173,7 +1173,7 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
             qemuDomainObjExitMonitor(vm);
             goto cleanup;
@@ -1193,7 +1193,7 @@ int qemuDomainDetachPciDiskDevice(struct qemud_driver *driver,
 
     qemuDomainDiskAudit(vm, detach, NULL, "detach", ret >= 0);
 
-    if ((qemuCmdFlags & QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE) &&
         qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0)
         VIR_WARN("Unable to release PCI address on %s", dev->data.disk->src);
 
@@ -1237,7 +1237,7 @@ int qemuDomainDetachSCSIDiskDevice(struct qemud_driver *driver,
         goto cleanup;
     }
 
-    if (!(qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+    if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
                         _("Underlying qemu does not support SCSI disk removal"));
         goto cleanup;
@@ -1385,13 +1385,13 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
         goto cleanup;
     }
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuAssignDeviceControllerAlias(detach) < 0)
             goto cleanup;
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias)) {
             qemuDomainObjExitMonitor(vm);
             goto cleanup;
@@ -1419,7 +1419,7 @@ int qemuDomainDetachPciControllerDevice(struct qemud_driver *driver,
         vm->def->ncontrollers = 0;
     }
 
-    if ((qemuCmdFlags & QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE) &&
         qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0)
         VIR_WARN0("Unable to release PCI address on controller");
 
@@ -1479,7 +1479,7 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
             qemuDomainObjExitMonitor(vm);
             qemuDomainNetAudit(vm, detach, NULL, "detach", false);
@@ -1494,8 +1494,8 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
         }
     }
 
-    if ((qemuCmdFlags & QEMU_CAPS_NETDEV) &&
-        (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_NETDEV) &&
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorRemoveNetdev(priv->mon, hostnet_name) < 0) {
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             qemuDomainNetAudit(vm, detach, NULL, "detach", false);
@@ -1512,7 +1512,7 @@ int qemuDomainDetachNetDevice(struct qemud_driver *driver,
 
     qemuDomainNetAudit(vm, detach, NULL, "detach", true);
 
-    if ((qemuCmdFlags & QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE) &&
         qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0)
         VIR_WARN0("Unable to release PCI address on NIC");
 
@@ -1605,7 +1605,7 @@ int qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
     }
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         if (qemuMonitorDelDevice(priv->mon, detach->info.alias) < 0) {
             qemuDomainObjExitMonitor(vm);
             return -1;
@@ -1636,7 +1636,7 @@ int qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
         pciFreeDevice(pci);
     }
 
-    if ((qemuCmdFlags & QEMU_CAPS_DEVICE) &&
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE) &&
         qemuDomainPCIAddressReleaseAddr(priv->pciaddrs, &detach->info) < 0)
         VIR_WARN0("Unable to release PCI address on host device");
 
@@ -1707,7 +1707,7 @@ int qemuDomainDetachHostUsbDevice(struct qemud_driver *driver,
         return -1;
     }
 
-    if (!(qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+    if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         qemuReportError(VIR_ERR_OPERATION_FAILED,
                         "%s", _("device cannot be detached with this QEMU version"));
         return -1;
diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 569723b..fb16f3a 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -304,9 +304,9 @@ qemuMigrationPrepareTunnel(struct qemud_driver *driver,
                         vm->def->emulator);
         goto endjob;
     }
-    if (qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_UNIX)
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_UNIX))
         internalret = virAsprintf(&migrateFrom, "unix:%s", unixfile);
-    else if (qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_EXEC)
+    else if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_EXEC))
         internalret = virAsprintf(&migrateFrom, "exec:nc -U -l %s", unixfile);
     else {
         qemuReportError(VIR_ERR_OPERATION_FAILED,
@@ -777,8 +777,8 @@ static int doTunnelMigrate(struct qemud_driver *driver,
         goto cleanup;
     }
 
-    if (!(qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_UNIX) &&
-        !(qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
+    if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_UNIX) &&
+        !qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
         qemuReportError(VIR_ERR_OPERATION_FAILED,
                         "%s", _("Source qemu is too old to support tunnelled migration"));
         goto cleanup;
@@ -820,11 +820,11 @@ static int doTunnelMigrate(struct qemud_driver *driver,
         background_flags |= QEMU_MONITOR_MIGRATE_NON_SHARED_DISK;
     if (flags & VIR_MIGRATE_NON_SHARED_INC)
         background_flags |= QEMU_MONITOR_MIGRATE_NON_SHARED_INC;
-    if (qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_UNIX){
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_UNIX)) {
         internalret = qemuMonitorMigrateToUnix(priv->mon, background_flags,
                                                unixfile);
     }
-    else if (qemuCmdFlags & QEMU_CAPS_MIGRATE_QEMU_EXEC) {
+    else if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MIGRATE_QEMU_EXEC)) {
         const char *args[] = { "nc", "-U", unixfile, NULL };
         internalret = qemuMonitorMigrateToCommand(priv->mon, QEMU_MONITOR_MIGRATE_BACKGROUND, args);
     } else {
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 0cb717d..937a840 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -1159,7 +1159,7 @@ qemuProcessInitPasswords(virConnectPtr conn,
     if (ret < 0)
         goto cleanup;
 
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         int i;
 
         for (i = 0 ; i < vm->def->ndisks ; i++) {
@@ -1816,7 +1816,7 @@ qemuProcessReconnect(void *payload, const char *name ATTRIBUTE_UNUSED, void *opa
     if (qemuCapsExtractVersionInfo(obj->def->emulator, obj->def->os.arch,
                                    NULL,
                                    &qemuCmdFlags) >= 0 &&
-        (qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+        qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         priv->persistentAddrs = 1;
 
         if (!(priv->pciaddrs = qemuDomainPCIAddressSetCreate(obj->def)) ||
@@ -2027,7 +2027,7 @@ int qemuProcessStart(virConnectPtr conn,
         goto cleanup;
 
 #if HAVE_YAJL
-    if (qemuCmdFlags & QEMU_CAPS_MONITOR_JSON)
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_MONITOR_JSON))
         priv->monJSON = 1;
     else
 #endif
@@ -2056,7 +2056,7 @@ int qemuProcessStart(virConnectPtr conn,
      * we also need to populate the PCi address set cache for later
      * use in hotplug
      */
-    if (qemuCmdFlags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         VIR_DEBUG0("Assigning domain PCI addresses");
         /* Populate cache with current addresses */
         if (priv->pciaddrs) {
@@ -2190,7 +2190,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 (!(qemuCmdFlags & QEMU_CAPS_DEVICE)) {
+    if (!qemuCapsGet(qemuCmdFlags, QEMU_CAPS_DEVICE)) {
         VIR_DEBUG0("Determining domain device PCI addresses");
         if (qemuProcessInitPCIAddresses(driver, vm) < 0)
             goto cleanup;
diff --git a/tests/qemuhelptest.c b/tests/qemuhelptest.c
index 11f1a67..75ecf58 100644
--- a/tests/qemuhelptest.c
+++ b/tests/qemuhelptest.c
@@ -57,7 +57,7 @@ static int testHelpStrParsing(const void *data)
                              &version, &is_kvm, &kvm_version) == -1)
         goto cleanup;
 
-    if (info->flags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(info->flags, QEMU_CAPS_DEVICE)) {
         VIR_FREE(path);
         if (virAsprintf(&path, "%s/qemuhelpdata/%s-device", abs_srcdir,
                         info->name) < 0)
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
index 2f9e80c..a4fe43f 100644
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -79,7 +79,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
             goto fail;
     }
 
-    if (extraFlags & QEMU_CAPS_DOMID)
+    if (qemuCapsGet(extraFlags, QEMU_CAPS_DOMID))
         vmdef->id = 6;
     else
         vmdef->id = -1;
@@ -96,7 +96,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
     if (qemudCanonicalizeMachine(&driver, vmdef) < 0)
         goto fail;
 
-    if (flags & QEMU_CAPS_DEVICE) {
+    if (qemuCapsGet(flags, QEMU_CAPS_DEVICE)) {
         qemuDomainPCIAddressSetPtr pciaddrs;
         if (!(pciaddrs = qemuDomainPCIAddressSetCreate(vmdef)))
             goto fail;
-- 
1.7.4.1

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