[libvirt] [PATCH 1/4] Remove passing of virConnectPtr throughout QEMU driver

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

 



The virConnectPtr is no longer required for error reporting since
that is recorded in a thread local. Rename qemudReportError to
qemuReportError and remove the conn, dom & net parameters all of
which are unused. Remove virConnectPtr from all internal QEMU
driver APIs with exception of APIs which need it to resolve a
virNetworkPtr into a bridge device name
---
 src/qemu/qemu_conf.c         |  471 +++++++++---------
 src/qemu/qemu_conf.h         |   21 +-
 src/qemu/qemu_driver.c       | 1127 +++++++++++++++++++++---------------------
 src/qemu/qemu_monitor.c      |   38 +-
 src/qemu/qemu_monitor_json.c |  200 ++++----
 src/qemu/qemu_monitor_text.c |  232 +++++-----
 tests/qemuargv2xmltest.c     |    2 +-
 7 files changed, 1026 insertions(+), 1065 deletions(-)

diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index e3769c8..fb06cd0 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -137,7 +137,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
 
 
 #define CHECK_TYPE(name,typ) if (p && p->type != (typ)) {               \
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,      \
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,                         \
                          "remoteReadConfigFile: %s: %s: expected type " #typ "\n", \
                          filename, (name));                             \
         virConfFree(conf);                                              \
@@ -1305,9 +1305,9 @@ fail:
     if (p)
         p = strndup(help, p - help);
 
-    qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                     _("cannot parse QEMU version number in '%s'"),
-                     p ? p : help);
+    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                    _("cannot parse QEMU version number in '%s'"),
+                    p ? p : help);
 
     VIR_FREE(p);
 
@@ -1451,8 +1451,8 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
             return -1;
         }
     } else {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("Network type %d is not supported"), net->type);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Network type %d is not supported"), net->type);
         return -1;
     }
 
@@ -1482,9 +1482,9 @@ qemudNetworkIfaceConnect(virConnectPtr conn,
                         &net->ifname, vnet_hdr, &tapfd))) {
         if (errno == ENOTSUP) {
             /* In this particular case, give a better diagnostic. */
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Failed to add tap interface to bridge. "
-                               "%s is not a bridge device"), brname);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Failed to add tap interface to bridge. "
+                              "%s is not a bridge device"), brname);
         } else if (template_ifname) {
             virReportSystemError(err,
                                  _("Failed to add tap interface to bridge '%s'"),
@@ -1566,9 +1566,9 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
     char *devname;
 
     if (virDiskNameToBusDeviceIndex(disk, &busid, &devid) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("cannot convert disk '%s' to bus/device index"),
-                         disk->dst);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("cannot convert disk '%s' to bus/device index"),
+                        disk->dst);
         return -1;
     }
 
@@ -1595,9 +1595,9 @@ static int qemuAssignDeviceDiskAliasFixed(virDomainDiskDefPtr disk)
         ret = virAsprintf(&devname, "xenblk%d", devid);
         break;
     default:
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                         _("Unsupported disk name mapping for bus '%s'"),
-                         virDomainDiskBusTypeToString(disk->bus));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        _("Unsupported disk name mapping for bus '%s'"),
+                        virDomainDiskBusTypeToString(disk->bus));
         return -1;
     }
 
@@ -1659,8 +1659,8 @@ qemuAssignDeviceNetAlias(virDomainDefPtr def, virDomainNetDefPtr net, int idx)
         for (i = 0 ; i < def->nnets ; i++) {
             int thisidx;
             if ((thisidx = qemuDomainDeviceAliasIndex(&def->nets[i]->info, "net")) < 0) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                                 _("Unable to determine device index for network device"));
+                qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to determine device index for network device"));
                 return -1;
             }
             if (thisidx >= idx)
@@ -1686,8 +1686,8 @@ qemuAssignDeviceHostdevAlias(virDomainDefPtr def, virDomainHostdevDefPtr hostdev
         for (i = 0 ; i < def->nhostdevs ; i++) {
             int thisidx;
             if ((thisidx = qemuDomainDeviceAliasIndex(&def->hostdevs[i]->info, "hostdev")) < 0) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                                 _("Unable to determine device index for hostdevwork device"));
+                qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("Unable to determine device index for hostdevwork device"));
                 return -1;
             }
             if (thisidx >= idx)
@@ -1798,8 +1798,8 @@ static char *qemuPCIAddressAsString(virDomainDeviceInfoPtr dev)
 
     if (dev->addr.pci.domain != 0 ||
         dev->addr.pci.bus != 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("Only PCI domain 0 and bus 0 are available"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("Only PCI domain 0 and bus 0 are available"));
         return NULL;
     }
 
@@ -1869,8 +1869,8 @@ int qemuDomainPCIAddressReserveAddr(qemuDomainPCIAddressSetPtr addrs,
     VIR_DEBUG("Reserving PCI addr %s", addr);
 
     if (virHashLookup(addrs->used, addr)) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unable to reserve PCI address %s"), addr);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unable to reserve PCI address %s"), addr);
         VIR_FREE(addr);
         return -1;
     }
@@ -1982,8 +1982,8 @@ int qemuDomainPCIAddressSetNextAddr(qemuDomainPCIAddressSetPtr addrs,
         return 0;
     }
 
-    qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                     "%s", _("No more available PCI addresses"));
+    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                    "%s", _("No more available PCI addresses"));
     return -1;
 }
 
@@ -2056,8 +2056,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
                     def->videos[i]->info.addr.pci.bus != 0 ||
                     def->videos[i]->info.addr.pci.slot != 2 ||
                     def->videos[i]->info.addr.pci.function != 0) {
-                    qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                                     _("Primary video card must have PCI address 0:0:2.0"));
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                    _("Primary video card must have PCI address 0:0:2.0"));
                     goto error;
                 }
             } else {
@@ -2089,8 +2089,8 @@ qemuAssignDevicePCISlots(virDomainDefPtr def, qemuDomainPCIAddressSetPtr addrs)
                     def->videos[i]->info.addr.pci.bus != 0 ||
                     def->videos[i]->info.addr.pci.slot != 2 ||
                     def->videos[i]->info.addr.pci.function != 0) {
-                    qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                                     _("Primary IDE controller must have PCI address 0:0:1.1"));
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                    _("Primary IDE controller must have PCI address 0:0:1.1"));
                     goto error;
                 }
             } else {
@@ -2141,18 +2141,18 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
 {
     if (info->type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
         if (info->addr.pci.domain != 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("Only PCI device addresses with domain=0 are supported"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Only PCI device addresses with domain=0 are supported"));
             return -1;
         }
         if (info->addr.pci.bus != 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("Only PCI device addresses with bus=0 are supported"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Only PCI device addresses with bus=0 are supported"));
             return -1;
         }
         if (info->addr.pci.function != 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("Only PCI device addresses with function=0 are supported"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("Only PCI device addresses with function=0 are supported"));
             return -1;
         }
 
@@ -2172,13 +2172,12 @@ qemuBuildDeviceAddressStr(virBufferPtr buf,
   "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
 
 static int
-qemuSafeSerialParamValue(virConnectPtr conn,
-                         const char *value)
+qemuSafeSerialParamValue(const char *value)
 {
     if (strspn(value, QEMU_SERIAL_PARAM_ACCEPTED_CHARS) != strlen (value)) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("driver serial '%s' contains unsafe characters"),
-                         value);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("driver serial '%s' contains unsafe characters"),
+                        value);
         return -1;
     }
 
@@ -2197,16 +2196,16 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
     int busid = -1, unitid = -1;
 
     if (idx < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unsupported disk type '%s'"), disk->dst);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unsupported disk type '%s'"), disk->dst);
         goto error;
     }
 
     switch (disk->bus) {
     case VIR_DOMAIN_DISK_BUS_SCSI:
         if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("unexpected address type for scsi disk"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("unexpected address type for scsi disk"));
             goto error;
         }
 
@@ -2214,8 +2213,8 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
          * to be created. Yes this is slightly odd. It is not possible
          * to have > 1 bus on a SCSI controller (yet). */
         if (disk->info.addr.drive.bus != 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             "%s", _("SCSI controller only supports 1 bus"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            "%s", _("SCSI controller only supports 1 bus"));
             goto error;
         }
         busid = disk->info.addr.drive.controller;
@@ -2224,14 +2223,14 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
 
     case VIR_DOMAIN_DISK_BUS_IDE:
         if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("unexpected address type for ide disk"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("unexpected address type for ide disk"));
             goto error;
         }
         /* We can only have 1 IDE controller (currently) */
         if (disk->info.addr.drive.controller != 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Only 1 %s controller is supported"), bus);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Only 1 %s controller is supported"), bus);
             goto error;
         }
         busid = disk->info.addr.drive.bus;
@@ -2240,20 +2239,20 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
 
     case VIR_DOMAIN_DISK_BUS_FDC:
         if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("unexpected address type for fdc disk"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("unexpected address type for fdc disk"));
             goto error;
         }
         /* We can only have 1 FDC controller (currently) */
         if (disk->info.addr.drive.controller != 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Only 1 %s controller is supported"), bus);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Only 1 %s controller is supported"), bus);
             goto error;
         }
         /* We can only have 1 FDC bus (currently) */
         if (disk->info.addr.drive.bus != 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Only 1 %s bus is supported"), bus);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Only 1 %s bus is supported"), bus);
             goto error;
         }
         unitid = disk->info.addr.drive.unit;
@@ -2275,14 +2274,14 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
             /* QEMU only supports magic FAT format for now */
             if (disk->driverType &&
                 STRNEQ(disk->driverType, "fat")) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("unsupported disk driver type for '%s'"),
-                                 disk->driverType);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("unsupported disk driver type for '%s'"),
+                                disk->driverType);
                 goto error;
             }
             if (!disk->readonly) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                                 _("cannot create virtual FAT disks in read-write mode"));
+                qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("cannot create virtual FAT disks in read-write mode"));
                 goto error;
             }
             if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
@@ -2323,7 +2322,7 @@ qemuBuildDriveStr(virDomainDiskDefPtr disk,
         virBufferVSprintf(&opt, ",format=%s", disk->driverType);
     if (disk->serial &&
         (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE_SERIAL)) {
-        if (qemuSafeSerialParamValue(NULL, disk->serial) < 0)
+        if (qemuSafeSerialParamValue(disk->serial) < 0)
             goto error;
         virBufferVSprintf(&opt, ",serial=%s", disk->serial);
     }
@@ -2353,16 +2352,15 @@ error:
 
 
 char *
-qemuBuildDriveDevStr(virConnectPtr conn,
-                     virDomainDiskDefPtr disk)
+qemuBuildDriveDevStr(virDomainDiskDefPtr disk)
 {
     virBuffer opt = VIR_BUFFER_INITIALIZER;
     const char *bus = virDomainDiskQEMUBusTypeToString(disk->bus);
     int idx = virDiskNameToIndex(disk->dst);
 
     if (idx < 0) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unsupported disk type '%s'"), disk->dst);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unsupported disk type '%s'"), disk->dst);
         goto error;
     }
 
@@ -2388,8 +2386,8 @@ qemuBuildDriveDevStr(virConnectPtr conn,
         virBufferAddLit(&opt, "usb-storage");
         break;
     default:
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unsupported disk bus '%s' with device setup"), bus);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unsupported disk bus '%s' with device setup"), bus);
         goto error;
     }
     virBufferVSprintf(&opt, ",drive=drive-%s", disk->info.alias);
@@ -2442,8 +2440,7 @@ error:
 
 
 char *
-qemuBuildNicStr(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                virDomainNetDefPtr net,
+qemuBuildNicStr(virDomainNetDefPtr net,
                 const char *prefix,
                 int vlan)
 {
@@ -2508,8 +2505,7 @@ error:
 
 
 char *
-qemuBuildHostNetStr(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                    virDomainNetDefPtr net,
+qemuBuildHostNetStr(virDomainNetDefPtr net,
                     char type_sep,
                     int vlan,
                     const char *tapfd)
@@ -2597,8 +2593,8 @@ qemuBuildWatchdogDevStr(virDomainWatchdogDefPtr dev)
 
     const char *model = virDomainWatchdogModelTypeToString(dev->model);
     if (!model) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("missing watchdog model"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("missing watchdog model"));
         goto error;
     }
 
@@ -2650,8 +2646,8 @@ qemuBuildSoundDevStr(virDomainSoundDefPtr sound)
     const char *model = virDomainSoundModelTypeToString(sound->model);
 
     if (!model) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("invalid sound model"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("invalid sound model"));
         goto error;
     }
 
@@ -2728,8 +2724,8 @@ qemuBuildUSBHostdevDevStr(virDomainHostdevDefPtr dev)
 
     if (!dev->source.subsys.u.usb.bus &&
         !dev->source.subsys.u.usb.device) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("USB host device is missing bus/device information"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("USB host device is missing bus/device information"));
         return NULL;
     }
 
@@ -2750,8 +2746,8 @@ qemuBuildUSBHostdevUsbDevStr(virDomainHostdevDefPtr dev)
 
     if (!dev->source.subsys.u.usb.bus &&
         !dev->source.subsys.u.usb.device) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("USB host device is missing bus/device information"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("USB host device is missing bus/device information"));
         return NULL;
     }
 
@@ -2925,8 +2921,7 @@ error:
 
 
 static int
-qemuBuildCpuArgStr(virConnectPtr conn,
-                   const struct qemud_driver *driver,
+qemuBuildCpuArgStr(const struct qemud_driver *driver,
                    const virDomainDefPtr def,
                    const char *emulator,
                    const struct utsname *ut,
@@ -2948,11 +2943,11 @@ qemuBuildCpuArgStr(virConnectPtr conn,
     if (ncpus > 0 && host) {
         virCPUCompareResult cmp;
 
-        cmp = cpuGuestData(conn, host, def->cpu, &data);
+        cmp = cpuGuestData(NULL, host, def->cpu, &data);
         switch (cmp) {
         case VIR_CPU_COMPARE_INCOMPATIBLE:
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                    "%s", _("guest CPU is not compatible with host CPU"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            "%s", _("guest CPU is not compatible with host CPU"));
             /* fall through */
         case VIR_CPU_COMPARE_ERROR:
             goto cleanup;
@@ -2964,7 +2959,7 @@ qemuBuildCpuArgStr(virConnectPtr conn,
         if (VIR_ALLOC(guest) < 0 || !(guest->arch = strdup(ut->machine)))
             goto no_memory;
 
-        if (cpuDecode(conn, guest, data, ncpus, cpus) < 0)
+        if (cpuDecode(NULL, guest, data, ncpus, cpus) < 0)
             goto cleanup;
 
         virBufferVSprintf(&buf, "%s", guest->model);
@@ -3000,7 +2995,7 @@ qemuBuildCpuArgStr(virConnectPtr conn,
 
 cleanup:
     virCPUDefFree(guest);
-    cpuDataFree(conn, ut->machine, data);
+    cpuDataFree(NULL, ut->machine, data);
 
     if (cpus) {
         for (i = 0; i < ncpus; i++)
@@ -3051,6 +3046,9 @@ qemuBuildSmpArgStr(const virDomainDefPtr def,
 /*
  * Constructs a argv suitable for launching qemu with config defined
  * for a given virtual machine.
+ *
+ * XXX 'conn' is only required to resolve network -> bridge name
+ * figure out how to remove this requirement some day
  */
 int qemudBuildCommandLine(virConnectPtr conn,
                           struct qemud_driver *driver,
@@ -3093,22 +3091,22 @@ int qemudBuildCommandLine(virConnectPtr conn,
     if (migrateFrom) {
         if (STRPREFIX(migrateFrom, "tcp")) {
             if (!(qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_TCP)) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                                 "%s", _("TCP migration is not supported with this QEMU binary"));
+                qemuReportError(VIR_ERR_NO_SUPPORT,
+                                "%s", _("TCP migration is not supported with this QEMU binary"));
                 return -1;
             }
         } else if (STREQ(migrateFrom, "stdio")) {
             if (qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC) {
                 migrateFrom = "exec:cat";
             } else if (!(qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_KVM_STDIO)) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                                 "%s", _("STDIO migration is not supported with this QEMU binary"));
+                qemuReportError(VIR_ERR_NO_SUPPORT,
+                                "%s", _("STDIO migration is not supported with this QEMU binary"));
                 return -1;
             }
         } else if (STRPREFIX(migrateFrom, "exec")) {
             if (!(qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC)) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                                 "%s", _("STDIO migration is not supported with this QEMU binary"));
+                qemuReportError(VIR_ERR_NO_SUPPORT,
+                                "%s", _("STDIO migration is not supported with this QEMU binary"));
                 return -1;
             }
         }
@@ -3243,7 +3241,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
         ADD_ARG_LIT(def->os.machine);
     }
 
-    if (qemuBuildCpuArgStr(conn, driver, def, emulator, &ut, &cpu) < 0)
+    if (qemuBuildCpuArgStr(driver, def, emulator, &ut, &cpu) < 0)
         goto error;
 
     if (cpu) {
@@ -3262,19 +3260,19 @@ int qemudBuildCommandLine(virConnectPtr conn,
     ADD_ARG_LIT(memory);
     if (def->hugepage_backed) {
         if (!driver->hugetlbfs_mount) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             "%s", _("hugetlbfs filesystem is not mounted"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            "%s", _("hugetlbfs filesystem is not mounted"));
             goto error;
         }
         if (!driver->hugepage_path) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             "%s", _("hugepages are disabled by administrator config"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            "%s", _("hugepages are disabled by administrator config"));
             goto error;
         }
         if (!(qemuCmdFlags & QEMUD_CMD_FLAG_MEM_PATH)) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("hugepage backing not supported by '%s'"),
-                             def->emulator);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("hugepage backing not supported by '%s'"),
+                            def->emulator);
             goto error;
         }
         ADD_ARG_LIT("-mem-prealloc");
@@ -3306,9 +3304,9 @@ int qemudBuildCommandLine(virConnectPtr conn,
             ADD_ARG_LIT("-xen-domid");
             ADD_ARG_LIT(domid);
         } else {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("qemu emulator '%s' does not support xen"),
-                             def->emulator);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("qemu emulator '%s' does not support xen"),
+                            def->emulator);
             goto error;
         }
     }
@@ -3411,9 +3409,9 @@ int qemudBuildCommandLine(virConnectPtr conn,
 
         if (disk->driverName != NULL &&
             !STREQ(disk->driverName, "qemu")) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("unsupported driver name '%s' for disk '%s'"),
-                             disk->driverName, disk->src);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("unsupported driver name '%s' for disk '%s'"),
+                            disk->driverName, disk->src);
             goto error;
         }
     }
@@ -3431,8 +3429,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
 
             /* QEMU doesn't implement a SATA driver */
             if (cont->type == VIR_DOMAIN_CONTROLLER_TYPE_SATA) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                                 "%s", _("SATA is not supported with this QEMU binary"));
+                qemuReportError(VIR_ERR_NO_SUPPORT,
+                                "%s", _("SATA is not supported with this QEMU binary"));
                 goto error;
             }
 
@@ -3480,8 +3478,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
                 if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
                     ADD_USBDISK(disk->src);
                 } else {
-                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                     _("unsupported usb disk type for '%s'"), disk->src);
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("unsupported usb disk type for '%s'"), disk->src);
                     goto error;
                 }
                 continue;
@@ -3531,7 +3529,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
                 } else {
                     ADD_ARG_LIT("-device");
 
-                    if (!(optstr = qemuBuildDriveDevStr(conn, disk)))
+                    if (!(optstr = qemuBuildDriveDevStr(disk)))
                         goto error;
                     ADD_ARG(optstr);
                 }
@@ -3547,8 +3545,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
                 if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
                     ADD_USBDISK(disk->src);
                 } else {
-                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                     _("unsupported usb disk type for '%s'"), disk->src);
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("unsupported usb disk type for '%s'"), disk->src);
                     goto error;
                 }
                 continue;
@@ -3566,8 +3564,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
                     STRPREFIX(disk->dst, "fd")) {
                     snprintf(dev, NAME_MAX, "-%s", disk->dst);
                 } else {
-                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                     _("unsupported disk type '%s'"), disk->dst);
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("unsupported disk type '%s'"), disk->dst);
                     goto error;
                 }
             }
@@ -3576,14 +3574,14 @@ int qemudBuildCommandLine(virConnectPtr conn,
                 /* QEMU only supports magic FAT format for now */
                 if (disk->driverType &&
                     STRNEQ(disk->driverType, "fat")) {
-                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                     _("unsupported disk driver type for '%s'"),
-                                     disk->driverType);
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("unsupported disk driver type for '%s'"),
+                                    disk->driverType);
                     goto error;
                 }
                 if (!disk->readonly) {
-                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                                     _("cannot create virtual FAT disks in read-write mode"));
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                    _("cannot create virtual FAT disks in read-write mode"));
                     goto error;
                 }
                 if (disk->device == VIR_DOMAIN_DISK_DEVICE_FLOPPY)
@@ -3647,7 +3645,7 @@ int qemudBuildCommandLine(virConnectPtr conn,
             if ((qemuCmdFlags & QEMUD_CMD_FLAG_NETDEV) &&
                 (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)) {
                 ADD_ARG_LIT("-netdev");
-                if (!(host = qemuBuildHostNetStr(conn, net, ',',
+                if (!(host = qemuBuildHostNetStr(net, ',',
                                                  vlan, tapfd_name)))
                     goto error;
                 ADD_ARG(host);
@@ -3659,14 +3657,14 @@ int qemudBuildCommandLine(virConnectPtr conn,
                 ADD_ARG(nic);
             } else {
                 ADD_ARG_LIT("-net");
-                if (!(nic = qemuBuildNicStr(conn, net, "nic,", vlan)))
+                if (!(nic = qemuBuildNicStr(net, "nic,", vlan)))
                     goto error;
                 ADD_ARG(nic);
             }
             if (!((qemuCmdFlags & QEMUD_CMD_FLAG_NETDEV) &&
                   (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE))) {
                 ADD_ARG_LIT("-net");
-                if (!(host = qemuBuildHostNetStr(conn, net, ',',
+                if (!(host = qemuBuildHostNetStr(net, ',',
                                                  vlan, tapfd_name)))
                     goto error;
                 ADD_ARG(host);
@@ -3746,8 +3744,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
         case VIR_DOMAIN_CHR_TARGET_TYPE_GUESTFWD:
             if (!(qemuCmdFlags & QEMUD_CMD_FLAG_CHARDEV) ||
                 !(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                     "%s", _("guestfwd requires QEMU to support -chardev & -device"));
+                qemuReportError(VIR_ERR_NO_SUPPORT,
+                                "%s", _("guestfwd requires QEMU to support -chardev & -device"));
                 goto error;
             }
 
@@ -3888,8 +3886,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
 
     if (def->nvideos) {
         if (def->nvideos > 1) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             "%s", _("only one video card is currently supported"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            "%s", _("only one video card is currently supported"));
             goto error;
         }
 
@@ -3899,9 +3897,9 @@ int qemudBuildCommandLine(virConnectPtr conn,
             } else {
                 const char *vgastr = qemuVideoTypeToString(def->videos[0]->type);
                 if (!vgastr || STREQ(vgastr, "")) {
-                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                     _("video type %s is not supported with QEMU"),
-                                     virDomainVideoTypeToString(def->videos[0]->type));
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("video type %s is not supported with QEMU"),
+                                    virDomainVideoTypeToString(def->videos[0]->type));
                     goto error;
                 }
 
@@ -3925,9 +3923,9 @@ int qemudBuildCommandLine(virConnectPtr conn,
                 break;
 
             default:
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("video type %s is not supported with QEMU"),
-                                 virDomainVideoTypeToString(def->videos[0]->type));
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("video type %s is not supported with QEMU"),
+                                virDomainVideoTypeToString(def->videos[0]->type));
                 goto error;
             }
         }
@@ -3973,8 +3971,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
                 const char *model = virDomainSoundModelTypeToString(sound->model);
                 if (!model) {
                     VIR_FREE(modstr);
-                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                     "%s", _("invalid sound model"));
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                    "%s", _("invalid sound model"));
                     goto error;
                 }
                 strncat(modstr, model, size);
@@ -4003,8 +4001,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
 
             const char *model = virDomainWatchdogModelTypeToString(watchdog->model);
             if (!model) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 "%s", _("missing watchdog model"));
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                "%s", _("missing watchdog model"));
                 goto error;
             }
 
@@ -4015,8 +4013,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
 
         const char *action = virDomainWatchdogActionTypeToString(watchdog->action);
         if (!action) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             "%s", _("invalid watchdog action"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            "%s", _("invalid watchdog action"));
             goto error;
         }
         ADD_ARG_LIT("-watchdog-action");
@@ -4059,8 +4057,8 @@ int qemudBuildCommandLine(virConnectPtr conn,
                     goto error;
                 ADD_ARG(devstr);
             } else {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
-                                 _("PCI device assignment is not supported by this version of qemu"));
+                qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+                                _("PCI device assignment is not supported by this version of qemu"));
                 goto error;
             }
         }
@@ -4257,8 +4255,7 @@ static const char *qemuFindEnv(const char **progenv,
  * NULL is be placed into corresponding place in retvalues.
  */
 static int
-qemuParseCommandLineKeywords(virConnectPtr conn,
-                             const char *str,
+qemuParseCommandLineKeywords(const char *str,
                              char ***retkeywords,
                              char ***retvalues,
                              int allowEmptyValue)
@@ -4288,8 +4285,8 @@ qemuParseCommandLineKeywords(virConnectPtr conn,
 
         if (separator >= endmark) {
             if (!allowEmptyValue) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("malformed keyword arguments in '%s'"), str);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("malformed keyword arguments in '%s'"), str);
                 goto error;
             }
             separator = endmark;
@@ -4348,8 +4345,7 @@ error:
  * Will fail if not using the 'index' keyword
  */
 static virDomainDiskDefPtr
-qemuParseCommandLineDisk(virConnectPtr conn,
-                         const char *val,
+qemuParseCommandLineDisk(const char *val,
                          int nvirtiodisk)
 {
     virDomainDiskDefPtr def = NULL;
@@ -4361,7 +4357,7 @@ qemuParseCommandLineDisk(virConnectPtr conn,
     int busid = -1;
     int unitid = -1;
 
-    if ((nkeywords = qemuParseCommandLineKeywords(conn, val,
+    if ((nkeywords = qemuParseCommandLineKeywords(val,
                                                   &keywords,
                                                   &values, 0)) < 0)
         return NULL;
@@ -4425,24 +4421,24 @@ qemuParseCommandLineDisk(virConnectPtr conn,
             if (virStrToLong_i(values[i], NULL, 10, &idx) < 0) {
                 virDomainDiskDefFree(def);
                 def = NULL;
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("cannot parse drive index '%s'"), val);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot parse drive index '%s'"), val);
                 goto cleanup;
             }
         } else if (STREQ(keywords[i], "bus")) {
             if (virStrToLong_i(values[i], NULL, 10, &busid) < 0) {
                 virDomainDiskDefFree(def);
                 def = NULL;
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("cannot parse drive bus '%s'"), val);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot parse drive bus '%s'"), val);
                 goto cleanup;
             }
         } else if (STREQ(keywords[i], "unit")) {
             if (virStrToLong_i(values[i], NULL, 10, &unitid) < 0) {
                 virDomainDiskDefFree(def);
                 def = NULL;
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("cannot parse drive unit '%s'"), val);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot parse drive unit '%s'"), val);
                 goto cleanup;
             }
         }
@@ -4450,8 +4446,8 @@ qemuParseCommandLineDisk(virConnectPtr conn,
 
     if (!def->src &&
         def->device == VIR_DOMAIN_DISK_DEVICE_DISK) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("missing file parameter in drive '%s'"), val);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("missing file parameter in drive '%s'"), val);
         virDomainDiskDefFree(def);
         def = NULL;
         goto cleanup;
@@ -4463,8 +4459,8 @@ qemuParseCommandLineDisk(virConnectPtr conn,
     if (idx == -1 &&
         unitid == -1 &&
         busid == -1) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("missing index/unit/bus parameter in drive '%s'"), val);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("missing index/unit/bus parameter in drive '%s'"), val);
         virDomainDiskDefFree(def);
         def = NULL;
         goto cleanup;
@@ -4527,8 +4523,7 @@ cleanup:
  * Tries to find a NIC definition matching a vlan we want
  */
 static const char *
-qemuFindNICForVLAN(virConnectPtr conn,
-                   int nnics,
+qemuFindNICForVLAN(int nnics,
                    const char **nics,
                    int wantvlan)
 {
@@ -4543,8 +4538,8 @@ qemuFindNICForVLAN(virConnectPtr conn,
         tmp += strlen("vlan=");
 
         if (virStrToLong_i(tmp, &end, 10, &gotvlan) < 0) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot parse NIC vlan in '%s'"), nics[i]);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot parse NIC vlan in '%s'"), nics[i]);
             return NULL;
         }
 
@@ -4555,8 +4550,8 @@ qemuFindNICForVLAN(virConnectPtr conn,
     if (wantvlan == 0 && nnics > 0)
         return nics[0];
 
-    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                     _("cannot find NIC definition for vlan %d"), wantvlan);
+    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                    _("cannot find NIC definition for vlan %d"), wantvlan);
     return NULL;
 }
 
@@ -4567,8 +4562,7 @@ qemuFindNICForVLAN(virConnectPtr conn,
  * match up against. Horribly complicated stuff
  */
 static virDomainNetDefPtr
-qemuParseCommandLineNet(virConnectPtr conn,
-                        virCapsPtr caps,
+qemuParseCommandLineNet(virCapsPtr caps,
                         const char *val,
                         int nnics,
                         const char **nics)
@@ -4586,8 +4580,7 @@ qemuParseCommandLineNet(virConnectPtr conn,
     tmp = strchr(val, ',');
 
     if (tmp) {
-        if ((nkeywords = qemuParseCommandLineKeywords(conn,
-                                                      tmp+1,
+        if ((nkeywords = qemuParseCommandLineKeywords(tmp+1,
                                                       &keywords,
                                                       &values, 0)) < 0)
             return NULL;
@@ -4614,8 +4607,8 @@ qemuParseCommandLineNet(virConnectPtr conn,
     for (i = 0 ; i < nkeywords ; i++) {
         if (STREQ(keywords[i], "vlan")) {
             if (virStrToLong_i(values[i], NULL, 10, &wantvlan) < 0) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("cannot parse vlan in '%s'"), val);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot parse vlan in '%s'"), val);
                 virDomainNetDefFree(def);
                 def = NULL;
                 goto cleanup;
@@ -4636,7 +4629,7 @@ qemuParseCommandLineNet(virConnectPtr conn,
      * frontend, based off vlan number. NB this assumes a 1-1 mapping
      */
 
-    nic = qemuFindNICForVLAN(conn, nnics, nics, wantvlan);
+    nic = qemuFindNICForVLAN(nnics, nics, wantvlan);
     if (!nic) {
         virDomainNetDefFree(def);
         def = NULL;
@@ -4644,8 +4637,8 @@ qemuParseCommandLineNet(virConnectPtr conn,
     }
 
     if (!STRPREFIX(nic, "nic")) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("cannot parse NIC definition '%s'"), nic);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("cannot parse NIC definition '%s'"), nic);
         virDomainNetDefFree(def);
         def = NULL;
         goto cleanup;
@@ -4659,8 +4652,7 @@ qemuParseCommandLineNet(virConnectPtr conn,
     VIR_FREE(values);
 
     if (STRPREFIX(nic, "nic,")) {
-        if ((nkeywords = qemuParseCommandLineKeywords(conn,
-                                                      nic + strlen("nic,"),
+        if ((nkeywords = qemuParseCommandLineKeywords(nic + strlen("nic,"),
                                                       &keywords,
                                                       &values, 0)) < 0) {
             virDomainNetDefFree(def);
@@ -4675,9 +4667,9 @@ qemuParseCommandLineNet(virConnectPtr conn,
         if (STREQ(keywords[i], "macaddr")) {
             genmac = 0;
             if (virParseMacAddr(values[i], def->mac) < 0) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("unable to parse mac address '%s'"),
-                                 values[i]);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("unable to parse mac address '%s'"),
+                                values[i]);
                 virDomainNetDefFree(def);
                 def = NULL;
                 goto cleanup;
@@ -4706,8 +4698,7 @@ cleanup:
  * Tries to parse a QEMU PCI device
  */
 static virDomainHostdevDefPtr
-qemuParseCommandLinePCI(virConnectPtr conn,
-                        const char *val)
+qemuParseCommandLinePCI(const char *val)
 {
     virDomainHostdevDefPtr def = NULL;
     int bus = 0, slot = 0, func = 0;
@@ -4715,30 +4706,30 @@ qemuParseCommandLinePCI(virConnectPtr conn,
     char *end;
 
     if (!STRPREFIX(val, "host=")) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unknown PCI device syntax '%s'"), val);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unknown PCI device syntax '%s'"), val);
         VIR_FREE(def);
         goto cleanup;
     }
 
     start = val + strlen("host=");
     if (virStrToLong_i(start, &end, 16, &bus) < 0 || !end || *end != ':') {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("cannot extract PCI device bus '%s'"), val);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("cannot extract PCI device bus '%s'"), val);
         VIR_FREE(def);
         goto cleanup;
     }
     start = end + 1;
     if (virStrToLong_i(start, &end, 16, &slot) < 0 || !end || *end != '.') {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("cannot extract PCI device slot '%s'"), val);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("cannot extract PCI device slot '%s'"), val);
         VIR_FREE(def);
         goto cleanup;
     }
     start = end + 1;
     if (virStrToLong_i(start, NULL, 16, &func) < 0) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("cannot extract PCI device function '%s'"), val);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("cannot extract PCI device function '%s'"), val);
         VIR_FREE(def);
         goto cleanup;
     }
@@ -4764,8 +4755,7 @@ cleanup:
  * Tries to parse a QEMU USB device
  */
 static virDomainHostdevDefPtr
-qemuParseCommandLineUSB(virConnectPtr conn,
-                        const char *val)
+qemuParseCommandLineUSB(const char *val)
 {
     virDomainHostdevDefPtr def = NULL;
     int first = 0, second = 0;
@@ -4773,8 +4763,8 @@ qemuParseCommandLineUSB(virConnectPtr conn,
     char *end;
 
     if (!STRPREFIX(val, "host:")) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unknown PCI device syntax '%s'"), val);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unknown PCI device syntax '%s'"), val);
         VIR_FREE(def);
         goto cleanup;
     }
@@ -4782,29 +4772,29 @@ qemuParseCommandLineUSB(virConnectPtr conn,
     start = val + strlen("host:");
     if (strchr(start, ':')) {
         if (virStrToLong_i(start, &end, 16, &first) < 0 || !end || *end != ':') {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot extract USB device vendor '%s'"), val);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot extract USB device vendor '%s'"), val);
             VIR_FREE(def);
             goto cleanup;
         }
         start = end + 1;
         if (virStrToLong_i(start, NULL, 16, &second) < 0) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot extract PCI device product '%s'"), val);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot extract PCI device product '%s'"), val);
             VIR_FREE(def);
             goto cleanup;
         }
     } else {
         if (virStrToLong_i(start, &end, 10, &first) < 0 || !end || *end != '.') {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
                              _("cannot extract PCI device bus '%s'"), val);
             VIR_FREE(def);
             goto cleanup;
         }
         start = end + 1;
         if (virStrToLong_i(start, NULL, 10, &second) < 0) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot extract PCI device address '%s'"), val);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot extract PCI device address '%s'"), val);
             VIR_FREE(def);
             goto cleanup;
         }
@@ -4835,8 +4825,7 @@ cleanup:
  * Tries to parse a QEMU serial/parallel device
  */
 static virDomainChrDefPtr
-qemuParseCommandLineChr(virConnectPtr conn,
-                        const char *val)
+qemuParseCommandLineChr(const char *val)
 {
     virDomainChrDefPtr def;
 
@@ -4916,8 +4905,8 @@ qemuParseCommandLineChr(virConnectPtr conn,
         }
         svc = strchr(val, ':');
         if (!svc) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot find port number in character device %s"), val);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot find port number in character device %s"), val);
             goto error;
         }
         opt = strchr(svc, ',');
@@ -4956,8 +4945,8 @@ qemuParseCommandLineChr(virConnectPtr conn,
         if (!def->data.file.path)
             goto no_memory;
     } else {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unknown character device syntax %s"), val);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unknown character device syntax %s"), val);
         goto error;
     }
 
@@ -4992,8 +4981,7 @@ qemuInitGuestCPU(virDomainDefPtr dom)
 
 
 static int
-qemuParseCommandLineCPU(virConnectPtr conn,
-                        virDomainDefPtr dom,
+qemuParseCommandLineCPU(virDomainDefPtr dom,
                         const char *val)
 {
     virCPUDefPtr cpu;
@@ -5038,7 +5026,7 @@ qemuParseCommandLineCPU(virConnectPtr conn,
             else
                 feature = strdup(p);
 
-            ret = virCPUDefAddFeature(conn, cpu, feature, policy);
+            ret = virCPUDefAddFeature(NULL, cpu, feature, policy);
             VIR_FREE(feature);
             if (ret < 0)
                 goto error;
@@ -5048,8 +5036,8 @@ qemuParseCommandLineCPU(virConnectPtr conn,
     return 0;
 
 syntax:
-    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-            _("unknown CPU syntax '%s'"), val);
+    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                    _("unknown CPU syntax '%s'"), val);
     goto error;
 
 no_memory:
@@ -5060,8 +5048,7 @@ error:
 
 
 static int
-qemuParseCommandLineSmp(virConnectPtr conn,
-                        virDomainDefPtr dom,
+qemuParseCommandLineSmp(virDomainDefPtr dom,
                         const char *val)
 {
     unsigned int sockets = 0;
@@ -5075,7 +5062,7 @@ qemuParseCommandLineSmp(virConnectPtr conn,
     char *end;
     int ret;
 
-    nkws = qemuParseCommandLineKeywords(conn, val, &kws, &vals, 1);
+    nkws = qemuParseCommandLineKeywords(val, &kws, &vals, 1);
     if (nkws < 0)
         return -1;
 
@@ -5125,8 +5112,8 @@ cleanup:
     return ret;
 
 syntax:
-    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                     _("cannot parse CPU topology '%s'"), val);
+    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                    _("cannot parse CPU topology '%s'"), val);
 error:
     ret = -1;
     goto cleanup;
@@ -5138,8 +5125,7 @@ error:
  * virDomainDefPtr representing these settings as closely
  * as is practical. This is not an exact science....
  */
-virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
-                                     virCapsPtr caps,
+virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
                                      const char **progenv,
                                      const char **progargv)
 {
@@ -5154,8 +5140,8 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
     int nvirtiodisk = 0;
 
     if (!progargv[0]) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("no emulator path found"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("no emulator path found"));
         return NULL;
     }
 
@@ -5206,8 +5192,8 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
 #define WANT_VALUE()                                                   \
     const char *val = progargv[++i];                                   \
     if (!val) {                                                        \
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,     \
-                         _("missing value for %s argument"), arg);     \
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,                        \
+                        _("missing value for %s argument"), arg);      \
         goto error;                                                    \
     }
 
@@ -5251,8 +5237,8 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
                 char *opts;
                 if (virStrToLong_i(tmp+1, &opts, 10, &vnc->data.vnc.port) < 0) {
                     VIR_FREE(vnc);
-                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
-                                     _("cannot parse VNC port '%s'"), tmp+1);
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR,             \
+                                    _("cannot parse VNC port '%s'"), tmp+1);
                     goto error;
                 }
                 vnc->data.vnc.listenAddr = strndup(val, tmp-val);
@@ -5275,20 +5261,20 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
             int mem;
             WANT_VALUE();
             if (virStrToLong_i(val, NULL, 10, &mem) < 0) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
-                                 _("cannot parse memory level '%s'"), val);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR, \
+                                _("cannot parse memory level '%s'"), val);
                 goto error;
             }
             def->memory = def->maxmem = mem * 1024;
         } else if (STREQ(arg, "-smp")) {
             WANT_VALUE();
-            if (qemuParseCommandLineSmp(conn, def, val) < 0)
+            if (qemuParseCommandLineSmp(def, val) < 0)
                 goto error;
         } else if (STREQ(arg, "-uuid")) {
             WANT_VALUE();
             if (virUUIDParse(val, def->uuid) < 0) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
-                                 _("cannot parse UUID '%s'"), val);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR, \
+                                _("cannot parse UUID '%s'"), val);
                 goto error;
             }
         } else if (STRPREFIX(arg, "-hd") ||
@@ -5385,7 +5371,7 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
             WANT_VALUE();
             if (STRNEQ(val, "none")) {
                 virDomainChrDefPtr chr;
-                if (!(chr = qemuParseCommandLineChr(conn, val)))
+                if (!(chr = qemuParseCommandLineChr(val)))
                     goto error;
                 if (VIR_REALLOC_N(def->serials, def->nserials+1) < 0) {
                     virDomainChrDefFree(chr);
@@ -5399,7 +5385,7 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
             WANT_VALUE();
             if (STRNEQ(val, "none")) {
                 virDomainChrDefPtr chr;
-                if (!(chr = qemuParseCommandLineChr(conn, val)))
+                if (!(chr = qemuParseCommandLineChr(val)))
                     goto error;
                 if (VIR_REALLOC_N(def->parallels, def->nparallels+1) < 0) {
                     virDomainChrDefFree(chr);
@@ -5452,7 +5438,7 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
                 def->disks[def->ndisks++] = disk;
             } else {
                 virDomainHostdevDefPtr hostdev;
-                if (!(hostdev = qemuParseCommandLineUSB(conn, val)))
+                if (!(hostdev = qemuParseCommandLineUSB(val)))
                     goto error;
                 if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
                     virDomainHostdevDefFree(hostdev);
@@ -5464,7 +5450,7 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
             WANT_VALUE();
             if (!STRPREFIX(val, "nic") && STRNEQ(val, "none")) {
                 virDomainNetDefPtr net;
-                if (!(net = qemuParseCommandLineNet(conn, caps, val, nnics, nics)))
+                if (!(net = qemuParseCommandLineNet(caps, val, nnics, nics)))
                     goto error;
                 if (VIR_REALLOC_N(def->nets, def->nnets+1) < 0) {
                     virDomainNetDefFree(net);
@@ -5475,7 +5461,7 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
         } else if (STREQ(arg, "-drive")) {
             virDomainDiskDefPtr disk;
             WANT_VALUE();
-            if (!(disk = qemuParseCommandLineDisk(conn, val, nvirtiodisk)))
+            if (!(disk = qemuParseCommandLineDisk(val, nvirtiodisk)))
                 goto error;
             if (VIR_REALLOC_N(def->disks, def->ndisks+1) < 0) {
                 virDomainDiskDefFree(disk);
@@ -5488,7 +5474,7 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
         } else if (STREQ(arg, "-pcidevice")) {
             virDomainHostdevDefPtr hostdev;
             WANT_VALUE();
-            if (!(hostdev = qemuParseCommandLinePCI(conn, val)))
+            if (!(hostdev = qemuParseCommandLinePCI(val)))
                 goto error;
             if (VIR_REALLOC_N(def->hostdevs, def->nhostdevs+1) < 0) {
                 virDomainHostdevDefFree(hostdev);
@@ -5558,14 +5544,14 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
             if (STRNEQ(val, "none")) {
                 video = qemuVideoTypeFromString(val);
                 if (video < 0) {
-                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                     _("unknown video adapter type '%s'"), val);
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                    _("unknown video adapter type '%s'"), val);
                     goto error;
                 }
             }
         } else if (STREQ(arg, "-cpu")) {
             WANT_VALUE();
-            if (qemuParseCommandLineCPU(conn, def, val) < 0)
+            if (qemuParseCommandLineCPU(def, val) < 0)
                 goto error;
         } else if (STREQ(arg, "-domid")) {
             WANT_VALUE();
@@ -5586,8 +5572,8 @@ virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
         } else {
             VIR_WARN(_("unknown QEMU argument '%s' during conversion"), arg);
 #if 0
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("unknown argument '%s'"), arg);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("unknown argument '%s'"), arg);
             goto error;
 #endif
         }
@@ -5660,8 +5646,7 @@ error:
 }
 
 
-virDomainDefPtr qemuParseCommandLineString(virConnectPtr conn,
-                                           virCapsPtr caps,
+virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps,
                                            const char *args)
 {
     const char **progenv = NULL;
@@ -5672,7 +5657,7 @@ virDomainDefPtr qemuParseCommandLineString(virConnectPtr conn,
     if (qemuStringToArgvEnv(args, &progenv, &progargv) < 0)
         goto cleanup;
 
-    def = qemuParseCommandLine(conn, caps, progenv, progargv);
+    def = qemuParseCommandLine(caps, progenv, progargv);
 
 cleanup:
     for (i = 0 ; progargv && progargv[i] ; i++)
diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h
index f6397b7..5c41a1a 100644
--- a/src/qemu/qemu_conf.h
+++ b/src/qemu/qemu_conf.h
@@ -157,9 +157,9 @@ typedef qemuDomainPCIAddressSet *qemuDomainPCIAddressSetPtr;
 /* Config type for XML import/export conversions */
 #define QEMU_CONFIG_FORMAT_ARGV "qemu-argv"
 
-#define qemudReportError(conn, dom, net, code, fmt...)                       \
-        virReportErrorHelper(conn, VIR_FROM_QEMU, code, __FILE__,          \
-                               __FUNCTION__, __LINE__, fmt)
+#define qemuReportError(code, fmt...)                                   \
+    virReportErrorHelper(NULL, VIR_FROM_QEMU, code, __FILE__,           \
+                         __FUNCTION__, __LINE__, fmt)
 
 
 int qemudLoadDriverConfig(struct qemud_driver *driver,
@@ -191,15 +191,13 @@ int         qemudBuildCommandLine       (virConnectPtr conn,
                                          const char *migrateFrom);
 
 /* With vlan == -1, use netdev syntax, else old hostnet */
-char * qemuBuildHostNetStr(virConnectPtr conn,
-                           virDomainNetDefPtr net,
+char * qemuBuildHostNetStr(virDomainNetDefPtr net,
                            char type_sep,
                            int vlan,
                            const char *tapfd);
 
 /* Legacy, pre device support */
-char * qemuBuildNicStr(virConnectPtr conn,
-                       virDomainNetDefPtr net,
+char * qemuBuildNicStr(virDomainNetDefPtr net,
                        const char *prefix,
                        int vlan);
 
@@ -213,8 +211,7 @@ char *qemuBuildDriveStr(virDomainDiskDefPtr disk,
                         unsigned long long qemuCmdFlags);
 
 /* Current, best practice */
-char * qemuBuildDriveDevStr(virConnectPtr conn,
-                            virDomainDiskDefPtr disk);
+char * qemuBuildDriveDevStr(virDomainDiskDefPtr disk);
 /* Current, best practice */
 char * qemuBuildControllerDevStr(virDomainControllerDefPtr def);
 
@@ -258,12 +255,10 @@ int         qemudProbeCPUModels         (const char *qemu,
 int         qemudCanonicalizeMachine    (struct qemud_driver *driver,
                                          virDomainDefPtr def);
 
-virDomainDefPtr qemuParseCommandLine(virConnectPtr conn,
-                                     virCapsPtr caps,
+virDomainDefPtr qemuParseCommandLine(virCapsPtr caps,
                                      const char **progenv,
                                      const char **progargv);
-virDomainDefPtr qemuParseCommandLineString(virConnectPtr conn,
-                                           virCapsPtr caps,
+virDomainDefPtr qemuParseCommandLineString(virCapsPtr caps,
                                            const char *args);
 
 qemuDomainPCIAddressSetPtr qemuDomainPCIAddressSetCreate(virDomainDefPtr def);
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index cac5b8a..da13473 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -124,8 +124,7 @@ static void qemudShutdownVMDaemon(virConnectPtr conn,
 
 static int qemudDomainGetMaxVcpus(virDomainPtr dom);
 
-static int qemuDetectVcpuPIDs(virConnectPtr conn,
-                              struct qemud_driver *driver,
+static int qemuDetectVcpuPIDs(struct qemud_driver *driver,
                               virDomainObjPtr vm);
 
 static int qemuUpdateActivePciHostdevs(struct qemud_driver *driver,
@@ -218,8 +217,8 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
 
     if (!(monitorpath =
           virXPathString("string(./monitor[1]/@path)", ctxt))) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("no monitor path"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("no monitor path"));
         goto error;
     }
 
@@ -245,9 +244,9 @@ static int qemuDomainObjPrivateXMLParse(xmlXPathContextPtr ctxt, void *data)
         break;
     default:
         VIR_FREE(monitorpath);
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unsupported monitor type '%s'"),
-                         virDomainChrTypeToString(priv->monConfig->type));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unsupported monitor type '%s'"),
+                        virDomainChrTypeToString(priv->monConfig->type));
         goto error;
     }
 
@@ -320,8 +319,8 @@ static int qemuDomainObjBeginJob(virDomainObjPtr obj)
         if (virCondWaitUntil(&priv->jobCond, &obj->lock, then) < 0) {
             virDomainObjUnref(obj);
             if (errno == ETIMEDOUT)
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_TIMEOUT,
-                                 "%s", _("cannot acquire state change lock"));
+                qemuReportError(VIR_ERR_OPERATION_TIMEOUT,
+                                "%s", _("cannot acquire state change lock"));
             else
                 virReportSystemError(errno,
                                      "%s", _("cannot acquire job mutex"));
@@ -363,8 +362,8 @@ static int qemuDomainObjBeginJobWithDriver(struct qemud_driver *driver,
         if (virCondWaitUntil(&priv->jobCond, &obj->lock, then) < 0) {
             virDomainObjUnref(obj);
             if (errno == ETIMEDOUT)
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_TIMEOUT,
-                                 "%s", _("cannot acquire state change lock"));
+                qemuReportError(VIR_ERR_OPERATION_TIMEOUT,
+                                "%s", _("cannot acquire state change lock"));
             else
                 virReportSystemError(errno,
                                      "%s", _("cannot acquire job mutex"));
@@ -534,7 +533,7 @@ qemudLogFD(struct qemud_driver *driver, const char* name)
 
 
 static int
-qemudLogReadFD(virConnectPtr conn, const char* logDir, const char* name, off_t pos)
+qemudLogReadFD(const char* logDir, const char* name, off_t pos)
 {
     char logfile[PATH_MAX];
     mode_t logmode = O_RDONLY;
@@ -542,9 +541,9 @@ qemudLogReadFD(virConnectPtr conn, const char* logDir, const char* name, off_t p
 
     if ((ret = snprintf(logfile, sizeof(logfile), "%s/%s.log", logDir, name))
         < 0 || ret >= sizeof(logfile)) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("failed to build logfile name %s/%s.log"),
-                         logDir, name);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("failed to build logfile name %s/%s.log"),
+                        logDir, name);
         return -1;
     }
 
@@ -697,7 +696,7 @@ qemuHandleMonitorEOF(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
 
 
 static virStorageEncryptionPtr
-findDomainDiskEncryption(virConnectPtr conn, virDomainObjPtr vm,
+findDomainDiskEncryption(virDomainObjPtr vm,
                          const char *path)
 {
     bool seen_volume;
@@ -715,12 +714,12 @@ findDomainDiskEncryption(virConnectPtr conn, virDomainObjPtr vm,
         }
     }
     if (seen_volume)
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_DOMAIN,
-                         _("missing <encryption> for volume %s"), path);
+        qemuReportError(VIR_ERR_INVALID_DOMAIN,
+                        _("missing <encryption> for volume %s"), path);
     else
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unexpected passphrase request for volume %s"),
-                         path);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unexpected passphrase request for volume %s"),
+                        path);
     return NULL;
 }
 
@@ -743,20 +742,20 @@ findVolumeQcowPassphrase(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     virDomainObjLock(vm);
 
     if (!conn) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                         "%s", _("cannot find secrets without a connection"));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        "%s", _("cannot find secrets without a connection"));
         goto cleanup;
     }
 
     if (conn->secretDriver == NULL ||
         conn->secretDriver->lookupByUUID == NULL ||
         conn->secretDriver->getValue == NULL) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
-                         _("secret storage not supported"));
+        qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+                        _("secret storage not supported"));
         goto cleanup;
     }
 
-    enc = findDomainDiskEncryption(conn, vm, path);
+    enc = findDomainDiskEncryption(vm, path);
     if (enc == NULL)
         return -1;
 
@@ -764,8 +763,8 @@ findVolumeQcowPassphrase(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
         enc->nsecrets != 1 ||
         enc->secrets[0]->type !=
         VIR_STORAGE_ENCRYPTION_SECRET_TYPE_PASSPHRASE) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_DOMAIN,
-                         _("invalid <encryption> for volume %s"), path);
+        qemuReportError(VIR_ERR_INVALID_DOMAIN,
+                        _("invalid <encryption> for volume %s"), path);
         goto cleanup;
     }
 
@@ -782,9 +781,9 @@ findVolumeQcowPassphrase(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
     if (memchr(data, '\0', size) != NULL) {
         memset(data, 0, size);
         VIR_FREE(data);
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_SECRET,
-                         _("format='qcow' passphrase for %s must not contain a "
-                           "'\\0'"), path);
+        qemuReportError(VIR_ERR_INVALID_SECRET,
+                        _("format='qcow' passphrase for %s must not contain a "
+                          "'\\0'"), path);
         goto cleanup;
     }
 
@@ -1313,8 +1312,7 @@ qemudShutdown(void) {
     return 0;
 }
 
-typedef int qemuLogHandleOutput(virConnectPtr conn,
-                                virDomainObjPtr vm,
+typedef int qemuLogHandleOutput(virDomainObjPtr vm,
                                 const char *output,
                                 int fd);
 
@@ -1322,8 +1320,7 @@ typedef int qemuLogHandleOutput(virConnectPtr conn,
  * Returns -1 for error, 0 on success
  */
 static int
-qemudReadLogOutput(virConnectPtr conn,
-                   virDomainObjPtr vm,
+qemudReadLogOutput(virDomainObjPtr vm,
                    int fd,
                    char *buf,
                    size_t buflen,
@@ -1339,7 +1336,7 @@ qemudReadLogOutput(virConnectPtr conn,
         ssize_t func_ret, ret;
         int isdead = 0;
 
-        func_ret = func(conn, vm, buf, fd);
+        func_ret = func(vm, buf, fd);
 
         if (kill(vm->pid, 0) == -1 && errno == ESRCH)
             isdead = 1;
@@ -1357,16 +1354,16 @@ qemudReadLogOutput(virConnectPtr conn,
         got += ret;
         buf[got] = '\0';
         if (got == buflen-1) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Out of space while reading %s log output"),
-                             what);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Out of space while reading %s log output"),
+                            what);
             return -1;
         }
 
         if (isdead) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Process exited while reading %s log output"),
-                             what);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Process exited while reading %s log output"),
+                            what);
             return -1;
         }
 
@@ -1377,8 +1374,8 @@ qemudReadLogOutput(virConnectPtr conn,
         retries--;
     }
 
-    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                     _("Timed out while reading %s log output"), what);
+    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                    _("Timed out while reading %s log output"), what);
     return -1;
 }
 
@@ -1436,8 +1433,7 @@ qemudExtractTTYPath(const char *haystack,
 }
 
 static int
-qemudFindCharDevicePTYsMonitor(virConnectPtr conn,
-                               virDomainObjPtr vm,
+qemudFindCharDevicePTYsMonitor(virDomainObjPtr vm,
                                virHashTablePtr paths)
 {
     int i;
@@ -1456,9 +1452,9 @@ qemudFindCharDevicePTYsMonitor(virConnectPtr conn,
                 if (chr->data.file.path == NULL) {                        \
                     /* neither the log output nor 'info chardev' had a */ \
                     /* pty path for this chardev, report an error */      \
-                    qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, \
-                                     _("no assigned pty for device %s"), id);  \
-                    return -1;                                                 \
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR,               \
+                                    _("no assigned pty for device %s"), id); \
+                    return -1;                                            \
                 } else {                                                  \
                     /* 'info chardev' had no pty path for this chardev, */\
                     /* but the log output had, so we're fine */           \
@@ -1485,8 +1481,7 @@ qemudFindCharDevicePTYsMonitor(virConnectPtr conn,
 }
 
 static int
-qemudFindCharDevicePTYs(virConnectPtr conn ATTRIBUTE_UNUSED /*TEMPORARY*/,
-                        virDomainObjPtr vm,
+qemudFindCharDevicePTYs(virDomainObjPtr vm,
                         const char *output,
                         int fd ATTRIBUTE_UNUSED)
 {
@@ -1536,19 +1531,18 @@ static void qemudFreePtyPath(void *payload, const char *name ATTRIBUTE_UNUSED)
 }
 
 static int
-qemudWaitForMonitor(virConnectPtr conn,
-                    struct qemud_driver* driver,
+qemudWaitForMonitor(struct qemud_driver* driver,
                     virDomainObjPtr vm, off_t pos)
 {
     char buf[4096]; /* Plenty of space to get startup greeting */
     int logfd;
     int ret = -1;
 
-    if ((logfd = qemudLogReadFD(conn, driver->logDir, vm->def->name, pos))
+    if ((logfd = qemudLogReadFD(driver->logDir, vm->def->name, pos))
         < 0)
         return -1;
 
-    ret = qemudReadLogOutput(conn, vm, logfd, buf, sizeof(buf),
+    ret = qemudReadLogOutput(vm, logfd, buf, sizeof(buf),
                              qemudFindCharDevicePTYs,
                              "console", 3);
     if (close(logfd) < 0) {
@@ -1559,8 +1553,8 @@ qemudWaitForMonitor(virConnectPtr conn,
 
     if (ret < 0) {
         /* Unexpected end of file - inform user of QEMU log data */
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unable to start guest: %s"), buf);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unable to start guest: %s"), buf);
         return -1;
     }
 
@@ -1585,7 +1579,7 @@ qemudWaitForMonitor(virConnectPtr conn,
 
     VIR_DEBUG("qemuMonitorGetPtyPaths returned %i", ret);
     if (ret == 0) {
-        ret = qemudFindCharDevicePTYsMonitor(conn, vm, paths);
+        ret = qemudFindCharDevicePTYsMonitor(vm, paths);
     }
 
 cleanup:
@@ -1597,8 +1591,7 @@ cleanup:
 }
 
 static int
-qemuDetectVcpuPIDs(virConnectPtr conn,
-                   struct qemud_driver *driver,
+qemuDetectVcpuPIDs(struct qemud_driver *driver,
                    virDomainObjPtr vm) {
     pid_t *cpupids = NULL;
     int ncpupids;
@@ -1628,9 +1621,9 @@ qemuDetectVcpuPIDs(virConnectPtr conn,
         return 0;
 
     if (ncpupids != vm->def->vcpus) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("got wrong number of vCPU pids from QEMU monitor. got %d, wanted %d"),
-                         ncpupids, (int)vm->def->vcpus);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("got wrong number of vCPU pids from QEMU monitor. got %d, wanted %d"),
+                        ncpupids, (int)vm->def->vcpus);
         VIR_FREE(cpupids);
         return -1;
     }
@@ -1641,15 +1634,15 @@ qemuDetectVcpuPIDs(virConnectPtr conn,
 }
 
 static int
-qemudInitCpuAffinity(virConnectPtr conn,
-                     virDomainObjPtr vm) {
+qemudInitCpuAffinity(virDomainObjPtr vm)
+{
     int i, hostcpus, maxcpu = QEMUD_CPUMASK_LEN;
     virNodeInfo nodeinfo;
     unsigned char *cpumap;
     int cpumaplen;
     qemuDomainObjPrivatePtr priv = vm->privateData;
 
-    if (nodeGetInfo(conn, &nodeinfo) < 0)
+    if (nodeGetInfo(NULL, &nodeinfo) < 0)
         return -1;
 
     /* setaffinity fails if you set bits for CPUs which
@@ -1963,9 +1956,9 @@ qemuAssignPCIAddresses(virDomainObjPtr vm,
         if (qemuAssignNextPCIAddress(&(vm->def->disks[i]->info),
                                      vendor, product,
                                      addrs, naddrs) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot find PCI address for VirtIO disk %s"),
-                             vm->def->disks[i]->dst);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot find PCI address for VirtIO disk %s"),
+                            vm->def->disks[i]->dst);
             return -1;
         }
     }
@@ -1977,9 +1970,9 @@ qemuAssignPCIAddresses(virDomainObjPtr vm,
         if (qemuAssignNextPCIAddress(&(vm->def->nets[i]->info),
                                      vendor, product,
                                      addrs,  naddrs) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot find PCI address for %s NIC"),
-                             vm->def->nets[i]->model);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot find PCI address for %s NIC"),
+                            vm->def->nets[i]->model);
             return -1;
         }
     }
@@ -1991,9 +1984,9 @@ qemuAssignPCIAddresses(virDomainObjPtr vm,
         if (qemuAssignNextPCIAddress(&(vm->def->controllers[i]->info),
                                      vendor, product,
                                      addrs,  naddrs) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot find PCI address for controller %s"),
-                             virDomainControllerTypeToString(vm->def->controllers[i]->type));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot find PCI address for controller %s"),
+                            virDomainControllerTypeToString(vm->def->controllers[i]->type));
             return -1;
         }
     }
@@ -2005,9 +1998,9 @@ qemuAssignPCIAddresses(virDomainObjPtr vm,
         if (qemuAssignNextPCIAddress(&(vm->def->videos[i]->info),
                                      vendor, product,
                                      addrs,  naddrs) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot find PCI address for video adapter %s"),
-                             virDomainVideoTypeToString(vm->def->videos[i]->type));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot find PCI address for video adapter %s"),
+                            virDomainVideoTypeToString(vm->def->videos[i]->type));
             return -1;
         }
     }
@@ -2019,9 +2012,9 @@ qemuAssignPCIAddresses(virDomainObjPtr vm,
         if (qemuAssignNextPCIAddress(&(vm->def->sounds[i]->info),
                                      vendor, product,
                                      addrs,  naddrs) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot find PCI address for sound adapter %s"),
-                             virDomainSoundModelTypeToString(vm->def->sounds[i]->model));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot find PCI address for sound adapter %s"),
+                            virDomainSoundModelTypeToString(vm->def->sounds[i]->model));
             return -1;
         }
     }
@@ -2032,9 +2025,9 @@ qemuAssignPCIAddresses(virDomainObjPtr vm,
         if (qemuAssignNextPCIAddress(&(vm->def->watchdog->info),
                                      vendor, product,
                                      addrs,  naddrs) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot find PCI address for watchdog %s"),
-                             virDomainWatchdogModelTypeToString(vm->def->watchdog->model));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot find PCI address for watchdog %s"),
+                            virDomainWatchdogModelTypeToString(vm->def->watchdog->model));
             return -1;
         }
     }
@@ -2406,8 +2399,7 @@ cleanup:
 }
 
 
-static int qemuRemoveCgroup(virConnectPtr conn,
-                            struct qemud_driver *driver,
+static int qemuRemoveCgroup(struct qemud_driver *driver,
                             virDomainObjPtr vm,
                             int quiet)
 {
@@ -2420,9 +2412,9 @@ static int qemuRemoveCgroup(virConnectPtr conn,
     rc = virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0);
     if (rc != 0) {
         if (!quiet)
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Unable to find cgroup for %s\n"),
-                             vm->def->name);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Unable to find cgroup for %s\n"),
+                            vm->def->name);
         return rc;
     }
 
@@ -2538,8 +2530,8 @@ static int qemudStartVMDaemon(virConnectPtr conn,
     FD_ZERO(&keepfd);
 
     if (virDomainObjIsActive(vm)) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("VM is already active"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("VM is already active"));
         return -1;
     }
 
@@ -2556,15 +2548,15 @@ static int qemudStartVMDaemon(virConnectPtr conn,
         goto cleanup;
 
     /* Ensure no historical cgroup for this VM is lieing around bogus settings */
-    qemuRemoveCgroup(conn, driver, vm, 1);
+    qemuRemoveCgroup(driver, vm, 1);
 
     if ((vm->def->ngraphics == 1) &&
         vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
         vm->def->graphics[0]->data.vnc.autoport) {
         int port = qemudNextFreeVNCPort(driver);
         if (port < 0) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             "%s", _("Unable to find an unused VNC port"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            "%s", _("Unable to find an unused VNC port"));
             goto cleanup;
         }
         vm->def->graphics[0]->data.vnc.port = port;
@@ -2691,8 +2683,8 @@ static int qemudStartVMDaemon(virConnectPtr conn,
     /* wait for qemu process to to show up */
     if (ret == 0) {
         if (virFileReadPid(driver->stateDir, vm->def->name, &vm->pid)) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("Domain %s didn't show up\n"), vm->def->name);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("Domain %s didn't show up\n"), vm->def->name);
             ret = -1;
         }
     } else if (ret == -2) {
@@ -2727,13 +2719,13 @@ static int qemudStartVMDaemon(virConnectPtr conn,
     if (ret == -1) /* The VM failed to start */
         goto cleanup;
 
-    if (qemudWaitForMonitor(conn, driver, vm, pos) < 0)
+    if (qemudWaitForMonitor(driver, vm, pos) < 0)
         goto abort;
 
-    if (qemuDetectVcpuPIDs(conn, driver, vm) < 0)
+    if (qemuDetectVcpuPIDs(driver, vm) < 0)
         goto abort;
 
-    if (qemudInitCpuAffinity(conn, vm) < 0)
+    if (qemudInitCpuAffinity(vm) < 0)
         goto abort;
 
     if (qemuInitPasswords(driver, vm) < 0)
@@ -2756,8 +2748,8 @@ static int qemudStartVMDaemon(virConnectPtr conn,
         /* Allow the CPUS to start executing */
         if (qemuMonitorStartCPUs(priv->mon, conn) < 0) {
             if (virGetLastError() == NULL)
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 "%s", _("resume operation failed"));
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                "%s", _("resume operation failed"));
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             goto abort;
         }
@@ -2782,7 +2774,7 @@ cleanup:
     if (driver->securityDriver &&
         driver->securityDriver->domainReleaseSecurityLabel)
         driver->securityDriver->domainReleaseSecurityLabel(conn, vm);
-    qemuRemoveCgroup(conn, driver, vm, 0);
+    qemuRemoveCgroup(driver, vm, 0);
     if ((vm->def->ngraphics == 1) &&
         vm->def->graphics[0]->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC &&
         vm->def->graphics[0]->data.vnc.autoport)
@@ -2882,7 +2874,7 @@ static void qemudShutdownVMDaemon(virConnectPtr conn,
     qemuDomainReAttachHostDevices(driver, vm->def);
 
 retry:
-    if ((ret = qemuRemoveCgroup(conn, driver, vm, 0)) < 0) {
+    if ((ret = qemuRemoveCgroup(driver, vm, 0)) < 0) {
         if (ret == -EBUSY && (retries++ < 5)) {
             usleep(200*1000);
             goto retry;
@@ -2938,33 +2930,33 @@ static virDrvOpenStatus qemudOpen(virConnectPtr conn,
             return VIR_DRV_OPEN_DECLINED;
 
         if (qemu_driver == NULL) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("qemu state driver is not active"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("qemu state driver is not active"));
             return VIR_DRV_OPEN_ERROR;
         }
 
         if (conn->uri->path == NULL) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("no QEMU URI path given, try %s"),
-                             qemu_driver->privileged
-                               ? "qemu:///system"
-                               : "qemu:///session");
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("no QEMU URI path given, try %s"),
+                            qemu_driver->privileged
+                            ? "qemu:///system"
+                            : "qemu:///session");
                 return VIR_DRV_OPEN_ERROR;
         }
 
         if (qemu_driver->privileged) {
             if (STRNEQ (conn->uri->path, "/system") &&
                 STRNEQ (conn->uri->path, "/session")) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("unexpected QEMU URI path '%s', try qemu:///system"),
-                                 conn->uri->path);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("unexpected QEMU URI path '%s', try qemu:///system"),
+                                conn->uri->path);
                 return VIR_DRV_OPEN_ERROR;
             }
         } else {
             if (STRNEQ (conn->uri->path, "/session")) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("unexpected QEMU URI path '%s', try qemu:///session"),
-                                 conn->uri->path);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("unexpected QEMU URI path '%s', try qemu:///session"),
+                                conn->uri->path);
                 return VIR_DRV_OPEN_ERROR;
             }
         }
@@ -3038,7 +3030,7 @@ static int kvmGetMaxVCPUs(void) {
 }
 
 
-static int qemudGetMaxVCPUs(virConnectPtr conn, const char *type) {
+static int qemudGetMaxVCPUs(virConnectPtr conn ATTRIBUTE_UNUSED, const char *type) {
     if (!type)
         return 16;
 
@@ -3051,8 +3043,8 @@ static int qemudGetMaxVCPUs(virConnectPtr conn, const char *type) {
     if (STRCASEEQ(type, "kqemu"))
         return 1;
 
-    qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_ARG,
-                     _("unknown type '%s'"), type);
+    qemuReportError(VIR_ERR_INVALID_ARG,
+                    _("unknown type '%s'"), type);
     return -1;
 }
 
@@ -3156,8 +3148,8 @@ static virDomainPtr qemudDomainLookupByID(virConnectPtr conn,
     qemuDriverUnlock(driver);
 
     if (!vm) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching id %d"), id);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching id %d"), id);
         goto cleanup;
     }
 
@@ -3183,8 +3175,8 @@ static virDomainPtr qemudDomainLookupByUUID(virConnectPtr conn,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(uuid, uuidstr);
-        qemudReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -3208,8 +3200,8 @@ static virDomainPtr qemudDomainLookupByName(virConnectPtr conn,
     qemuDriverUnlock(driver);
 
     if (!vm) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching name '%s'"), name);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching name '%s'"), name);
         goto cleanup;
     }
 
@@ -3233,7 +3225,7 @@ static int qemuDomainIsActive(virDomainPtr dom)
     obj = virDomainFindByUUID(&driver->domains, dom->uuid);
     qemuDriverUnlock(driver);
     if (!obj) {
-        qemudReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+        qemuReportError(VIR_ERR_NO_DOMAIN, NULL);
         goto cleanup;
     }
     ret = virDomainObjIsActive(obj);
@@ -3254,7 +3246,7 @@ static int qemuDomainIsPersistent(virDomainPtr dom)
     obj = virDomainFindByUUID(&driver->domains, dom->uuid);
     qemuDriverUnlock(driver);
     if (!obj) {
-        qemudReportError(dom->conn, NULL, NULL, VIR_ERR_NO_DOMAIN, NULL);
+        qemuReportError(VIR_ERR_NO_DOMAIN, NULL);
         goto cleanup;
     }
     ret = obj->persistent;
@@ -3377,16 +3369,16 @@ static int qemudDomainSuspend(virDomainPtr dom) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
     if (qemuDomainObjBeginJobWithDriver(driver, vm) < 0)
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
         goto endjob;
     }
     if (vm->state != VIR_DOMAIN_PAUSED) {
@@ -3433,8 +3425,8 @@ static int qemudDomainResume(virDomainPtr dom) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -3442,8 +3434,8 @@ static int qemudDomainResume(virDomainPtr dom) {
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
         goto endjob;
     }
     if (vm->state == VIR_DOMAIN_PAUSED) {
@@ -3452,8 +3444,8 @@ static int qemudDomainResume(virDomainPtr dom) {
         if (qemuMonitorStartCPUs(priv->mon, dom->conn) < 0) {
             qemuDomainObjExitMonitorWithDriver(driver, vm);
             if (virGetLastError() == NULL)
-                qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                                 "%s", _("resume operation failed"));
+                qemuReportError(VIR_ERR_OPERATION_FAILED,
+                                "%s", _("resume operation failed"));
             goto endjob;
         }
         qemuDomainObjExitMonitorWithDriver(driver, vm);
@@ -3492,8 +3484,8 @@ static int qemudDomainShutdown(virDomainPtr dom) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -3501,8 +3493,8 @@ static int qemudDomainShutdown(virDomainPtr dom) {
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
         goto endjob;
     }
 
@@ -3533,8 +3525,8 @@ static int qemudDomainDestroy(virDomainPtr dom) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -3542,8 +3534,8 @@ static int qemudDomainDestroy(virDomainPtr dom) {
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
         goto endjob;
     }
 
@@ -3585,8 +3577,8 @@ static char *qemudDomainGetOSType(virDomainPtr dom) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -3612,8 +3604,8 @@ static unsigned long qemudDomainGetMaxMemory(virDomainPtr dom) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -3637,14 +3629,14 @@ static int qemudDomainSetMaxMemory(virDomainPtr dom, unsigned long newmax) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (newmax < vm->def->memory) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                         "%s", _("cannot set max memory lower than current memory"));
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        "%s", _("cannot set max memory lower than current memory"));
         goto cleanup;;
     }
 
@@ -3669,14 +3661,14 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (newmem > vm->def->maxmem) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                         "%s", _("cannot set memory higher than max memory"));
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        "%s", _("cannot set memory higher than max memory"));
         goto cleanup;
     }
 
@@ -3693,8 +3685,8 @@ static int qemudDomainSetMemory(virDomainPtr dom, unsigned long newmem) {
 
         /* Lack of balloon support is a fatal error */
         if (r == 0) {
-            qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                             "%s", _("cannot set memory of an active domain"));
+            qemuReportError(VIR_ERR_NO_SUPPORT,
+                            "%s", _("cannot set memory of an active domain"));
             goto endjob;
         }
     } else {
@@ -3726,8 +3718,8 @@ static int qemudDomainGetInfo(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -3737,7 +3729,7 @@ static int qemudDomainGetInfo(virDomainPtr dom,
         info->cpuTime = 0;
     } else {
         if (qemudGetProcessInfo(&(info->cpuTime), NULL, vm->pid, 0) < 0) {
-            qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, ("cannot read cputime for domain"));
+            qemuReportError(VIR_ERR_OPERATION_FAILED, ("cannot read cputime for domain"));
             goto cleanup;
         }
     }
@@ -3846,9 +3838,9 @@ static int qemudDomainSave(virDomainPtr dom,
         header.compressed =
             qemudSaveCompressionTypeFromString(driver->saveImageFormat);
         if (header.compressed < 0) {
-            qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                             "%s", _("Invalid save image format specified "
-                                     "in configuration file"));
+            qemuReportError(VIR_ERR_OPERATION_FAILED,
+                            "%s", _("Invalid save image format specified "
+                                    "in configuration file"));
             goto cleanup;
         }
     }
@@ -3858,8 +3850,8 @@ static int qemudDomainSave(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -3867,8 +3859,8 @@ static int qemudDomainSave(virDomainPtr dom,
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
         goto endjob;
     }
 
@@ -3888,27 +3880,27 @@ static int qemudDomainSave(virDomainPtr dom,
     /* Get XML for the domain */
     xml = virDomainDefFormat(dom->conn, vm->def, VIR_DOMAIN_XML_SECURE);
     if (!xml) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("failed to get domain xml"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to get domain xml"));
         goto endjob;
     }
     header.xml_len = strlen(xml) + 1;
 
     /* Write header to file, followed by XML */
     if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("failed to create '%s'"), path);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("failed to create '%s'"), path);
         goto endjob;
     }
 
     if (safewrite(fd, &header, sizeof(header)) != sizeof(header)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("failed to write save header"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to write save header"));
         goto endjob;
     }
 
     if (safewrite(fd, xml, header.xml_len) != header.xml_len) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
                          "%s", _("failed to write xml"));
         goto endjob;
     }
@@ -4007,8 +3999,8 @@ static int qemudDomainCoreDump(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -4016,15 +4008,15 @@ static int qemudDomainCoreDump(virDomainPtr dom,
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
         goto endjob;
     }
 
     /* Create an empty file with appropriate ownership.  */
     if ((fd = open(path, O_CREAT|O_TRUNC|O_WRONLY, S_IRUSR|S_IWUSR)) < 0) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("failed to create '%s'"), path);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("failed to create '%s'"), path);
         goto endjob;
     }
 
@@ -4082,8 +4074,8 @@ endjob:
         qemuDomainObjEnterMonitor(vm);
         if (qemuMonitorStartCPUs(priv->mon, dom->conn) < 0) {
             if (virGetLastError() == NULL)
-                qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                                 "%s", _("resuming after dump failed"));
+                qemuReportError(VIR_ERR_OPERATION_FAILED,
+                                "%s", _("resuming after dump failed"));
         }
         qemuDomainObjExitMonitor(vm);
     }
@@ -4121,8 +4113,8 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -4130,28 +4122,28 @@ static int qemudDomainSetVcpus(virDomainPtr dom, unsigned int nvcpus) {
         goto cleanup;
 
     if (virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID, "%s",
-                         _("cannot change vcpu count of an active domain"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID, "%s",
+                        _("cannot change vcpu count of an active domain"));
         goto endjob;
     }
 
     if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unknown virt type in domain definition '%d'"),
-                         vm->def->virtType);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unknown virt type in domain definition '%d'"),
+                        vm->def->virtType);
         goto endjob;
     }
 
-    if ((max = qemudGetMaxVCPUs(dom->conn, type)) < 0) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("could not determine max vcpus for the domain"));
+    if ((max = qemudGetMaxVCPUs(NULL, type)) < 0) {
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("could not determine max vcpus for the domain"));
         goto endjob;
     }
 
     if (nvcpus > max) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                         _("requested vcpus is greater than max allowable"
-                           " vcpus for the domain: %d > %d"), nvcpus, max);
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        _("requested vcpus is greater than max allowable"
+                          " vcpus for the domain: %d > %d"), nvcpus, max);
         goto endjob;
     }
 
@@ -4188,23 +4180,23 @@ qemudDomainPinVcpu(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s",_("cannot pin vcpus on an inactive domain"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s",_("cannot pin vcpus on an inactive domain"));
         goto cleanup;
     }
 
     priv = vm->privateData;
 
     if (vcpu > (priv->nvcpupids-1)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                         _("vcpu number out of range %d > %d"),
-                         vcpu, priv->nvcpupids);
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        _("vcpu number out of range %d > %d"),
+                        vcpu, priv->nvcpupids);
         goto cleanup;
     }
 
@@ -4221,8 +4213,8 @@ qemudDomainPinVcpu(virDomainPtr dom,
                                       cpumap, maplen, maxcpu) < 0)
             goto cleanup;
     } else {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                         "%s", _("cpu affinity is not supported"));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        "%s", _("cpu affinity is not supported"));
         goto cleanup;
     }
     ret = 0;
@@ -4253,15 +4245,15 @@ qemudDomainGetVcpus(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s",
-                         _("cannot list vcpu pinning for an inactive domain"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s",
+                        _("cannot list vcpu pinning for an inactive domain"));
         goto cleanup;
     }
 
@@ -4309,8 +4301,8 @@ qemudDomainGetVcpus(virDomainPtr dom,
                         goto cleanup;
                 }
             } else {
-                qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                                 "%s", _("cpu affinity is not available"));
+                qemuReportError(VIR_ERR_NO_SUPPORT,
+                                "%s", _("cpu affinity is not available"));
                 goto cleanup;
             }
         }
@@ -4337,19 +4329,19 @@ static int qemudDomainGetMaxVcpus(virDomainPtr dom) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unknown virt type in domain definition '%d'"),
-                         vm->def->virtType);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unknown virt type in domain definition '%d'"),
+                        vm->def->virtType);
         goto cleanup;
     }
 
-    ret = qemudGetMaxVCPUs(dom->conn, type);
+    ret = qemudGetMaxVCPUs(NULL, type);
 
 cleanup:
     if (vm)
@@ -4372,15 +4364,15 @@ static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr sec
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!(type = virDomainVirtTypeToString(vm->def->virtType))) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unknown virt type in domain definition '%d'"),
-                         vm->def->virtType);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unknown virt type in domain definition '%d'"),
+                        vm->def->virtType);
         goto cleanup;
     }
 
@@ -4401,8 +4393,8 @@ static int qemudDomainGetSecurityLabel(virDomainPtr dom, virSecurityLabelPtr sec
     if (virDomainObjIsActive(vm)) {
         if (driver->securityDriver && driver->securityDriver->domainGetSecurityProcessLabel) {
             if (driver->securityDriver->domainGetSecurityProcessLabel(dom->conn, vm, seclabel) == -1) {
-                qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 "%s", _("Failed to get security label"));
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                "%s", _("Failed to get security label"));
                 goto cleanup;
             }
         }
@@ -4432,9 +4424,9 @@ static int qemudNodeGetSecurityModel(virConnectPtr conn,
 
     p = driver->caps->host.secModel.model;
     if (strlen(p) >= VIR_SECURITY_MODEL_BUFLEN-1) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("security model string exceeds max %d bytes"),
-                         VIR_SECURITY_MODEL_BUFLEN-1);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("security model string exceeds max %d bytes"),
+                        VIR_SECURITY_MODEL_BUFLEN-1);
         ret = -1;
         goto cleanup;
     }
@@ -4442,9 +4434,9 @@ static int qemudNodeGetSecurityModel(virConnectPtr conn,
 
     p = driver->caps->host.secModel.doi;
     if (strlen(p) >= VIR_SECURITY_DOI_BUFLEN-1) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("security DOI string exceeds max %d bytes"),
-                         VIR_SECURITY_DOI_BUFLEN-1);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("security DOI string exceeds max %d bytes"),
+                        VIR_SECURITY_DOI_BUFLEN-1);
         ret = -1;
         goto cleanup;
     }
@@ -4473,27 +4465,27 @@ static int qemudDomainRestore(virConnectPtr conn,
     qemuDriverLock(driver);
     /* Verify the header and read the XML */
     if ((fd = open(path, O_RDONLY)) < 0) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("cannot read domain image"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("cannot read domain image"));
         goto cleanup;
     }
 
     if (saferead(fd, &header, sizeof(header)) != sizeof(header)) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("failed to read qemu header"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to read qemu header"));
         goto cleanup;
     }
 
     if (memcmp(header.magic, QEMUD_SAVE_MAGIC, sizeof(header.magic)) != 0) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("image magic is incorrect"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("image magic is incorrect"));
         goto cleanup;
     }
 
     if (header.version > QEMUD_SAVE_VERSION) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("image version is not supported (%d > %d)"),
-                         header.version, QEMUD_SAVE_VERSION);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("image version is not supported (%d > %d)"),
+                        header.version, QEMUD_SAVE_VERSION);
         goto cleanup;
     }
 
@@ -4503,16 +4495,16 @@ static int qemudDomainRestore(virConnectPtr conn,
     }
 
     if (saferead(fd, xml, header.xml_len) != header.xml_len) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("failed to read XML"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to read XML"));
         goto cleanup;
     }
 
     /* Create a domain from this XML */
     if (!(def = virDomainDefParseString(conn, driver->caps, xml,
                                         VIR_DOMAIN_XML_INACTIVE))) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("failed to parse XML"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to parse XML"));
         goto cleanup;
     }
 
@@ -4523,8 +4515,8 @@ static int qemudDomainRestore(virConnectPtr conn,
                                   driver->caps,
                                   &driver->domains,
                                   def))) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("failed to assign new VM"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to assign new VM"));
         goto cleanup;
     }
     def = NULL;
@@ -4536,9 +4528,9 @@ static int qemudDomainRestore(virConnectPtr conn,
         const char *intermediate_argv[3] = { NULL, "-dc", NULL };
         const char *prog = qemudSaveCompressionTypeToString(header.compressed);
         if (prog == NULL) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                             _("Invalid compressed save format %d"),
-                             header.compressed);
+            qemuReportError(VIR_ERR_OPERATION_FAILED,
+                            _("Invalid compressed save format %d"),
+                            header.compressed);
             goto endjob;
         }
 
@@ -4548,9 +4540,9 @@ static int qemudDomainRestore(virConnectPtr conn,
             fd = -1;
             if (virExec(intermediate_argv, NULL, NULL,
                         &intermediate_pid, intermediatefd, &fd, NULL, 0) < 0) {
-                qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("Failed to start decompression binary %s"),
-                                 intermediate_argv[0]);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Failed to start decompression binary %s"),
+                                intermediate_argv[0]);
                 goto endjob;
             }
         }
@@ -4586,8 +4578,8 @@ static int qemudDomainRestore(virConnectPtr conn,
         qemuDomainObjEnterMonitorWithDriver(driver, vm);
         if (qemuMonitorStartCPUs(priv->mon, conn) < 0) {
             if (virGetLastError() == NULL)
-                qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                                 "%s", _("failed to resume domain"));
+                qemuReportError(VIR_ERR_OPERATION_FAILED,
+                                "%s", _("failed to resume domain"));
             qemuDomainObjExitMonitorWithDriver(driver,vm);
             goto endjob;
         }
@@ -4631,8 +4623,8 @@ static char *qemudDomainDumpXML(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -4681,13 +4673,13 @@ static char *qemuDomainXMLFromNative(virConnectPtr conn,
     char *xml = NULL;
 
     if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_ARG,
-                         _("unsupported config type %s"), format);
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        _("unsupported config type %s"), format);
         goto cleanup;
     }
 
     qemuDriverLock(driver);
-    def = qemuParseCommandLineString(conn, driver->caps, config);
+    def = qemuParseCommandLineString(driver->caps, config);
     qemuDriverUnlock(driver);
     if (!def)
         goto cleanup;
@@ -4719,8 +4711,8 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
     qemuDriverLock(driver);
 
     if (STRNEQ(format, QEMU_CONFIG_FORMAT_ARGV)) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INVALID_ARG,
-                         _("unsupported config type %s"), format);
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        _("unsupported config type %s"), format);
         goto cleanup;
     }
 
@@ -4778,9 +4770,9 @@ static char *qemuDomainXMLToNative(virConnectPtr conn,
     if (qemudExtractVersionInfo(emulator,
                                 NULL,
                                 &qemuCmdFlags) < 0) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("Cannot determine QEMU argv syntax %s"),
-                         emulator);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Cannot determine QEMU argv syntax %s"),
+                        emulator);
         goto cleanup;
     }
 
@@ -4866,8 +4858,8 @@ static int qemudDomainStart(virDomainPtr dom) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -4875,8 +4867,8 @@ static int qemudDomainStart(virDomainPtr dom) {
         goto cleanup;
 
     if (virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("domain is already running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is already running"));
         goto endjob;
     }
 
@@ -5072,20 +5064,20 @@ static int qemudDomainUndefine(virDomainPtr dom) {
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("cannot delete active domain"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("cannot delete active domain"));
         goto cleanup;
     }
 
     if (!vm->persistent) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("cannot undefine transient domain"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("cannot undefine transient domain"));
         goto cleanup;
     }
 
@@ -5130,24 +5122,24 @@ static int qemudDomainChangeEjectableMedia(virConnectPtr conn,
     }
 
     if (!origdisk) {
-        qemudReportError(conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("No device with bus '%s' and target '%s'"),
-                         virDomainDiskBusTypeToString(disk->bus),
-                         disk->dst);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("No device with bus '%s' and target '%s'"),
+                        virDomainDiskBusTypeToString(disk->bus),
+                        disk->dst);
         return -1;
     }
 
     if (!origdisk->info.alias) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("missing disk device alias name for %s"), origdisk->dst);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("missing disk device alias name for %s"), origdisk->dst);
         return -1;
     }
 
     if (origdisk->device != VIR_DOMAIN_DISK_DEVICE_FLOPPY &&
         origdisk->device != VIR_DOMAIN_DISK_DEVICE_CDROM) {
-        qemudReportError(conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("Removable media not supported for %s device"),
-                         virDomainDiskDeviceTypeToString(disk->device));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Removable media not supported for %s device"),
+                        virDomainDiskDeviceTypeToString(disk->device));
         return -1;
     }
 
@@ -5200,8 +5192,7 @@ error:
 }
 
 
-static int qemudDomainAttachPciDiskDevice(virConnectPtr conn,
-                                          struct qemud_driver *driver,
+static int qemudDomainAttachPciDiskDevice(struct qemud_driver *driver,
                                           virDomainObjPtr vm,
                                           virDomainDiskDefPtr disk,
                                           int qemuCmdFlags)
@@ -5214,15 +5205,15 @@ static int qemudDomainAttachPciDiskDevice(virConnectPtr conn,
 
     for (i = 0 ; i < vm->def->ndisks ; i++) {
         if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
-            qemudReportError(conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                           _("target %s already exists"), disk->dst);
+            qemuReportError(VIR_ERR_OPERATION_FAILED,
+                            _("target %s already exists"), disk->dst);
             return -1;
         }
     }
 
     if (driver->securityDriver &&
         driver->securityDriver->domainSetSecurityImageLabel &&
-        driver->securityDriver->domainSetSecurityImageLabel(conn, vm, disk) < 0)
+        driver->securityDriver->domainSetSecurityImageLabel(NULL, vm, disk) < 0)
         return -1;
 
     if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
@@ -5234,7 +5225,7 @@ static int qemudDomainAttachPciDiskDevice(virConnectPtr conn,
         if (!(drivestr = qemuBuildDriveStr(disk, 0, qemuCmdFlags)))
             goto error;
 
-        if (!(devstr = qemuBuildDriveDevStr(NULL, disk)))
+        if (!(devstr = qemuBuildDriveDevStr(disk)))
             goto error;
     }
 
@@ -5283,15 +5274,14 @@ error:
 
     if (driver->securityDriver &&
         driver->securityDriver->domainRestoreSecurityImageLabel &&
-        driver->securityDriver->domainRestoreSecurityImageLabel(conn, vm, disk) < 0)
+        driver->securityDriver->domainRestoreSecurityImageLabel(NULL, vm, disk) < 0)
         VIR_WARN("Unable to restore security label on %s", disk->src);
 
     return -1;
 }
 
 
-static int qemudDomainAttachPciControllerDevice(virConnectPtr conn,
-                                                struct qemud_driver *driver,
+static int qemudDomainAttachPciControllerDevice(struct qemud_driver *driver,
                                                 virDomainObjPtr vm,
                                                 virDomainControllerDefPtr controller,
                                                 int qemuCmdFlags)
@@ -5305,9 +5295,9 @@ static int qemudDomainAttachPciControllerDevice(virConnectPtr conn,
     for (i = 0 ; i < vm->def->ncontrollers ; i++) {
         if ((vm->def->controllers[i]->type == controller->type) &&
             (vm->def->controllers[i]->idx == controller->idx)) {
-            qemudReportError(conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                             _("target %s:%d already exists"),
-                             type, controller->idx);
+            qemuReportError(VIR_ERR_OPERATION_FAILED,
+                            _("target %s:%d already exists"),
+                            type, controller->idx);
             return -1;
         }
     }
@@ -5357,8 +5347,7 @@ cleanup:
 
 
 static virDomainControllerDefPtr
-qemuDomainFindOrCreateSCSIDiskController(virConnectPtr conn,
-                                         struct qemud_driver *driver,
+qemuDomainFindOrCreateSCSIDiskController(struct qemud_driver *driver,
                                          virDomainObjPtr vm,
                                          int controller,
                                          int qemuCmdFlags)
@@ -5385,7 +5374,7 @@ qemuDomainFindOrCreateSCSIDiskController(virConnectPtr conn,
     cont->idx = 0;
 
     VIR_INFO0("No SCSI controller present, hotplugging one");
-    if (qemudDomainAttachPciControllerDevice(conn, driver,
+    if (qemudDomainAttachPciControllerDevice(driver,
                                              vm, cont, qemuCmdFlags) < 0) {
         VIR_FREE(cont);
         return NULL;
@@ -5394,8 +5383,7 @@ qemuDomainFindOrCreateSCSIDiskController(virConnectPtr conn,
 }
 
 
-static int qemudDomainAttachSCSIDisk(virConnectPtr conn,
-                                     struct qemud_driver *driver,
+static int qemudDomainAttachSCSIDisk(struct qemud_driver *driver,
                                      virDomainObjPtr vm,
                                      virDomainDiskDefPtr disk,
                                      int qemuCmdFlags)
@@ -5409,8 +5397,8 @@ static int qemudDomainAttachSCSIDisk(virConnectPtr conn,
 
     for (i = 0 ; i < vm->def->ndisks ; i++) {
         if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
-            qemudReportError(conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                           _("target %s already exists"), disk->dst);
+            qemuReportError(VIR_ERR_OPERATION_FAILED,
+                            _("target %s already exists"), disk->dst);
             return -1;
         }
     }
@@ -5418,21 +5406,21 @@ static int qemudDomainAttachSCSIDisk(virConnectPtr conn,
 
     if (driver->securityDriver &&
         driver->securityDriver->domainSetSecurityImageLabel &&
-        driver->securityDriver->domainSetSecurityImageLabel(conn, vm, disk) < 0)
+        driver->securityDriver->domainSetSecurityImageLabel(NULL, vm, disk) < 0)
         return -1;
 
     /* We should have an address already, so make sure */
     if (disk->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DRIVE) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unexpected disk address type %s"),
-                         virDomainDeviceAddressTypeToString(disk->info.type));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unexpected disk address type %s"),
+                        virDomainDeviceAddressTypeToString(disk->info.type));
         goto error;
     }
 
     if (qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE) {
         if (qemuAssignDeviceDiskAlias(disk, qemuCmdFlags) < 0)
             goto error;
-        if (!(devstr = qemuBuildDriveDevStr(NULL, disk)))
+        if (!(devstr = qemuBuildDriveDevStr(disk)))
             goto error;
     }
 
@@ -5440,14 +5428,14 @@ static int qemudDomainAttachSCSIDisk(virConnectPtr conn,
         goto error;
 
     for (i = 0 ; i <= disk->info.addr.drive.controller ; i++) {
-        cont = qemuDomainFindOrCreateSCSIDiskController(conn, driver, vm, i, qemuCmdFlags);
+        cont = qemuDomainFindOrCreateSCSIDiskController(driver, vm, i, qemuCmdFlags);
         if (!cont)
             goto error;
     }
 
     if (cont->info.type != VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("SCSI controller %d was missing its PCI address"), cont->idx);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("SCSI controller %d was missing its PCI address"), cont->idx);
         goto error;
     }
 
@@ -5495,15 +5483,14 @@ error:
 
     if (driver->securityDriver &&
         driver->securityDriver->domainRestoreSecurityImageLabel &&
-        driver->securityDriver->domainRestoreSecurityImageLabel(conn, vm, disk) < 0)
+        driver->securityDriver->domainRestoreSecurityImageLabel(NULL, vm, disk) < 0)
         VIR_WARN("Unable to restore security label on %s", disk->src);
 
     return -1;
 }
 
 
-static int qemudDomainAttachUsbMassstorageDevice(virConnectPtr conn,
-                                                 struct qemud_driver *driver,
+static int qemudDomainAttachUsbMassstorageDevice(struct qemud_driver *driver,
                                                  virDomainObjPtr vm,
                                                  virDomainDiskDefPtr disk,
                                                  int qemuCmdFlags)
@@ -5515,20 +5502,20 @@ static int qemudDomainAttachUsbMassstorageDevice(virConnectPtr conn,
 
     for (i = 0 ; i < vm->def->ndisks ; i++) {
         if (STREQ(vm->def->disks[i]->dst, disk->dst)) {
-            qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                           _("target %s already exists"), disk->dst);
+            qemuReportError(VIR_ERR_OPERATION_FAILED,
+                            _("target %s already exists"), disk->dst);
             return -1;
         }
     }
 
     if (driver->securityDriver &&
         driver->securityDriver->domainSetSecurityImageLabel &&
-        driver->securityDriver->domainSetSecurityImageLabel(conn, vm, disk) < 0)
+        driver->securityDriver->domainSetSecurityImageLabel(NULL, vm, disk) < 0)
         return -1;
 
     if (!disk->src) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("disk source path is missing"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("disk source path is missing"));
         goto error;
     }
 
@@ -5537,7 +5524,7 @@ static int qemudDomainAttachUsbMassstorageDevice(virConnectPtr conn,
             goto error;
         if (!(drivestr = qemuBuildDriveStr(disk, 0, qemuCmdFlags)))
             goto error;
-        if (!(devstr = qemuBuildDriveDevStr(NULL, disk)))
+        if (!(devstr = qemuBuildDriveDevStr(disk)))
             goto error;
     }
 
@@ -5575,13 +5562,14 @@ error:
 
     if (driver->securityDriver &&
         driver->securityDriver->domainRestoreSecurityImageLabel &&
-        driver->securityDriver->domainRestoreSecurityImageLabel(conn, vm, disk) < 0)
+        driver->securityDriver->domainRestoreSecurityImageLabel(NULL, vm, disk) < 0)
         VIR_WARN("Unable to restore security label on %s", disk->src);
 
     return -1;
 }
 
 
+/* XXX conn required for network -> bridge resolution */
 static int qemudDomainAttachNetDevice(virConnectPtr conn,
                                       struct qemud_driver *driver,
                                       virDomainObjPtr vm,
@@ -5598,18 +5586,18 @@ static int qemudDomainAttachNetDevice(virConnectPtr conn,
     int vlan;
 
     if (!(qemuCmdFlags & QEMUD_CMD_FLAG_HOST_NET_ADD)) {
-        qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT, "%s",
-                         _("installed qemu version does not support host_net_add"));
+        qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+                        _("installed qemu version does not support host_net_add"));
         return -1;
     }
 
     if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE ||
         net->type == VIR_DOMAIN_NET_TYPE_NETWORK) {
         if (priv->monConfig->type != VIR_DOMAIN_CHR_TYPE_UNIX) {
-            qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                             _("network device type '%s' cannot be attached: "
-                               "qemu is not using a unix socket monitor"),
-                             virDomainNetTypeToString(net->type));
+            qemuReportError(VIR_ERR_NO_SUPPORT,
+                            _("network device type '%s' cannot be attached: "
+                              "qemu is not using a unix socket monitor"),
+                            virDomainNetTypeToString(net->type));
             return -1;
         }
 
@@ -5633,8 +5621,8 @@ static int qemudDomainAttachNetDevice(virConnectPtr conn,
     vlan = qemuDomainNetVLAN(net);
 
     if (vlan < 0) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
-                         _("Unable to attach network devices without vlan"));
+        qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+                        _("Unable to attach network devices without vlan"));
         goto cleanup;
     }
 
@@ -5650,7 +5638,7 @@ static int qemudDomainAttachNetDevice(virConnectPtr conn,
         qemuDomainObjExitMonitorWithDriver(driver, vm);
     }
 
-    if (!(netstr = qemuBuildHostNetStr(conn, net, ' ',
+    if (!(netstr = qemuBuildHostNetStr(net, ' ',
                                        vlan, tapfd_name)))
         goto try_tapfd_close;
 
@@ -5665,7 +5653,7 @@ static int qemudDomainAttachNetDevice(virConnectPtr conn,
         close(tapfd);
     tapfd = -1;
 
-    if (!(nicstr = qemuBuildNicStr(conn, net, NULL, vlan)))
+    if (!(nicstr = qemuBuildNicStr(net, NULL, vlan)))
         goto try_remove;
 
     qemuDomainObjEnterMonitorWithDriver(driver, vm);
@@ -5852,9 +5840,9 @@ static int qemudDomainAttachHostDevice(virConnectPtr conn,
                                        int qemuCmdFlags)
 {
     if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
-        qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                         _("hostdev mode '%s' not supported"),
-                         virDomainHostdevModeTypeToString(hostdev->mode));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        _("hostdev mode '%s' not supported"),
+                        virDomainHostdevModeTypeToString(hostdev->mode));
         return -1;
     }
 
@@ -5877,9 +5865,9 @@ static int qemudDomainAttachHostDevice(virConnectPtr conn,
         break;
 
     default:
-        qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                         _("hostdev subsys type '%s' not supported"),
-                         virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        _("hostdev subsys type '%s' not supported"),
+                        virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
         goto error;
     }
 
@@ -5910,8 +5898,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -5919,8 +5907,8 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("cannot attach device on inactive domain"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("cannot attach device on inactive domain"));
         goto endjob;
     }
 
@@ -5937,18 +5925,18 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
     if (dev->type == VIR_DOMAIN_DEVICE_DISK) {
         if (qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_DEVICES)) {
             if (virCgroupForDomain(driver->cgroup, vm->def->name, &cgroup, 0) !=0 ) {
-                qemudReportError(dom->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("Unable to find cgroup for %s\n"),
-                                 vm->def->name);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("Unable to find cgroup for %s\n"),
+                                vm->def->name);
                 goto endjob;
             }
             if (dev->data.disk->src != NULL &&
                 dev->data.disk->type == VIR_DOMAIN_DISK_TYPE_BLOCK &&
                 virCgroupAllowDevicePath(cgroup,
                                          dev->data.disk->src) < 0) {
-                qemudReportError(dom->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("unable to allow device %s"),
-                                 dev->data.disk->src);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("unable to allow device %s"),
+                                dev->data.disk->src);
                 goto endjob;
             }
         }
@@ -5963,32 +5951,32 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
 
         case VIR_DOMAIN_DISK_DEVICE_DISK:
             if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_USB) {
-                ret = qemudDomainAttachUsbMassstorageDevice(dom->conn, driver, vm,
+                ret = qemudDomainAttachUsbMassstorageDevice(driver, vm,
                                                             dev->data.disk, qemuCmdFlags);
                 if (ret == 0)
                     dev->data.disk = NULL;
             } else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
-                ret = qemudDomainAttachPciDiskDevice(dom->conn, driver, vm,
+                ret = qemudDomainAttachPciDiskDevice(driver, vm,
                                                      dev->data.disk, qemuCmdFlags);
                 if (ret == 0)
                     dev->data.disk = NULL;
             } else if (dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_SCSI) {
-                ret = qemudDomainAttachSCSIDisk(dom->conn, driver, vm,
+                ret = qemudDomainAttachSCSIDisk(driver, vm,
                                                 dev->data.disk, qemuCmdFlags);
                 if (ret == 0)
                     dev->data.disk = NULL;
             } else {
-                qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                                 _("disk bus '%s' cannot be hotplugged."),
-                                 virDomainDiskBusTypeToString(dev->data.disk->bus));
+                qemuReportError(VIR_ERR_NO_SUPPORT,
+                                _("disk bus '%s' cannot be hotplugged."),
+                                virDomainDiskBusTypeToString(dev->data.disk->bus));
                 /* fallthrough */
             }
             break;
 
         default:
-            qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                             _("disk device type '%s' cannot be hotplugged"),
-                             virDomainDiskDeviceTypeToString(dev->data.disk->device));
+            qemuReportError(VIR_ERR_NO_SUPPORT,
+                            _("disk device type '%s' cannot be hotplugged"),
+                            virDomainDiskDeviceTypeToString(dev->data.disk->device));
             /* Fallthrough */
         }
         if (ret != 0 && cgroup) {
@@ -5997,12 +5985,12 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
         }
     } else if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) {
         if (dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
-            ret = qemudDomainAttachPciControllerDevice(dom->conn, driver, vm,
+            ret = qemudDomainAttachPciControllerDevice(driver, vm,
                                                        dev->data.controller, qemuCmdFlags);
         } else {
-            qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                             _("disk controller bus '%s' cannot be hotplugged."),
-                             virDomainControllerTypeToString(dev->data.controller->type));
+            qemuReportError(VIR_ERR_NO_SUPPORT,
+                            _("disk controller bus '%s' cannot be hotplugged."),
+                            virDomainControllerTypeToString(dev->data.controller->type));
             /* fallthrough */
         }
     } else if (dev->type == VIR_DOMAIN_DEVICE_NET) {
@@ -6016,9 +6004,9 @@ static int qemudDomainAttachDevice(virDomainPtr dom,
         if (ret == 0)
             dev->data.hostdev = NULL;
     } else {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                         _("device type '%s' cannot be attached"),
-                         virDomainDeviceTypeToString(dev->type));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        _("device type '%s' cannot be attached"),
+                        virDomainDeviceTypeToString(dev->type));
         goto endjob;
     }
 
@@ -6044,16 +6032,15 @@ static int qemudDomainAttachDeviceFlags(virDomainPtr dom,
                                         const char *xml,
                                         unsigned int flags) {
     if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("cannot modify the persistent configuration of a domain"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("cannot modify the persistent configuration of a domain"));
         return -1;
     }
 
     return qemudDomainAttachDevice(dom, xml);
 }
 
-static int qemudDomainDetachPciDiskDevice(virConnectPtr conn,
-                                          struct qemud_driver *driver,
+static int qemudDomainDetachPciDiskDevice(struct qemud_driver *driver,
                                           virDomainObjPtr vm,
                                           virDomainDeviceDefPtr dev)
 {
@@ -6069,15 +6056,15 @@ static int qemudDomainDetachPciDiskDevice(virConnectPtr conn,
     }
 
     if (!detach) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("disk %s not found"), dev->data.disk->dst);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("disk %s not found"), dev->data.disk->dst);
         goto cleanup;
     }
 
     if (!virDomainDeviceAddressIsValid(&detach->info,
                                        VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, "%s",
-                         _("device cannot be detached without a PCI address"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("device cannot be detached without a PCI address"));
         goto cleanup;
     }
 
@@ -6106,7 +6093,7 @@ static int qemudDomainDetachPciDiskDevice(virConnectPtr conn,
 
     if (driver->securityDriver &&
         driver->securityDriver->domainRestoreSecurityImageLabel &&
-        driver->securityDriver->domainRestoreSecurityImageLabel(conn, vm, dev->data.disk) < 0)
+        driver->securityDriver->domainRestoreSecurityImageLabel(NULL, vm, dev->data.disk) < 0)
         VIR_WARN("Unable to restore security label on %s", dev->data.disk->src);
 
     ret = 0;
@@ -6115,8 +6102,7 @@ cleanup:
     return ret;
 }
 
-static int qemudDomainDetachPciControllerDevice(virConnectPtr conn,
-                                                struct qemud_driver *driver,
+static int qemudDomainDetachPciControllerDevice(struct qemud_driver *driver,
                                                 virDomainObjPtr vm,
                                                 virDomainDeviceDefPtr dev)
 {
@@ -6133,17 +6119,17 @@ static int qemudDomainDetachPciControllerDevice(virConnectPtr conn,
     }
 
     if (!detach) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("disk controller %s:%d not found"),
-                         virDomainControllerTypeToString(dev->data.controller->type),
-                         dev->data.controller->idx);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("disk controller %s:%d not found"),
+                        virDomainControllerTypeToString(dev->data.controller->type),
+                        dev->data.controller->idx);
         goto cleanup;
     }
 
     if (!virDomainDeviceAddressIsValid(&detach->info,
                                        VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, "%s",
-                         _("device cannot be detached without a PCI address"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("device cannot be detached without a PCI address"));
         goto cleanup;
     }
 
@@ -6177,8 +6163,7 @@ cleanup:
 }
 
 static int
-qemudDomainDetachNetDevice(virConnectPtr conn,
-                           struct qemud_driver *driver,
+qemudDomainDetachNetDevice(struct qemud_driver *driver,
                            virDomainObjPtr vm,
                            virDomainDeviceDefPtr dev)
 {
@@ -6198,24 +6183,24 @@ qemudDomainDetachNetDevice(virConnectPtr conn,
     }
 
     if (!detach) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("network device %02x:%02x:%02x:%02x:%02x:%02x not found"),
-                         dev->data.net->mac[0], dev->data.net->mac[1],
-                         dev->data.net->mac[2], dev->data.net->mac[3],
-                         dev->data.net->mac[4], dev->data.net->mac[5]);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("network device %02x:%02x:%02x:%02x:%02x:%02x not found"),
+                        dev->data.net->mac[0], dev->data.net->mac[1],
+                        dev->data.net->mac[2], dev->data.net->mac[3],
+                        dev->data.net->mac[4], dev->data.net->mac[5]);
         goto cleanup;
     }
 
     if (!virDomainDeviceAddressIsValid(&detach->info,
                                        VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("device cannot be detached without a PCI address"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("device cannot be detached without a PCI address"));
         goto cleanup;
     }
 
     if ((vlan = qemuDomainNetVLAN(detach)) < 0) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("unable to determine original VLAN"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("unable to determine original VLAN"));
         goto cleanup;
     }
 
@@ -6269,8 +6254,7 @@ cleanup:
     return ret;
 }
 
-static int qemudDomainDetachHostPciDevice(virConnectPtr conn,
-                                          struct qemud_driver *driver,
+static int qemudDomainDetachHostPciDevice(struct qemud_driver *driver,
                                           virDomainObjPtr vm,
                                           virDomainDeviceDefPtr dev)
 {
@@ -6295,19 +6279,19 @@ static int qemudDomainDetachHostPciDevice(virConnectPtr conn,
     }
 
     if (!detach) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("host pci device %.4x:%.2x:%.2x.%.1x not found"),
-                         dev->data.hostdev->source.subsys.u.pci.domain,
-                         dev->data.hostdev->source.subsys.u.pci.bus,
-                         dev->data.hostdev->source.subsys.u.pci.slot,
-                         dev->data.hostdev->source.subsys.u.pci.function);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("host pci device %.4x:%.2x:%.2x.%.1x not found"),
+                        dev->data.hostdev->source.subsys.u.pci.domain,
+                        dev->data.hostdev->source.subsys.u.pci.bus,
+                        dev->data.hostdev->source.subsys.u.pci.slot,
+                        dev->data.hostdev->source.subsys.u.pci.function);
         return -1;
     }
 
     if (!virDomainDeviceAddressIsValid(&detach->info,
                                        VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI)) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("device cannot be detached without a PCI address"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("device cannot be detached without a PCI address"));
         return -1;
     }
 
@@ -6354,8 +6338,7 @@ static int qemudDomainDetachHostPciDevice(virConnectPtr conn,
     return ret;
 }
 
-static int qemudDomainDetachHostDevice(virConnectPtr conn,
-                                       struct qemud_driver *driver,
+static int qemudDomainDetachHostDevice(struct qemud_driver *driver,
                                        virDomainObjPtr vm,
                                        virDomainDeviceDefPtr dev)
 {
@@ -6363,26 +6346,26 @@ static int qemudDomainDetachHostDevice(virConnectPtr conn,
     int ret;
 
     if (hostdev->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS) {
-        qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                         _("hostdev mode '%s' not supported"),
-                         virDomainHostdevModeTypeToString(hostdev->mode));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        _("hostdev mode '%s' not supported"),
+                        virDomainHostdevModeTypeToString(hostdev->mode));
         return -1;
     }
 
     switch (hostdev->source.subsys.type) {
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI:
-        ret = qemudDomainDetachHostPciDevice(conn, driver, vm, dev);
+        ret = qemudDomainDetachHostPciDevice(driver, vm, dev);
         break;
     default:
-        qemudReportError(conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                         _("hostdev subsys type '%s' not supported"),
-                         virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        _("hostdev subsys type '%s' not supported"),
+                        virDomainHostdevSubsysTypeToString(hostdev->source.subsys.type));
         return -1;
     }
 
     if (driver->securityDriver &&
         driver->securityDriver->domainRestoreSecurityHostdevLabel &&
-        driver->securityDriver->domainRestoreSecurityHostdevLabel(conn, vm, dev->data.hostdev) < 0)
+        driver->securityDriver->domainRestoreSecurityHostdevLabel(NULL, vm, dev->data.hostdev) < 0)
         VIR_WARN0("Failed to restore host device labelling");
 
     return ret;
@@ -6400,8 +6383,8 @@ static int qemudDomainDetachDevice(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -6409,8 +6392,8 @@ static int qemudDomainDetachDevice(virDomainPtr dom,
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("cannot detach device on inactive domain"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("cannot detach device on inactive domain"));
         goto endjob;
     }
 
@@ -6423,23 +6406,23 @@ static int qemudDomainDetachDevice(virDomainPtr dom,
     if (dev->type == VIR_DOMAIN_DEVICE_DISK &&
         dev->data.disk->device == VIR_DOMAIN_DISK_DEVICE_DISK &&
         dev->data.disk->bus == VIR_DOMAIN_DISK_BUS_VIRTIO) {
-        ret = qemudDomainDetachPciDiskDevice(dom->conn, driver, vm, dev);
+        ret = qemudDomainDetachPciDiskDevice(driver, vm, dev);
     } else if (dev->type == VIR_DOMAIN_DEVICE_NET) {
-        ret = qemudDomainDetachNetDevice(dom->conn, driver, vm, dev);
+        ret = qemudDomainDetachNetDevice(driver, vm, dev);
     } else if (dev->type == VIR_DOMAIN_DEVICE_CONTROLLER) {
         if (dev->data.controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI) {
-            ret = qemudDomainDetachPciControllerDevice(dom->conn, driver, vm, dev);
+            ret = qemudDomainDetachPciControllerDevice(driver, vm, dev);
         } else {
-            qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                             _("disk controller bus '%s' cannot be hotunplugged."),
-                             virDomainControllerTypeToString(dev->data.controller->type));
+            qemuReportError(VIR_ERR_NO_SUPPORT,
+                            _("disk controller bus '%s' cannot be hotunplugged."),
+                            virDomainControllerTypeToString(dev->data.controller->type));
             /* fallthrough */
         }
     } else if (dev->type == VIR_DOMAIN_DEVICE_HOSTDEV) {
-        ret = qemudDomainDetachHostDevice(dom->conn, driver, vm, dev);
+        ret = qemudDomainDetachHostDevice(driver, vm, dev);
     } else {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                         "%s", _("This type of device cannot be hot unplugged"));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        "%s", _("This type of device cannot be hot unplugged"));
     }
 
     if (!ret && virDomainSaveStatus(dom->conn, driver->caps, driver->stateDir, vm) < 0)
@@ -6461,8 +6444,8 @@ static int qemudDomainDetachDeviceFlags(virDomainPtr dom,
                                         const char *xml,
                                         unsigned int flags) {
     if (flags & VIR_DOMAIN_DEVICE_MODIFY_CONFIG) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("cannot modify the persistent configuration of a domain"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("cannot modify the persistent configuration of a domain"));
         return -1;
     }
 
@@ -6482,8 +6465,8 @@ static int qemudDomainGetAutostart(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -6509,14 +6492,14 @@ static int qemudDomainSetAutostart(virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!vm->persistent) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("cannot set autostart for transient domain"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("cannot set autostart for transient domain"));
         goto cleanup;
     }
 
@@ -6575,8 +6558,8 @@ static char *qemuGetSchedulerType(virDomainPtr dom,
 
     qemuDriverLock(driver);
     if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                         __FUNCTION__);
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        __FUNCTION__);
         goto cleanup;
     }
 
@@ -6604,22 +6587,22 @@ static int qemuSetSchedulerParameters(virDomainPtr dom,
 
     qemuDriverLock(driver);
     if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                         __FUNCTION__);
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        __FUNCTION__);
         goto cleanup;
     }
 
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
 
     if (vm == NULL) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("No such domain %s"), dom->uuid);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("No such domain %s"), dom->uuid);
         goto cleanup;
     }
 
     if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("cannot find cgroup for domain %s"), vm->def->name);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("cannot find cgroup for domain %s"), vm->def->name);
         goto cleanup;
     }
 
@@ -6629,8 +6612,8 @@ static int qemuSetSchedulerParameters(virDomainPtr dom,
         if (STREQ(param->field, "cpu_shares")) {
             int rc;
             if (param->type != VIR_DOMAIN_SCHED_FIELD_ULLONG) {
-                qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG, "%s",
-                                 _("invalid type for cpu_shares tunable, expected a 'ullong'"));
+                qemuReportError(VIR_ERR_INVALID_ARG, "%s",
+                                _("invalid type for cpu_shares tunable, expected a 'ullong'"));
                 goto cleanup;
             }
 
@@ -6641,8 +6624,8 @@ static int qemuSetSchedulerParameters(virDomainPtr dom,
                 goto cleanup;
             }
         } else {
-            qemudReportError(dom->conn, domain, NULL, VIR_ERR_INVALID_ARG,
-                             _("Invalid parameter `%s'"), param->field);
+            qemuReportError(VIR_ERR_INVALID_ARG,
+                            _("Invalid parameter `%s'"), param->field);
             goto cleanup;
         }
     }
@@ -6669,28 +6652,28 @@ static int qemuGetSchedulerParameters(virDomainPtr dom,
 
     qemuDriverLock(driver);
     if (!qemuCgroupControllerActive(driver, VIR_CGROUP_CONTROLLER_CPU)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                         __FUNCTION__);
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        __FUNCTION__);
         goto cleanup;
     }
 
     if ((*nparams) != 1) {
-        qemudReportError(dom->conn, domain, NULL, VIR_ERR_INVALID_ARG,
-                         "%s", _("Invalid parameter count"));
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        "%s", _("Invalid parameter count"));
         goto cleanup;
     }
 
     vm = virDomainFindByUUID(&driver->domains, dom->uuid);
 
     if (vm == NULL) {
-        qemudReportError(dom->conn, domain, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("No such domain %s"), dom->uuid);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("No such domain %s"), dom->uuid);
         goto cleanup;
     }
 
     if (virCgroupForDomain(driver->cgroup, vm->def->name, &group, 0) != 0) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("cannot find cgroup for domain %s"), vm->def->name);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("cannot find cgroup for domain %s"), vm->def->name);
         goto cleanup;
     }
 
@@ -6703,8 +6686,8 @@ static int qemuGetSchedulerParameters(virDomainPtr dom,
     params[0].value.ul = val;
     params[0].type = VIR_DOMAIN_SCHED_FIELD_ULLONG;
     if (virStrcpyStatic(params[0].field, "cpu_shares") == NULL) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("Field cpu_shares too long for destination"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("Field cpu_shares too long for destination"));
         goto cleanup;
     }
 
@@ -6739,8 +6722,8 @@ qemudDomainBlockStats (virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -6748,8 +6731,8 @@ qemudDomainBlockStats (virDomainPtr dom,
         goto cleanup;
 
     if (!virDomainObjIsActive (vm)) {
-        qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                          "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
         goto endjob;
     }
 
@@ -6761,14 +6744,14 @@ qemudDomainBlockStats (virDomainPtr dom,
     }
 
     if (!disk) {
-        qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                          _("invalid path: %s"), path);
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        _("invalid path: %s"), path);
         goto endjob;
     }
 
     if (!disk->info.alias) {
-        qemudReportError(dom->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("missing disk device alias name for %s"), disk->dst);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("missing disk device alias name for %s"), disk->dst);
         goto endjob;
     }
 
@@ -6811,14 +6794,14 @@ qemudDomainInterfaceStats (virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
         goto cleanup;
     }
 
@@ -6834,8 +6817,8 @@ qemudDomainInterfaceStats (virDomainPtr dom,
     if (ret == 0)
         ret = linuxDomainInterfaceStats(path, stats);
     else
-        qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                          _("invalid path, '%s' is not a known interface"), path);
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        _("invalid path, '%s' is not a known interface"), path);
 
 cleanup:
     if (vm)
@@ -6847,8 +6830,8 @@ static int
 qemudDomainInterfaceStats (virDomainPtr dom,
                            const char *path ATTRIBUTE_UNUSED,
                            struct _virDomainInterfaceStats *stats ATTRIBUTE_UNUSED)
-    qemudReportError (dom->conn, dom, NULL, VIR_ERR_NO_SUPPORT,
-                      "%s", __FUNCTION__);
+    qemuReportError(VIR_ERR_NO_SUPPORT,
+                    "%s", __FUNCTION__);
     return -1;
 }
 #endif
@@ -6869,8 +6852,8 @@ qemudDomainMemoryStats (virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -6880,8 +6863,8 @@ qemudDomainMemoryStats (virDomainPtr dom,
         ret = qemuMonitorTextGetMemoryStats(priv->mon, stats, nr_stats);
         qemuDomainObjExitMonitor(vm);
     } else {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
     }
 
 cleanup:
@@ -6908,14 +6891,14 @@ qemudDomainBlockPeek (virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (!path || path[0] == '\0') {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                         "%s", _("NULL or empty path"));
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        "%s", _("NULL or empty path"));
         goto cleanup;
     }
 
@@ -6951,8 +6934,8 @@ qemudDomainBlockPeek (virDomainPtr dom,
 
         ret = 0;
     } else {
-        qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                          "%s", _("invalid path"));
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        "%s", _("invalid path"));
     }
 
 cleanup:
@@ -6981,14 +6964,14 @@ qemudDomainMemoryPeek (virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
     if (flags != VIR_MEMORY_VIRTUAL && flags != VIR_MEMORY_PHYSICAL) {
-        qemudReportError (dom->conn, dom, NULL, VIR_ERR_INVALID_ARG,
-                     "%s", _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL"));
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        "%s", _("flags parameter must be VIR_MEMORY_VIRTUAL or VIR_MEMORY_PHYSICAL"));
         goto cleanup;
     }
 
@@ -6996,8 +6979,8 @@ qemudDomainMemoryPeek (virDomainPtr dom,
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                         "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
         goto endjob;
     }
 
@@ -7163,15 +7146,15 @@ static int qemuStreamMigRemoveCallback(virStreamPtr stream)
     int ret = -1;
 
     if (!qemust) {
-        qemudReportError(stream->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("stream is not open"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("stream is not open"));
         return -1;
     }
 
     qemuDriverLock(driver);
     if (qemust->watch == 0) {
-        qemudReportError(stream->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("stream does not have a callback registered"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("stream does not have a callback registered"));
         goto cleanup;
     }
 
@@ -7200,15 +7183,15 @@ static int qemuStreamMigUpdateCallback(virStreamPtr stream, int events)
     int ret = -1;
 
     if (!qemust) {
-        qemudReportError(stream->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("stream is not open"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("stream is not open"));
         return -1;
     }
 
     qemuDriverLock(driver);
     if (qemust->watch == 0) {
-        qemudReportError(stream->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("stream does not have a callback registered"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("stream does not have a callback registered"));
         goto cleanup;
     }
 
@@ -7266,15 +7249,15 @@ qemuStreamMigAddCallback(virStreamPtr st,
     int ret = -1;
 
     if (!qemust) {
-        qemudReportError(st->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("stream is not open"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("stream is not open"));
         return -1;
     }
 
     qemuDriverLock(driver);
     if (qemust->watch != 0) {
-        qemudReportError(st->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("stream already has a callback registered"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("stream already has a callback registered"));
         goto cleanup;
     }
 
@@ -7283,8 +7266,8 @@ qemuStreamMigAddCallback(virStreamPtr st,
                                            qemuStreamMigEvent,
                                            st,
                                            NULL)) < 0) {
-        qemudReportError(st->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("cannot register file watch on stream"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("cannot register file watch on stream"));
         goto cleanup;
     }
 
@@ -7382,8 +7365,8 @@ static int qemuStreamMigWrite(virStreamPtr st, const char *bytes, size_t nbytes)
     int ret;
 
     if (!qemust) {
-        qemudReportError(st->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("stream is not open"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("stream is not open"));
         return -1;
     }
 
@@ -7442,26 +7425,26 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
 
     qemuDriverLock(driver);
     if (!dom_xml) {
-        qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("no domain XML passed"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("no domain XML passed"));
         goto cleanup;
     }
     if (!(flags & VIR_MIGRATE_TUNNELLED)) {
-        qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
                          "%s", _("PrepareTunnel called but no TUNNELLED flag set"));
         goto cleanup;
     }
     if (st == NULL) {
-        qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("tunnelled migration requested but NULL stream passed"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("tunnelled migration requested but NULL stream passed"));
         goto cleanup;
     }
 
     /* Parse the domain XML. */
     if (!(def = virDomainDefParseString(dconn, driver->caps, dom_xml,
                                         VIR_DOMAIN_XML_INACTIVE))) {
-        qemudReportError(dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("failed to parse XML"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to parse XML"));
         goto cleanup;
     }
 
@@ -7475,8 +7458,8 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
                                   driver->caps,
                                   &driver->domains,
                                   def))) {
-        qemudReportError(dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("failed to assign new VM"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to assign new VM"));
         goto cleanup;
     }
     def = NULL;
@@ -7496,9 +7479,9 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
 
     /* check that this qemu version supports the interactive exec */
     if (qemudExtractVersionInfo(vm->def->emulator, NULL, &qemuCmdFlags) < 0) {
-        qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("Cannot determine QEMU argv syntax %s"),
-                         vm->def->emulator);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Cannot determine QEMU argv syntax %s"),
+                        vm->def->emulator);
         goto endjob;
     }
     if (qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX)
@@ -7506,8 +7489,8 @@ qemudDomainMigratePrepareTunnel(virConnectPtr dconn,
     else if (qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC)
         internalret = virAsprintf(&migrateFrom, "exec:nc -U -l %s", unixfile);
     else {
-        qemudReportError(dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("Destination qemu is too old to support tunnelled migration"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("Destination qemu is too old to support tunnelled migration"));
         goto endjob;
     }
     if (internalret < 0) {
@@ -7604,14 +7587,14 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
         /* this is a logical error; we never should have gotten here with
          * VIR_MIGRATE_TUNNELLED set
          */
-        qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("Tunnelled migration requested but invalid RPC method called"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("Tunnelled migration requested but invalid RPC method called"));
         goto cleanup;
     }
 
     if (!dom_xml) {
-        qemudReportError (dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                          "%s", _("no domain XML passed"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("no domain XML passed"));
         goto cleanup;
     }
 
@@ -7651,8 +7634,8 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
          * characters in hostname part don't matter.
          */
         if (!STRPREFIX (uri_in, "tcp:")) {
-            qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_ARG,
-                  "%s", _("only tcp URIs are supported for KVM/QEMU migrations"));
+            qemuReportError (VIR_ERR_INVALID_ARG,
+                             "%s", _("only tcp URIs are supported for KVM/QEMU migrations"));
             goto cleanup;
         }
 
@@ -7674,8 +7657,8 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
             p++; /* definitely has a ':' in it, see above */
             this_port = virParseNumber (&p);
             if (this_port == -1 || p-uri_in != strlen (uri_in)) {
-                qemudReportError (dconn, NULL, NULL, VIR_ERR_INVALID_ARG,
-                                  "%s", _("URI ended with incorrect ':port'"));
+                qemuReportError(VIR_ERR_INVALID_ARG,
+                                "%s", _("URI ended with incorrect ':port'"));
                 goto cleanup;
             }
         }
@@ -7687,8 +7670,8 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
     /* Parse the domain XML. */
     if (!(def = virDomainDefParseString(dconn, driver->caps, dom_xml,
                                         VIR_DOMAIN_XML_INACTIVE))) {
-        qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                          "%s", _("failed to parse XML"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to parse XML"));
         goto cleanup;
     }
 
@@ -7702,8 +7685,8 @@ qemudDomainMigratePrepare2 (virConnectPtr dconn,
                                   driver->caps,
                                   &driver->domains,
                                   def))) {
-        qemudReportError (dconn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                          "%s", _("failed to assign new VM"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to assign new VM"));
         goto cleanup;
     }
     def = NULL;
@@ -7758,8 +7741,7 @@ cleanup:
 /* Perform migration using QEMU's native TCP migrate support,
  * not encrypted obviously
  */
-static int doNativeMigrate(virDomainPtr dom,
-                           struct qemud_driver *driver,
+static int doNativeMigrate(struct qemud_driver *driver,
                            virDomainObjPtr vm,
                            const char *uri,
                            unsigned long flags ATTRIBUTE_UNUSED,
@@ -7786,8 +7768,8 @@ static int doNativeMigrate(virDomainPtr dom,
         uribits = xmlParseURI(uri);
     }
     if (!uribits) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("cannot parse URI %s"), uri);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("cannot parse URI %s"), uri);
         goto cleanup;
     }
 
@@ -7817,8 +7799,8 @@ static int doNativeMigrate(virDomainPtr dom,
     qemuDomainObjExitMonitorWithDriver(driver, vm);
 
     if (status != QEMU_MONITOR_MIGRATION_STATUS_COMPLETED) {
-        qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                          "%s", _("migrate did not successfully complete"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("migrate did not successfully complete"));
         goto cleanup;
     }
 
@@ -7830,8 +7812,7 @@ cleanup:
 }
 
 
-static int doTunnelSendAll(virDomainPtr dom,
-                           virStreamPtr st,
+static int doTunnelSendAll(virStreamPtr st,
                            int sock)
 {
     char buffer[65536];
@@ -7851,8 +7832,8 @@ static int doTunnelSendAll(virDomainPtr dom,
             break;
 
         if (virStreamSend(st, buffer, nbytes) < 0) {
-            qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "%s",
-                             _("Failed to write migration data to remote libvirtd"));
+            qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                            _("Failed to write migration data to remote libvirtd"));
             return -1;
         }
     }
@@ -7917,9 +7898,9 @@ static int doTunnelMigrate(virDomainPtr dom,
     sa_qemu.sun_family = AF_UNIX;
     if (virStrcpy(sa_qemu.sun_path, unixfile,
                   sizeof(sa_qemu.sun_path)) == NULL) {
-        qemudReportError(dom->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("Unix socket '%s' too big for destination"),
-                         unixfile);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unix socket '%s' too big for destination"),
+                        unixfile);
         goto cleanup;
     }
     unlink(unixfile);
@@ -7938,16 +7919,16 @@ static int doTunnelMigrate(virDomainPtr dom,
 
     /* check that this qemu version supports the unix migration */
     if (qemudExtractVersionInfo(vm->def->emulator, NULL, &qemuCmdFlags) < 0) {
-        qemudReportError(dom->conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("Cannot extract Qemu version from '%s'"),
-                         vm->def->emulator);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Cannot extract Qemu version from '%s'"),
+                        vm->def->emulator);
         goto cleanup;
     }
 
     if (!(qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_UNIX) &&
         !(qemuCmdFlags & QEMUD_CMD_FLAG_MIGRATE_QEMU_EXEC)) {
-        qemudReportError(dom->conn, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("Source qemu is too old to support tunnelled migration"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("Source qemu is too old to support tunnelled migration"));
         goto cleanup;
     }
 
@@ -7982,8 +7963,8 @@ static int doTunnelMigrate(virDomainPtr dom,
     }
     qemuDomainObjExitMonitorWithDriver(driver, vm);
     if (internalret < 0) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("tunnelled migration monitor command failed"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("tunnelled migration monitor command failed"));
         goto finish;
     }
 
@@ -8005,8 +7986,8 @@ static int doTunnelMigrate(virDomainPtr dom,
     qemuDomainObjExitMonitorWithDriver(driver, vm);
 
     if (status == QEMU_MONITOR_MIGRATION_STATUS_ERROR) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s",_("migrate failed"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s",_("migrate failed"));
         goto cancel;
     }
 
@@ -8019,7 +8000,7 @@ static int doTunnelMigrate(virDomainPtr dom,
         goto cancel;
     }
 
-    retval = doTunnelSendAll(dom, st, client_sock);
+    retval = doTunnelSendAll(st, client_sock);
 
 cancel:
     if (retval != 0) {
@@ -8084,12 +8065,12 @@ static int doNonTunnelMigrate(virDomainPtr dom,
         goto cleanup;
 
     if (uri_out == NULL) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("domainMigratePrepare2 did not set uri"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("domainMigratePrepare2 did not set uri"));
         goto cleanup;
     }
 
-    if (doNativeMigrate(dom, driver, vm, uri_out, flags, dname, resource) < 0)
+    if (doNativeMigrate(driver, vm, uri_out, flags, dname, resource) < 0)
         goto finish;
 
     retval = 0;
@@ -8125,21 +8106,21 @@ static int doPeer2PeerMigrate(virDomainPtr dom,
 
     dconn = virConnectOpen(uri);
     if (dconn == NULL) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("Failed to connect to remote libvirt URI %s"), uri);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("Failed to connect to remote libvirt URI %s"), uri);
         return -1;
     }
     if (!VIR_DRV_SUPPORTS_FEATURE(dconn->driver, dconn,
                                   VIR_DRV_FEATURE_MIGRATION_P2P)) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED, "%s",
-                         _("Destination libvirt does not support peer-to-peer migration protocol"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("Destination libvirt does not support peer-to-peer migration protocol"));
         goto cleanup;
     }
 
     dom_xml = virDomainDefFormat(dom->conn, vm->def, VIR_DOMAIN_XML_SECURE);
     if (!dom_xml) {
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("failed to get domain xml"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to get domain xml"));
         goto cleanup;
     }
 
@@ -8178,8 +8159,8 @@ qemudDomainMigratePerform (virDomainPtr dom,
     if (!vm) {
         char uuidstr[VIR_UUID_STRING_BUFLEN];
         virUUIDFormat(dom->uuid, uuidstr);
-        qemudReportError(dom->conn, dom, NULL, VIR_ERR_NO_DOMAIN,
-                         _("no domain with matching uuid '%s'"), uuidstr);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching uuid '%s'"), uuidstr);
         goto cleanup;
     }
 
@@ -8187,8 +8168,8 @@ qemudDomainMigratePerform (virDomainPtr dom,
         goto cleanup;
 
     if (!virDomainObjIsActive(vm)) {
-        qemudReportError (dom->conn, dom, NULL, VIR_ERR_OPERATION_INVALID,
-                          "%s", _("domain is not running"));
+        qemuReportError(VIR_ERR_OPERATION_INVALID,
+                        "%s", _("domain is not running"));
         goto endjob;
     }
 
@@ -8217,7 +8198,7 @@ qemudDomainMigratePerform (virDomainPtr dom,
             /* doPeer2PeerMigrate already set the error, so just get out */
             goto endjob;
     } else {
-        if (doNativeMigrate(dom, driver, vm, uri, flags, dname, resource) < 0)
+        if (doNativeMigrate(driver, vm, uri, flags, dname, resource) < 0)
             goto endjob;
     }
 
@@ -8292,8 +8273,8 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
     qemuDriverLock(driver);
     vm = virDomainFindByName(&driver->domains, dname);
     if (!vm) {
-        qemudReportError (dconn, NULL, NULL, VIR_ERR_NO_DOMAIN,
-                          _("no domain with matching name '%s'"), dname);
+        qemuReportError(VIR_ERR_NO_DOMAIN,
+                        _("no domain with matching name '%s'"), dname);
         goto cleanup;
     }
 
@@ -8344,8 +8325,8 @@ qemudDomainMigrateFinish2 (virConnectPtr dconn,
             qemuDomainObjEnterMonitorWithDriver(driver, vm);
             if (qemuMonitorStartCPUs(priv->mon, dconn) < 0) {
                 if (virGetLastError() == NULL)
-                    qemudReportError(dconn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                     "%s", _("resume operation failed"));
+                    qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                    "%s", _("resume operation failed"));
                 qemuDomainObjExitMonitorWithDriver(driver, vm);
                 goto endjob;
             }
@@ -8428,8 +8409,8 @@ qemudNodeDeviceGetPciInfo (virNodeDevicePtr dev,
     }
 
     if (!cap) {
-        qemudReportError(dev->conn, NULL, NULL, VIR_ERR_INVALID_ARG,
-                         _("device %s is not a PCI device"), dev->name);
+        qemuReportError(VIR_ERR_INVALID_ARG,
+                        _("device %s is not a PCI device"), dev->name);
         goto out;
     }
 
@@ -8524,8 +8505,8 @@ qemuCPUCompare(virConnectPtr conn,
     qemuDriverLock(driver);
 
     if (!driver->caps || !driver->caps->host.cpu) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                         "%s", _("cannot get host CPU capabilities"));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        "%s", _("cannot get host CPU capabilities"));
     }
     else
         ret = cpuCompareXML(conn, driver->caps->host.cpu, xmlDesc);
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index b702a81..64c6cba 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -240,8 +240,8 @@ qemuMonitorOpenUnix(const char *monitor)
     memset(&addr, 0, sizeof(addr));
     addr.sun_family = AF_UNIX;
     if (virStrcpyStatic(addr.sun_path, monitor) == NULL) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("Monitor path %s too big for destination"), monitor);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Monitor path %s too big for destination"), monitor);
         goto error;
     }
 
@@ -282,8 +282,8 @@ qemuMonitorOpenPty(const char *monitor)
     int monfd;
 
     if ((monfd = open(monitor, O_RDWR)) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("Unable to open monitor path %s"), monitor);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("Unable to open monitor path %s"), monitor);
         return -1;
     }
 
@@ -569,8 +569,8 @@ qemuMonitorOpen(virDomainObjPtr vm,
     qemuMonitorPtr mon;
 
     if (!cb || !cb->eofNotify) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("EOF notify callback must be supplied"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("EOF notify callback must be supplied"));
         return NULL;
     }
 
@@ -580,14 +580,14 @@ qemuMonitorOpen(virDomainObjPtr vm,
     }
 
     if (virMutexInit(&mon->lock) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("cannot initialize monitor mutex"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cannot initialize monitor mutex"));
         VIR_FREE(mon);
         return NULL;
     }
     if (virCondInit(&mon->notify) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("cannot initialize monitor condition"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cannot initialize monitor condition"));
         virMutexDestroy(&mon->lock);
         VIR_FREE(mon);
         return NULL;
@@ -610,22 +610,22 @@ qemuMonitorOpen(virDomainObjPtr vm,
         break;
 
     default:
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unable to handle monitor type: %s"),
-                         virDomainChrTypeToString(config->type));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unable to handle monitor type: %s"),
+                        virDomainChrTypeToString(config->type));
         goto cleanup;
     }
 
     if (mon->fd == -1) goto cleanup;
 
     if (virSetCloseExec(mon->fd) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("Unable to set monitor close-on-exec flag"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("Unable to set monitor close-on-exec flag"));
         goto cleanup;
     }
     if (virSetNonBlock(mon->fd) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("Unable to put monitor into non-blocking mode"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("Unable to put monitor into non-blocking mode"));
         goto cleanup;
     }
 
@@ -636,8 +636,8 @@ qemuMonitorOpen(virDomainObjPtr vm,
                                         VIR_EVENT_HANDLE_READABLE,
                                         qemuMonitorIO,
                                         mon, NULL)) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("unable to register monitor events"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("unable to register monitor events"));
         goto cleanup;
     }
 
diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c
index 25ddfa9..e5288ce 100644
--- a/src/qemu/qemu_monitor_json.c
+++ b/src/qemu/qemu_monitor_json.c
@@ -215,8 +215,8 @@ qemuMonitorJSONCommandWithFd(qemuMonitorPtr mon,
 
     if (ret == 0) {
         if (!((*reply) = virJSONValueFromString(msg.rxBuffer))) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot parse JSON doc '%s'"), msg.rxBuffer);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot parse JSON doc '%s'"), msg.rxBuffer);
             goto cleanup;
         }
     }
@@ -269,15 +269,15 @@ qemuMonitorJSONCheckError(virJSONValuePtr cmd,
         if (!error) {
             VIR_DEBUG("Saw a JSON error, but value is null for %s: %s",
                       cmdstr, replystr);
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("error running QEMU command '%s': '%s'"),
-                             cmdstr, replystr);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("error running QEMU command '%s': '%s'"),
+                            cmdstr, replystr);
         } else {
             VIR_DEBUG("Got a JSON error set for %s", cmdstr);
             char *detail = qemuMonitorJSONStringifyError(error);
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("error running QEMU command '%s': %s ('%s')"),
-                             cmdstr, detail, replystr);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("error running QEMU command '%s': %s ('%s')"),
+                            cmdstr, detail, replystr);
             VIR_FREE(detail);
         }
         VIR_FREE(cmdstr);
@@ -289,8 +289,8 @@ qemuMonitorJSONCheckError(virJSONValuePtr cmd,
 
         VIR_DEBUG("Neither 'return' nor 'error' is set in the JSON reply %s: %s",
                   cmdstr, replystr);
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("error running QEMU command '%s': '%s'"), cmdstr, replystr);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("error running QEMU command '%s': '%s'"), cmdstr, replystr);
         VIR_FREE(cmdstr);
         VIR_FREE(replystr);
         return -1;
@@ -380,9 +380,9 @@ qemuMonitorJSONMakeCommand(const char *cmdname,
         char type;
 
         if (strlen(key) < 3) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("argument key '%s' is too short, missing type prefix"),
-                             key);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("argument key '%s' is too short, missing type prefix"),
+                            key);
             goto error;
         }
 
@@ -429,8 +429,8 @@ qemuMonitorJSONMakeCommand(const char *cmdname,
             ret = virJSONValueObjectAppendNull(jargs, key);
         }   break;
         default:
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("unsupported data type '%c' for arg '%s'"), type, key - 2);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("unsupported data type '%c' for arg '%s'"), type, key - 2);
             goto error;
         }
         if (ret < 0)
@@ -551,20 +551,20 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
     int ncpus;
 
     if (!(data = virJSONValueObjectGet(reply, "return"))) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("cpu reply was missing return data"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cpu reply was missing return data"));
         goto cleanup;
     }
 
     if (data->type != VIR_JSON_TYPE_ARRAY) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("cpu information was not an array"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cpu information was not an array"));
         goto cleanup;
     }
 
     if ((ncpus = virJSONValueArraySize(data)) <= 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("cpu information was empty"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("cpu information was empty"));
         goto cleanup;
     }
 
@@ -578,27 +578,27 @@ qemuMonitorJSONExtractCPUInfo(virJSONValuePtr reply,
         int cpu;
         int thread;
         if (!entry) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("character device information was missing aray element"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("character device information was missing aray element"));
             goto cleanup;
         }
 
         if (virJSONValueObjectGetNumberInt(entry, "CPU", &cpu) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("cpu information was missing cpu number"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("cpu information was missing cpu number"));
             goto cleanup;
         }
 
         if (virJSONValueObjectGetNumberInt(entry, "thread_id", &thread) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("cpu information was missing thread ID"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("cpu information was missing thread ID"));
             goto cleanup;
         }
 
         if (cpu != i) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("unexpected cpu index %d expecting %d"),
-                             i, cpu);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("unexpected cpu index %d expecting %d"),
+                            i, cpu);
             goto cleanup;
         }
 
@@ -676,15 +676,15 @@ int qemuMonitorJSONGetBalloonInfo(qemuMonitorPtr mon,
             unsigned long long mem;
 
             if (!(data = virJSONValueObjectGet(reply, "return"))) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                                 _("info balloon reply was missing return data"));
+                qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("info balloon reply was missing return data"));
                 ret = -1;
                 goto cleanup;
             }
 
             if (virJSONValueObjectGetNumberUlong(data, "balloon", &mem) < 0) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                                 _("info balloon reply was missing balloon data"));
+                qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                _("info balloon reply was missing balloon data"));
                 ret = -1;
                 goto cleanup;
             }
@@ -733,8 +733,8 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
 
     devices = virJSONValueObjectGet(reply, "return");
     if (!devices || devices->type != VIR_JSON_TYPE_ARRAY) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("blockstats reply was missing device list"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("blockstats reply was missing device list"));
         goto cleanup;
     }
 
@@ -743,14 +743,14 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
         virJSONValuePtr stats;
         const char *thisdev;
         if (!dev || dev->type != VIR_JSON_TYPE_OBJECT) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("blockstats device entry was not in expected format"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("blockstats device entry was not in expected format"));
             goto cleanup;
         }
 
         if ((thisdev = virJSONValueObjectGetString(dev, "device")) == NULL) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("blockstats device entry was not in expected format"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("blockstats device entry was not in expected format"));
             goto cleanup;
         }
 
@@ -760,40 +760,40 @@ int qemuMonitorJSONGetBlockStatsInfo(qemuMonitorPtr mon,
         found = 1;
         if ((stats = virJSONValueObjectGet(dev, "stats")) == NULL ||
             stats->type != VIR_JSON_TYPE_OBJECT) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("blockstats stats entry was not in expected format"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("blockstats stats entry was not in expected format"));
             goto cleanup;
         }
 
         if (virJSONValueObjectGetNumberLong(stats, "rd_bytes", rd_bytes) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot read %s statistic"),
-                             "rd_bytes");
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot read %s statistic"),
+                            "rd_bytes");
             goto cleanup;
         }
         if (virJSONValueObjectGetNumberLong(stats, "rd_operations", rd_req) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot read %s statistic"),
-                             "rd_operations");
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot read %s statistic"),
+                            "rd_operations");
             goto cleanup;
         }
         if (virJSONValueObjectGetNumberLong(stats, "wr_bytes", wr_bytes) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot read %s statistic"),
-                             "wr_bytes");
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot read %s statistic"),
+                            "wr_bytes");
             goto cleanup;
         }
         if (virJSONValueObjectGetNumberLong(stats, "wr_operations", wr_req) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("cannot read %s statistic"),
-                             "wr_operations");
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("cannot read %s statistic"),
+                            "wr_operations");
             goto cleanup;
         }
     }
 
     if (!found) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("cannot find statistics for device '%s'"), devname);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("cannot find statistics for device '%s'"), devname);
         goto cleanup;
     }
     ret = 0;
@@ -1007,44 +1007,44 @@ qemuMonitorJSONGetMigrationStatusReply(virJSONValuePtr reply,
     const char *statusstr;
 
     if (!(ret = virJSONValueObjectGet(reply, "return"))) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("info migration reply was missing return data"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("info migration reply was missing return data"));
         return -1;
     }
 
     if (!(statusstr = virJSONValueObjectGetString(ret, "status"))) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("info migration reply was missing return status"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("info migration reply was missing return status"));
         return -1;
     }
 
     if ((*status = qemuMonitorMigrationStatusTypeFromString(statusstr)) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unexpected migration status in %s"), statusstr);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unexpected migration status in %s"), statusstr);
         return -1;
     }
 
     if (*status == QEMU_MONITOR_MIGRATION_STATUS_ACTIVE) {
         virJSONValuePtr ram = virJSONValueObjectGet(ret, "ram");
         if (!ram) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("migration was active, but no RAM info was set"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("migration was active, but no RAM info was set"));
             return -1;
         }
 
         if (virJSONValueObjectGetNumberUlong(ram, "transferred", transferred) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("migration was active, but RAM 'transferred' data was missing"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("migration was active, but RAM 'transferred' data was missing"));
             return -1;
         }
         if (virJSONValueObjectGetNumberUlong(ram, "remaining", remaining) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("migration was active, but RAM 'remaining' data was missing"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("migration was active, but RAM 'remaining' data was missing"));
             return -1;
         }
         if (virJSONValueObjectGetNumberUlong(ram, "total", total) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("migration was active, but RAM 'total' data was missing"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("migration was active, but RAM 'total' data was missing"));
             return -1;
         }
     }
@@ -1299,32 +1299,32 @@ qemuMonitorJSONGetGuestPCIAddress(virJSONValuePtr reply,
 
     addr = virJSONValueObjectGet(reply, "return");
     if (!addr || addr->type != VIR_JSON_TYPE_OBJECT) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("pci_add reply was missing device address"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("pci_add reply was missing device address"));
         return -1;
     }
 
     if (virJSONValueObjectGetNumberUint(addr, "domain", &guestAddr->domain) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("pci_add reply was missing device domain number"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("pci_add reply was missing device domain number"));
         return -1;
     }
 
     if (virJSONValueObjectGetNumberUint(addr, "bus", &guestAddr->bus) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("pci_add reply was missing device bus number"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("pci_add reply was missing device bus number"));
         return -1;
     }
 
     if (virJSONValueObjectGetNumberUint(addr, "slot", &guestAddr->slot) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("pci_add reply was missing device slot number"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("pci_add reply was missing device slot number"));
         return -1;
     }
 
     if (virJSONValueObjectGetNumberUint(addr, "function", &guestAddr->function) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("pci_add reply was missing device function number"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("pci_add reply was missing device function number"));
         return -1;
     }
 
@@ -1589,14 +1589,14 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply,
     int i;
 
     if (!(data = virJSONValueObjectGet(reply, "return"))) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("character device reply was missing return data"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("character device reply was missing return data"));
         goto cleanup;
     }
 
     if (data->type != VIR_JSON_TYPE_ARRAY) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("character device information was not an array"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("character device information was not an array"));
         goto cleanup;
     }
 
@@ -1605,20 +1605,20 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply,
         const char *type;
         const char *id;
         if (!entry) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("character device information was missing aray element"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("character device information was missing aray element"));
             goto cleanup;
         }
 
         if (!(type = virJSONValueObjectGetString(entry, "filename"))) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("character device information was missing filename"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("character device information was missing filename"));
             goto cleanup;
         }
 
         if (!(id = virJSONValueObjectGetString(entry, "label"))) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                             _("character device information was missing filename"));
+            qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                            _("character device information was missing filename"));
             goto cleanup;
         }
 
@@ -1630,8 +1630,8 @@ static int qemuMonitorJSONExtractPtyPaths(virJSONValuePtr reply,
             }
 
             if (virHashAddEntry(paths, id, path) < 0) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                                 _("failed to save chardev path '%s'"), path);
+                qemuReportError(VIR_ERR_OPERATION_FAILED,
+                                _("failed to save chardev path '%s'"), path);
                 VIR_FREE(path);
                 goto cleanup;
             }
@@ -1718,20 +1718,20 @@ qemuMonitorJSONGetGuestDriveAddress(virJSONValuePtr reply,
 
     addr = virJSONValueObjectGet(reply, "return");
     if (!addr || addr->type != VIR_JSON_TYPE_OBJECT) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("drive_add reply was missing device address"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("drive_add reply was missing device address"));
         return -1;
     }
 
     if (virJSONValueObjectGetNumberUint(addr, "bus", &driveAddr->bus) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("drive_add reply was missing device bus number"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("drive_add reply was missing device bus number"));
         return -1;
     }
 
     if (virJSONValueObjectGetNumberUint(addr, "unit", &driveAddr->unit) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                         _("drive_add reply was missing device unit number"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                        _("drive_add reply was missing device unit number"));
         return -1;
     }
 
@@ -1781,8 +1781,8 @@ int qemuMonitorJSONAttachDrive(qemuMonitorPtr mon,
 int qemuMonitorJSONGetAllPCIAddresses(qemuMonitorPtr mon ATTRIBUTE_UNUSED,
                                       qemuMonitorPCIAddress **addrs ATTRIBUTE_UNUSED)
 {
-    qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s",
-                     _("query-pci not suppported in JSON mode"));
+    qemuReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                    _("query-pci not suppported in JSON mode"));
     return -1;
 }
 
diff --git a/src/qemu/qemu_monitor_text.c b/src/qemu/qemu_monitor_text.c
index b8fa64f..23fc4cf 100644
--- a/src/qemu/qemu_monitor_text.c
+++ b/src/qemu/qemu_monitor_text.c
@@ -366,8 +366,8 @@ qemuMonitorTextStopCPUs(qemuMonitorPtr mon) {
     char *info;
 
     if (qemuMonitorCommand(mon, "stop", &info) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("cannot stop CPU execution"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("cannot stop CPU execution"));
         return -1;
     }
     VIR_FREE(info);
@@ -379,8 +379,8 @@ int qemuMonitorTextSystemPowerdown(qemuMonitorPtr mon) {
     char *info;
 
     if (qemuMonitorCommand(mon, "system_powerdown", &info) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("system shutdown operation failed"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("system shutdown operation failed"));
         return -1;
     }
     VIR_FREE(info);
@@ -398,8 +398,8 @@ int qemuMonitorTextGetCPUInfo(qemuMonitorPtr mon,
     size_t ncpupids = 0;
 
     if (qemuMonitorCommand(mon, "info cpus", &qemucpus) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("cannot run monitor command to fetch CPU thread info"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("cannot run monitor command to fetch CPU thread info"));
         return -1;
     }
 
@@ -550,8 +550,8 @@ int qemuMonitorTextGetBalloonInfo(qemuMonitorPtr mon,
     char *offset;
 
     if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("could not query memory balloon allocation"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("could not query memory balloon allocation"));
         return -1;
     }
 
@@ -560,8 +560,8 @@ int qemuMonitorTextGetBalloonInfo(qemuMonitorPtr mon,
         char *end;
         offset += strlen(BALLOON_PREFIX);
         if (virStrToLong_ui(offset, &end, 10, &memMB) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                             _("could not parse memory balloon allocation from '%s'"), reply);
+            qemuReportError(VIR_ERR_OPERATION_FAILED,
+                            _("could not parse memory balloon allocation from '%s'"), reply);
             goto cleanup;
         }
         *currmem = memMB * 1024;
@@ -587,8 +587,8 @@ int qemuMonitorTextGetMemoryStats(qemuMonitorPtr mon,
     char *offset;
 
     if (qemuMonitorCommand(mon, "info balloon", &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("could not query memory balloon statistics"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("could not query memory balloon statistics"));
         return -1;
     }
 
@@ -618,8 +618,8 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
     int devnamelen = strlen(devname);
 
     if (qemuMonitorCommand (mon, "info blockstats", &info) < 0) {
-        qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                          "%s", _("'info blockstats' command failed"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("'info blockstats' command failed"));
         goto cleanup;
     }
 
@@ -629,9 +629,9 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
      * to detect if qemu supports the command.
      */
     if (strstr(info, "\ninfo ")) {
-        qemudReportError (NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                          "%s",
-                          _("'info blockstats' not supported by this qemu"));
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        "%s",
+                        _("'info blockstats' not supported by this qemu"));
         goto cleanup;
     }
 
@@ -694,8 +694,8 @@ int qemuMonitorTextGetBlockStatsInfo(qemuMonitorPtr mon,
     }
 
     /* If we reach here then the device was not found. */
-    qemudReportError (NULL, NULL, NULL, VIR_ERR_INVALID_ARG,
-                      _("no stats found for device %s"), devname);
+    qemuReportError (VIR_ERR_INVALID_ARG,
+                     _("no stats found for device %s"), devname);
 
  cleanup:
     VIR_FREE(info);
@@ -741,8 +741,8 @@ int qemuMonitorTextSetVNCPassword(qemuMonitorPtr mon,
                                       qemuMonitorSendVNCPassphrase,
                                       (char *)password,
                                       -1, &info) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("setting VNC password failed"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("setting VNC password failed"));
         return -1;
     }
     VIR_FREE(info);
@@ -770,8 +770,8 @@ int qemuMonitorTextSetBalloon(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("could not balloon memory allocation"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("could not balloon memory allocation"));
         VIR_FREE(cmd);
         return -1;
     }
@@ -803,8 +803,8 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("could not eject media on %s"), devname);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("could not eject media on %s"), devname);
         goto cleanup;
     }
 
@@ -812,8 +812,8 @@ int qemuMonitorTextEjectMedia(qemuMonitorPtr mon,
      * device not found, device is locked ...
      * No message is printed on success it seems */
     if (strstr(reply, "\ndevice ")) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("could not eject media on %s: %s"), devname, reply);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("could not eject media on %s: %s"), devname, reply);
         goto cleanup;
     }
 
@@ -847,8 +847,8 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("could not eject media on %s"), devname);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("could not eject media on %s"), devname);
         goto cleanup;
     }
 
@@ -856,8 +856,8 @@ int qemuMonitorTextChangeMedia(qemuMonitorPtr mon,
      * device not found, device is locked ...
      * No message is printed on success it seems */
     if (strstr(reply, "\ndevice ")) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("could not eject media on %s: %s"), devname, reply);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("could not eject media on %s: %s"), devname, reply);
         goto cleanup;
     }
 
@@ -892,8 +892,8 @@ static int qemuMonitorTextSaveMemory(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("could save memory region to '%s'"), path);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("could save memory region to '%s'"), path);
         goto cleanup;
     }
 
@@ -939,8 +939,8 @@ int qemuMonitorTextSetMigrationSpeed(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &info) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("could restrict migration speed"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("could restrict migration speed"));
         goto cleanup;
     }
 
@@ -974,8 +974,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
     *total = 0;
 
     if (qemuMonitorCommand(mon, "info migrate", &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("cannot query migration status"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("cannot query migration status"));
         return -1;
     }
 
@@ -985,8 +985,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
         *end = '\0';
 
         if ((*status = qemuMonitorMigrationStatusTypeFromString(tmp)) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                             _("unexpected migration status in %s"), reply);
+            qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                            _("unexpected migration status in %s"), reply);
             goto cleanup;
         }
 
@@ -998,8 +998,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
             tmp += strlen(MIGRATION_TRANSFER_PREFIX);
 
             if (virStrToLong_ull(tmp, NULL, 10, transferred) < 0) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("cannot parse migration data transferred statistic %s"), tmp);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot parse migration data transferred statistic %s"), tmp);
                 goto cleanup;
             }
             *transferred *= 1024;
@@ -1009,8 +1009,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
             tmp += strlen(MIGRATION_REMAINING_PREFIX);
 
             if (virStrToLong_ull(tmp, NULL, 10, remaining) < 0) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("cannot parse migration data remaining statistic %s"), tmp);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot parse migration data remaining statistic %s"), tmp);
                 goto cleanup;
             }
             *remaining *= 1024;
@@ -1020,8 +1020,8 @@ int qemuMonitorTextGetMigrationStatus(qemuMonitorPtr mon,
             tmp += strlen(MIGRATION_TOTAL_PREFIX);
 
             if (virStrToLong_ull(tmp, NULL, 10, total) < 0) {
-                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                                 _("cannot parse migration data total statistic %s"), tmp);
+                qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                                _("cannot parse migration data total statistic %s"), tmp);
                 goto cleanup;
             }
             *total *= 1024;
@@ -1064,22 +1064,22 @@ static int qemuMonitorTextMigrate(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &info) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         _("unable to start migration to %s"), dest);
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        _("unable to start migration to %s"), dest);
         goto cleanup;
     }
 
     /* Now check for "fail" in the output string */
     if (strstr(info, "fail") != NULL) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("migration to '%s' failed: %s"), dest, info);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("migration to '%s' failed: %s"), dest, info);
         goto cleanup;
     }
     /* If the command isn't supported then qemu prints:
      * unknown command: migrate" */
     if (strstr(info, "unknown command:")) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                         _("migration to '%s' not supported by this qemu: %s"), dest, info);
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        _("migration to '%s' not supported by this qemu: %s"), dest, info);
         goto cleanup;
     }
 
@@ -1175,8 +1175,8 @@ int qemuMonitorTextMigrateCancel(qemuMonitorPtr mon)
     char *info = NULL;
 
     if (qemuMonitorCommand(mon, "migrate_cancel", &info) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("cannot run monitor command to cancel migration"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("cannot run monitor command to cancel migration"));
         return -1;
     }
     VIR_FREE(info);
@@ -1204,16 +1204,16 @@ int qemuMonitorTextAddUSBDisk(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &info) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
-                         "%s", _("cannot run monitor command to add usb disk"));
+        qemuReportError(VIR_ERR_INTERNAL_ERROR,
+                        "%s", _("cannot run monitor command to add usb disk"));
         goto cleanup;
     }
 
     /* If the command failed qemu prints:
      * Could not add ... */
     if (strstr(info, "Could not add ")) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("unable to add USB disk %s: %s"), path, info);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("unable to add USB disk %s: %s"), path, info);
         goto cleanup;
     }
 
@@ -1239,16 +1239,16 @@ static int qemuMonitorTextAddUSBDevice(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("cannot attach usb device"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("cannot attach usb device"));
         goto cleanup;
     }
 
     /* If the command failed qemu prints:
      * Could not add ... */
     if (strstr(reply, "Could not add ")) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("adding usb device failed"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("adding usb device failed"));
         goto cleanup;
     }
 
@@ -1380,20 +1380,20 @@ int qemuMonitorTextAddPCIHostDevice(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("cannot attach host pci device"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("cannot attach host pci device"));
         goto cleanup;
     }
 
     if (strstr(reply, "invalid type: host")) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT, "%s",
-                         _("PCI device assignment is not supported by this version of qemu"));
+        qemuReportError(VIR_ERR_NO_SUPPORT, "%s",
+                        _("PCI device assignment is not supported by this version of qemu"));
         goto cleanup;
     }
 
     if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("parsing pci_add reply failed: %s"), reply);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("parsing pci_add reply failed: %s"), reply);
         goto cleanup;
     }
 
@@ -1431,8 +1431,8 @@ try_command:
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("cannot attach %s disk %s"), bus, path);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("cannot attach %s disk %s"), bus, path);
         goto cleanup;
     }
 
@@ -1444,8 +1444,8 @@ try_command:
             goto try_command;
         }
 
-        qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                          _("adding %s disk failed %s: %s"), bus, path, reply);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("adding %s disk failed %s: %s"), bus, path, reply);
         goto cleanup;
     }
 
@@ -1473,14 +1473,14 @@ int qemuMonitorTextAddPCINetwork(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("failed to add NIC with '%s'"), cmd);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("failed to add NIC with '%s'"), cmd);
         goto cleanup;
     }
 
     if (qemuMonitorTextParsePciAddReply(mon, reply, guestAddr) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("parsing pci_add reply failed: %s"), reply);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("parsing pci_add reply failed: %s"), reply);
         goto cleanup;
     }
 
@@ -1517,8 +1517,8 @@ try_command:
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         "%s", _("failed to remove PCI device"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        "%s", _("failed to remove PCI device"));
         goto cleanup;
     }
 
@@ -1536,9 +1536,9 @@ try_command:
      * nothing is printed on success */
     if (strstr(reply, "invalid slot") ||
         strstr(reply, "Invalid pci address")) {
-        qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                          _("failed to detach PCI device, invalid address %.4x:%.2x:%.2x: %s"),
-                          guestAddr->domain, guestAddr->bus, guestAddr->slot, reply);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("failed to detach PCI device, invalid address %.4x:%.2x:%.2x: %s"),
+                        guestAddr->domain, guestAddr->bus, guestAddr->slot, reply);
         goto cleanup;
     }
 
@@ -1565,17 +1565,17 @@ int qemuMonitorTextSendFileHandle(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommandWithFd(mon, cmd, fd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("failed to pass fd to qemu with '%s'"), cmd);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("failed to pass fd to qemu with '%s'"), cmd);
         goto cleanup;
     }
 
     /* If the command isn't supported then qemu prints:
      * unknown command: getfd" */
     if (strstr(reply, "unknown command:")) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                         _("qemu does not support sending of file handles: %s"),
-                         reply);
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        _("qemu does not support sending of file handles: %s"),
+                        reply);
         goto cleanup;
     }
 
@@ -1601,17 +1601,17 @@ int qemuMonitorTextCloseFileHandle(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("failed to close fd in qemu with '%s'"), cmd);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("failed to close fd in qemu with '%s'"), cmd);
         goto cleanup;
     }
 
     /* If the command isn't supported then qemu prints:
      * unknown command: getfd" */
     if (strstr(reply, "unknown command:")) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SUPPORT,
-                         _("qemu does not support closing of file handles: %s"),
-                         reply);
+        qemuReportError(VIR_ERR_NO_SUPPORT,
+                        _("qemu does not support closing of file handles: %s"),
+                        reply);
         goto cleanup;
     }
 
@@ -1637,8 +1637,8 @@ int qemuMonitorTextAddHostNetwork(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("failed to close fd in qemu with '%s'"), cmd);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("failed to close fd in qemu with '%s'"), cmd);
         goto cleanup;
     }
 
@@ -1667,8 +1667,8 @@ int qemuMonitorTextRemoveHostNetwork(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("failed to remove host network in qemu with '%s'"), cmd);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("failed to remove host network in qemu with '%s'"), cmd);
         goto cleanup;
     }
 
@@ -1702,8 +1702,8 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
     int ret = -1;
 
     if (qemuMonitorCommand(mon, "info chardev", &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "%s",
-                         _("failed to retrieve chardev info in qemu with 'info chardev'"));
+        qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
+                        _("failed to retrieve chardev info in qemu with 'info chardev'"));
         goto cleanup;
     }
 
@@ -1753,9 +1753,9 @@ int qemuMonitorTextGetPtyPaths(qemuMonitorPtr mon,
         }
 
         if (virHashAddEntry(paths, id, path) < 0) {
-            qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                             _("failed to save chardev path '%s'"),
-                             path);
+            qemuReportError(VIR_ERR_OPERATION_FAILED,
+                            _("failed to save chardev path '%s'"),
+                            path);
             VIR_FREE(path);
             goto cleanup;
         }
@@ -1787,8 +1787,8 @@ try_command:
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("cannot attach %s disk controller"), bus);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("cannot attach %s disk controller"), bus);
         goto cleanup;
     }
 
@@ -1800,8 +1800,8 @@ try_command:
             goto try_command;
         }
 
-        qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                          _("adding %s disk controller failed: %s"), bus, reply);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("adding %s disk controller failed: %s"), bus, reply);
         goto cleanup;
     }
 
@@ -1887,8 +1887,8 @@ try_command:
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("failed to close fd in qemu with '%s'"), cmd);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("failed to close fd in qemu with '%s'"), cmd);
         goto cleanup;
     }
 
@@ -1899,8 +1899,8 @@ try_command:
             tryOldSyntax = 1;
             goto try_command;
         }
-        qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                          _("adding %s disk failed: %s"), drivestr, reply);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("adding %s disk failed: %s"), drivestr, reply);
         goto cleanup;
     }
 
@@ -1954,8 +1954,8 @@ cleanup:
         (p) += strlen(lbl);
 #define GET_INT(p, base, val)                                           \
     if (virStrToLong_ui((p), &(p), (base), &(val)) < 0) {               \
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,    \
-                         _("cannot parse value for %s"), #val);         \
+        qemuReportError(VIR_ERR_OPERATION_FAILED,                       \
+                        _("cannot parse value for %s"), #val);          \
         break;                                                          \
     }
 #define SKIP_SPACE(p)                           \
@@ -1972,7 +1972,7 @@ int qemuMonitorTextGetAllPCIAddresses(qemuMonitorPtr mon,
     *retaddrs = NULL;
 
     if (qemuMonitorCommand(mon, "info pci", &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
                          "%s", _("cannot query PCI addresses"));
         return -1;
     }
@@ -2064,14 +2064,14 @@ int qemuMonitorTextAddDevice(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("cannot attach %s device"), devicestr);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("cannot attach %s device"), devicestr);
         goto cleanup;
     }
 
     if (STRNEQ(reply, "")) {
-        qemudReportError (NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                          _("adding %s device failed: %s"), devicestr, reply);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("adding %s device failed: %s"), devicestr, reply);
         goto cleanup;
     }
 
@@ -2107,8 +2107,8 @@ int qemuMonitorTextAddDrive(qemuMonitorPtr mon,
     }
 
     if (qemuMonitorCommand(mon, cmd, &reply) < 0) {
-        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED,
-                         _("failed to close fd in qemu with '%s'"), cmd);
+        qemuReportError(VIR_ERR_OPERATION_FAILED,
+                        _("failed to close fd in qemu with '%s'"), cmd);
         goto cleanup;
     }
 
diff --git a/tests/qemuargv2xmltest.c b/tests/qemuargv2xmltest.c
index c125a34..694c552 100644
--- a/tests/qemuargv2xmltest.c
+++ b/tests/qemuargv2xmltest.c
@@ -49,7 +49,7 @@ static int testCompareXMLToArgvFiles(const char *xml,
     if (virtTestLoadFile(xml, &expectxml, MAX_FILE) < 0)
         goto fail;
 
-    if (!(vmdef = qemuParseCommandLineString(NULL, driver.caps, cmd)))
+    if (!(vmdef = qemuParseCommandLineString(driver.caps, cmd)))
         goto fail;
 
     if (!(actualxml = virDomainDefFormat(NULL, vmdef, 0)))
-- 
1.6.6

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