Re: PATCH 5/9: Adapt to virError API

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

 



And with the actual patch...

On Mon, Jun 18, 2007 at 03:18:40AM +0100, Daniel P. Berrange wrote:
> This patch switches the driver.c, conf.c and dispatch.c files over to use
> the virError object and associated API instead of a custom version.
> 
>  Makefile.am |    5 +
>  conf.c      |  192 ++++++++++++++++++++++++++++++------------------------------
>  dispatch.c  |   16 +++--
>  driver.c    |  174 ++++++++++++++++++++++++++++++------------------------
>  driver.h    |    6 +
>  internal.h  |    2 
>  6 files changed, 213 insertions(+), 182 deletions(-)
> 
> Dan.
> -- 
> |=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
> |=-           Perl modules: http://search.cpan.org/~danberr/              -=|
> |=-               Projects: http://freshmeat.net/~danielpb/               -=|
> |=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
> 
> --
> Libvir-list mailing list
> Libvir-list@xxxxxxxxxx
> https://www.redhat.com/mailman/listinfo/libvir-list

-- 
|=- Red Hat, Engineering, Emerging Technologies, Boston.  +1 978 392 2496 -=|
|=-           Perl modules: http://search.cpan.org/~danberr/              -=|
|=-               Projects: http://freshmeat.net/~danielpb/               -=|
|=-  GnuPG: 7D3B9505   F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505  -=| 
diff -r 8ca0822730db qemud/Makefile.am
--- a/qemud/Makefile.am	Sun Jun 17 19:37:57 2007 -0400
+++ b/qemud/Makefile.am	Sun Jun 17 22:11:09 2007 -0400
@@ -17,6 +17,7 @@ libvirt_qemud_SOURCES = \
 		protocol.h protocol.c \
 		remote_protocol.h remote_protocol.c \
 		remote.c \
+                ../src/virterror.c \
                 event.c event.h
 #-D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED=1 -D_POSIX_C_SOURCE=199506L
 libvirt_qemud_CFLAGS = \
@@ -24,7 +25,9 @@ libvirt_qemud_CFLAGS = \
         $(WARN_CFLAGS) -DLOCAL_STATE_DIR="\"$(localstatedir)\"" \
         -DSYSCONF_DIR="\"$(sysconfdir)\"" \
 	-DQEMUD_PID_FILE="\"$(QEMUD_PID_FILE)\"" \
-	-DREMOTE_PID_FILE="\"$(REMOTE_PID_FILE)\""
+	-DREMOTE_PID_FILE="\"$(REMOTE_PID_FILE)\"" \
+        -DGETTEXT_PACKAGE=\"$(PACKAGE)\"
+
 libvirt_qemud_LDFLAGS = $(WARN_CFLAGS) $(LIBXML_LIBS) $(SYSFS_LIBS)
 libvirt_qemud_DEPENDENCIES = ../src/libvirt.la
 libvirt_qemud_LDADD = ../src/libvirt.la
diff -r 8ca0822730db qemud/conf.c
--- a/qemud/conf.c	Sun Jun 17 19:37:57 2007 -0400
+++ b/qemud/conf.c	Sun Jun 17 22:11:09 2007 -0400
@@ -194,14 +194,14 @@ static char *qemudLocateBinaryForArch(st
         name = qemudDefaultBinaryForArch(arch);
 
     if (!name) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot determin binary for architecture %s", arch);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot determin binary for architecture %s", arch);
         return NULL;
     }
 
     /* XXX lame. should actually use $PATH ... */
     path = malloc(strlen(name) + strlen("/usr/bin/") + 1);
     if (!path) {
-        qemudReportError(server, VIR_ERR_NO_MEMORY, "path");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "path");
         return NULL;
     }
     strcpy(path, "/usr/bin/");
@@ -314,7 +314,7 @@ int qemudExtractVersion(struct qemud_ser
         return -1;
 
     if (stat(binary, &sb) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "Cannot find QEMU binary %s: %s", binary,
                          strerror(errno));
         free(binary);
@@ -343,7 +343,7 @@ static struct qemud_vm_disk_def *qemudPa
     int typ = 0;
 
     if (!disk) {
-        qemudReportError(server, VIR_ERR_NO_MEMORY, "disk");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "disk");
         return NULL;
     }
 
@@ -383,11 +383,11 @@ static struct qemud_vm_disk_def *qemudPa
     }
 
     if (source == NULL) {
-        qemudReportError(server, VIR_ERR_NO_SOURCE, target ? "%s" : NULL, target);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_SOURCE, target ? "%s" : NULL, target);
         goto error;
     }
     if (target == NULL) {
-        qemudReportError(server, VIR_ERR_NO_TARGET, source ? "%s" : NULL, source);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_TARGET, source ? "%s" : NULL, source);
         goto error;
     }
 
@@ -395,14 +395,14 @@ static struct qemud_vm_disk_def *qemudPa
         !strcmp((const char *)device, "floppy") &&
         strcmp((const char *)target, "fda") &&
         strcmp((const char *)target, "fdb")) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "Invalid floppy device name: %s", target);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid floppy device name: %s", target);
         goto error;
     }
   
     if (device &&
         !strcmp((const char *)device, "cdrom") &&
         strcmp((const char *)target, "hdc")) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "Invalid cdrom device name: %s", target);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid cdrom device name: %s", target);
         goto error;
     }
 
@@ -415,7 +415,7 @@ static struct qemud_vm_disk_def *qemudPa
         strcmp((const char *)target, "hdb") &&
         strcmp((const char *)target, "hdc") &&
         strcmp((const char *)target, "hdd")) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "Invalid harddisk device name: %s", target);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid harddisk device name: %s", target);
         goto error;
     }
 
@@ -435,7 +435,7 @@ static struct qemud_vm_disk_def *qemudPa
     else if (!strcmp((const char *)device, "floppy"))
         disk->device = QEMUD_DISK_FLOPPY;
     else {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "Invalid device type: %s", device);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Invalid device type: %s", device);
         goto error;
     }
 
@@ -483,7 +483,7 @@ static struct qemud_vm_net_def *qemudPar
     xmlChar *port = NULL;
 
     if (!net) {
-        qemudReportError(server, VIR_ERR_NO_MEMORY, "net");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "net");
         return NULL;
     }
 
@@ -573,11 +573,11 @@ static struct qemud_vm_net_def *qemudPar
         int len;
 
         if (network == NULL) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "No <source> 'network' attribute specified with <interface type='network'/>");
             goto error;
         } else if ((len = xmlStrlen(network)) >= (QEMUD_MAX_NAME_LEN-1)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Network name '%s' too long", network);
             goto error;
         } else {
@@ -592,7 +592,7 @@ static struct qemud_vm_net_def *qemudPar
 
         if (ifname != NULL) {
             if ((len = xmlStrlen(ifname)) >= (BR_IFNAME_MAXLEN-1)) {
-                qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  "TAP interface name '%s' is too long", ifname);
                 goto error;
             } else {
@@ -607,7 +607,7 @@ static struct qemud_vm_net_def *qemudPar
 
         if (script != NULL) {
             if ((len = xmlStrlen(script)) >= (PATH_MAX-1)) {
-                qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  "TAP script path '%s' is too long", script);
                 goto error;
             } else {
@@ -619,7 +619,7 @@ static struct qemud_vm_net_def *qemudPar
         }
         if (ifname != NULL) {
             if ((len = xmlStrlen(ifname)) >= (BR_IFNAME_MAXLEN-1)) {
-                qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  "TAP interface name '%s' is too long", ifname);
                 goto error;
             } else {
@@ -632,11 +632,11 @@ static struct qemud_vm_net_def *qemudPar
         int len;
 
         if (bridge == NULL) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "No <source> 'dev' attribute specified with <interface type='bridge'/>");
             goto error;
         } else if ((len = xmlStrlen(bridge)) >= (BR_IFNAME_MAXLEN-1)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "TAP bridge path '%s' is too long", bridge);
             goto error;
         } else {
@@ -649,7 +649,7 @@ static struct qemud_vm_net_def *qemudPar
 
         if (ifname != NULL) {
             if ((len = xmlStrlen(ifname)) >= (BR_IFNAME_MAXLEN-1)) {
-                qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  "TAP interface name '%s' is too long", ifname);
                 goto error;
             } else {
@@ -665,13 +665,13 @@ static struct qemud_vm_net_def *qemudPar
         char *ret;
 
         if (port == NULL) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "No <source> 'port' attribute specified with socket interface");
             goto error;
         }
         if (!(net->dst.socket.port = strtol((char*)port, &ret, 10)) &&
             ret == (char*)port) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Cannot parse <source> 'port' attribute with socket interface");
             goto error;
         }
@@ -681,12 +681,12 @@ static struct qemud_vm_net_def *qemudPar
         if (address == NULL) {
             if (net->type == QEMUD_NET_CLIENT ||
                 net->type == QEMUD_NET_MCAST) {
-                qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  "No <source> 'address' attribute specified with socket interface");
                 goto error;
             }
         } else if ((len = xmlStrlen(address)) >= (BR_INET_ADDR_MAXLEN)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "IP address '%s' is too long", address);
             goto error;
         }
@@ -734,27 +734,27 @@ static struct qemud_vm_def *qemudParseXM
     struct qemud_vm_def *def;
 
     if (!(def = calloc(1, sizeof(struct qemud_vm_def)))) {
-        qemudReportError(server, VIR_ERR_NO_MEMORY, "xmlXPathContext");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "xmlXPathContext");
         return NULL;
     }
 
     /* Prepare parser / xpath context */
     root = xmlDocGetRootElement(xml);
     if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "domain"))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "incorrect root element");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "incorrect root element");
         goto error;
     }
 
     ctxt = xmlXPathNewContext(xml);
     if (ctxt == NULL) {
-        qemudReportError(server, VIR_ERR_NO_MEMORY, "xmlXPathContext");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "xmlXPathContext");
         goto error;
     }
 
 
     /* Find out what type of QEMU virtualization to use */
     if (!(prop = xmlGetProp(root, BAD_CAST "type"))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "missing domain type attribute");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "missing domain type attribute");
         goto error;
     }
 
@@ -765,7 +765,7 @@ static struct qemud_vm_def *qemudParseXM
     else if (!strcmp((char *)prop, "kvm"))
         def->virtType = QEMUD_VIRT_KVM;
     else {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "invalid domain type attribute");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "invalid domain type attribute");
         goto error;
     }
     free(prop);
@@ -776,11 +776,11 @@ static struct qemud_vm_def *qemudParseXM
     obj = xmlXPathEval(BAD_CAST "string(/domain/name[1])", ctxt);
     if ((obj == NULL) || (obj->type != XPATH_STRING) ||
         (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
-        qemudReportError(server, VIR_ERR_NO_NAME, NULL);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_NAME, NULL);
         goto error;
     }
     if (strlen((const char *)obj->stringval) >= (QEMUD_MAX_NAME_LEN-1)) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "domain name length too long");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "domain name length too long");
         goto error;
     }
     strcpy(def->name, (const char *)obj->stringval);
@@ -793,12 +793,12 @@ static struct qemud_vm_def *qemudParseXM
         (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
         int err;
         if ((err = qemudGenerateUUID(def->uuid))) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Failed to generate UUID: %s", strerror(err));
             goto error;
         }
     } else if (qemudParseUUID((const char *)obj->stringval, def->uuid) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element");
         goto error;
     }
     xmlXPathFreeObject(obj);
@@ -808,13 +808,13 @@ static struct qemud_vm_def *qemudParseXM
     obj = xmlXPathEval(BAD_CAST "string(/domain/memory[1])", ctxt);
     if ((obj == NULL) || (obj->type != XPATH_STRING) ||
         (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "missing memory element");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "missing memory element");
         goto error;
     } else {
         conv = NULL;
         def->maxmem = strtoll((const char*)obj->stringval, &conv, 10);
         if (conv == (const char*)obj->stringval) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "malformed memory information");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed memory information");
             goto error;
         }
     }
@@ -833,7 +833,7 @@ static struct qemud_vm_def *qemudParseXM
         if (def->memory > def->maxmem)
             def->memory = def->maxmem;
         if (conv == (const char*)obj->stringval) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "malformed memory information");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed memory information");
             goto error;
         }
     }
@@ -849,7 +849,7 @@ static struct qemud_vm_def *qemudParseXM
         conv = NULL;
         def->vcpus = strtoll((const char*)obj->stringval, &conv, 10);
         if (conv == (const char*)obj->stringval) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "malformed vcpu information");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed vcpu information");
             goto error;
         }
     }
@@ -884,11 +884,11 @@ static struct qemud_vm_def *qemudParseXM
     obj = xmlXPathEval(BAD_CAST "string(/domain/os/type[1])", ctxt);
     if ((obj == NULL) || (obj->type != XPATH_STRING) ||
         (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
-        qemudReportError(server, VIR_ERR_OS_TYPE, NULL);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_OS_TYPE, NULL);
         goto error;
     }
     if (strcmp((const char *)obj->stringval, "hvm")) {
-        qemudReportError(server, VIR_ERR_OS_TYPE, "%s", obj->stringval);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_OS_TYPE, "%s", obj->stringval);
         goto error;
     }
     strcpy(def->os.type, (const char *)obj->stringval);
@@ -900,13 +900,13 @@ static struct qemud_vm_def *qemudParseXM
         (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
         const char *defaultArch = qemudDefaultArch();
         if (strlen(defaultArch) >= (QEMUD_OS_TYPE_MAX_LEN-1)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
             goto error;
         }
         strcpy(def->os.arch, defaultArch);
     } else {
         if (strlen((const char *)obj->stringval) >= (QEMUD_OS_TYPE_MAX_LEN-1)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
             goto error;
         }
         strcpy(def->os.arch, (const char *)obj->stringval);
@@ -919,13 +919,13 @@ static struct qemud_vm_def *qemudParseXM
         (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
         const char *defaultMachine = qemudDefaultMachineForArch(def->os.arch);
         if (strlen(defaultMachine) >= (QEMUD_OS_MACHINE_MAX_LEN-1)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "machine type too long");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "machine type too long");
             goto error;
         }
         strcpy(def->os.machine, defaultMachine);
     } else {
         if (strlen((const char *)obj->stringval) >= (QEMUD_OS_MACHINE_MAX_LEN-1)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "architecture type too long");
             goto error;
         }
         strcpy(def->os.machine, (const char *)obj->stringval);
@@ -938,7 +938,7 @@ static struct qemud_vm_def *qemudParseXM
     if ((obj != NULL) && (obj->type == XPATH_STRING) &&
         (obj->stringval != NULL) && (obj->stringval[0] != 0)) {
         if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "kernel path too long");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "kernel path too long");
             goto error;
         }
         strcpy(def->os.kernel, (const char *)obj->stringval);
@@ -951,7 +951,7 @@ static struct qemud_vm_def *qemudParseXM
     if ((obj != NULL) && (obj->type == XPATH_STRING) &&
         (obj->stringval != NULL) && (obj->stringval[0] != 0)) {
         if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "initrd path too long");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "initrd path too long");
             goto error;
         }
         strcpy(def->os.initrd, (const char *)obj->stringval);
@@ -964,7 +964,7 @@ static struct qemud_vm_def *qemudParseXM
     if ((obj != NULL) && (obj->type == XPATH_STRING) &&
         (obj->stringval != NULL) && (obj->stringval[0] != 0)) {
         if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "cmdline arguments too long");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "cmdline arguments too long");
             goto error;
         }
         strcpy(def->os.cmdline, (const char *)obj->stringval);
@@ -1014,7 +1014,7 @@ static struct qemud_vm_def *qemudParseXM
         free(tmp);
     } else {
         if (strlen((const char *)obj->stringval) >= (PATH_MAX-1)) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "emulator path too long");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "emulator path too long");
             goto error;
         }
         strcpy(def->os.binary, (const char *)obj->stringval);
@@ -1039,7 +1039,7 @@ static struct qemud_vm_def *qemudParseXM
         } else if (!strcmp((char *)prop, "sdl")) {
             def->graphicsType = QEMUD_GRAPHICS_SDL;
         } else {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "Unsupported graphics type %s", prop);
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "Unsupported graphics type %s", prop);
             goto error;
         }
         xmlFree(prop);
@@ -1124,11 +1124,11 @@ qemudNetworkIfaceConnect(struct qemud_se
 
     if (net->type == QEMUD_NET_NETWORK) {
         if (!(network = qemudFindNetworkByName(server, net->dst.network.name))) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Network '%s' not found", net->dst.network.name);
             goto error;
         } else if (network->bridge[0] == '\0') {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Network '%s' not active", net->dst.network.name);
             goto error;
         }
@@ -1146,20 +1146,20 @@ qemudNetworkIfaceConnect(struct qemud_se
         }
         ifname = net->dst.bridge.ifname;
     } else {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "Network type %d is not supported", net->type);
         goto error;
     }
 
     if (!server->brctl && (err = brInit(&server->brctl))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot initialize bridge support: %s", strerror(err));
         goto error;
     }
 
     if ((err = brAddTap(server->brctl, brname,
                         ifname, BR_IFNAME_MAXLEN, &tapfd))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "Failed to add tap interface '%s' to bridge '%s' : %s",
                          ifname, brname, strerror(err));
         goto error;
@@ -1180,7 +1180,7 @@ qemudNetworkIfaceConnect(struct qemud_se
     return retval;
 
  no_memory:
-    qemudReportError(server, VIR_ERR_NO_MEMORY, "tapfds");
+    qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "tapfds");
  error:
     if (retval)
         free(retval);
@@ -1233,7 +1233,7 @@ int qemudBuildCommandLine(struct qemud_s
      * in a sub-process so its hard to feed back a useful error
      */
     if (stat(vm->def->os.binary, &sb) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "Cannot find QEMU binary %s: %s", vm->def->os.binary,
                          strerror(errno));
         return -1;
@@ -1477,7 +1477,7 @@ int qemudBuildCommandLine(struct qemud_s
     return 0;
 
  no_memory:
-    qemudReportError(server, VIR_ERR_NO_MEMORY, "argv");
+    qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "argv");
  error:
     if (vm->tapfds) {
         for (i = 0; vm->tapfds[i] != -1; i++)
@@ -1509,7 +1509,7 @@ static int qemudSaveConfig(struct qemud_
     if ((fd = open(vm->configFile,
                    O_WRONLY | O_CREAT | O_TRUNC,
                    S_IRUSR | S_IWUSR )) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot create config file %s: %s",
                          vm->configFile, strerror(errno));
         goto cleanup;
@@ -1517,14 +1517,14 @@ static int qemudSaveConfig(struct qemud_
 
     towrite = strlen(xml);
     if (write(fd, xml, towrite) != towrite) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot write config file %s: %s",
                          vm->configFile, strerror(errno));
         goto cleanup;
     }
 
     if (close(fd) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot save config file %s: %s",
                          vm->configFile, strerror(errno));
         goto cleanup;
@@ -1551,7 +1551,7 @@ qemudParseVMDef(struct qemud_server *ser
     if (!(xml = xmlReadDoc(BAD_CAST xmlStr, displayName ? displayName : "domain.xml", NULL,
                            XML_PARSE_NOENT | XML_PARSE_NONET |
                            XML_PARSE_NOERROR | XML_PARSE_NOWARNING))) {
-        qemudReportError(server, VIR_ERR_XML_ERROR, NULL);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_XML_ERROR, NULL);
         return NULL;
     }
 
@@ -1582,7 +1582,7 @@ qemudAssignVMDef(struct qemud_server *se
     }
 
     if (!(vm = calloc(1, sizeof(struct qemud_vm)))) {
-        qemudReportError(server, VIR_ERR_NO_MEMORY, "vm");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "vm");
         return NULL;
     }
 
@@ -1633,7 +1633,7 @@ qemudSaveVMDef(struct qemud_server *serv
         int err;
 
         if ((err = qemudEnsureDir(server->configDir))) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "cannot create config directory %s: %s",
                              server->configDir, strerror(err));
             return -1;
@@ -1641,14 +1641,14 @@ qemudSaveVMDef(struct qemud_server *serv
 
         if (qemudMakeConfigPath(server->configDir, def->name, ".xml",
                                 vm->configFile, PATH_MAX) < 0) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "cannot construct config file path");
             return -1;
         }
 
         if (qemudMakeConfigPath(server->autostartDir, def->name, ".xml",
                                 vm->autostartLink, PATH_MAX) < 0) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "cannot construct autostart link path");
             vm->configFile[0] = '\0';
             return -1;
@@ -1671,7 +1671,7 @@ static int qemudSaveNetworkConfig(struct
     }
 
     if ((err = qemudEnsureDir(server->networkConfigDir))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot create config directory %s: %s",
                          server->networkConfigDir, strerror(err));
         goto cleanup;
@@ -1680,7 +1680,7 @@ static int qemudSaveNetworkConfig(struct
     if ((fd = open(network->configFile,
                    O_WRONLY | O_CREAT | O_TRUNC,
                    S_IRUSR | S_IWUSR )) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot create config file %s: %s",
                          network->configFile, strerror(errno));
         goto cleanup;
@@ -1688,14 +1688,14 @@ static int qemudSaveNetworkConfig(struct
 
     towrite = strlen(xml);
     if (write(fd, xml, towrite) != towrite) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot write config file %s: %s",
                          network->configFile, strerror(errno));
         goto cleanup;
     }
 
     if (close(fd) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot save config file %s: %s",
                          network->configFile, strerror(errno));
         goto cleanup;
@@ -1777,7 +1777,7 @@ static int qemudParseDhcpRangesXML(struc
         }
 
         if (!(range = calloc(1, sizeof(struct qemud_dhcp_range_def)))) {
-            qemudReportError(server, VIR_ERR_NO_MEMORY, "range");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "range");
             return 0;
         }
 
@@ -1867,20 +1867,20 @@ static struct qemud_network_def *qemudPa
     struct qemud_network_def *def;
 
     if (!(def = calloc(1, sizeof(struct qemud_network_def)))) {
-        qemudReportError(server, VIR_ERR_NO_MEMORY, "network_def");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "network_def");
         return NULL;
     }
 
     /* Prepare parser / xpath context */
     root = xmlDocGetRootElement(xml);
     if ((root == NULL) || (!xmlStrEqual(root->name, BAD_CAST "network"))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "incorrect root element");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "incorrect root element");
         goto error;
     }
 
     ctxt = xmlXPathNewContext(xml);
     if (ctxt == NULL) {
-        qemudReportError(server, VIR_ERR_NO_MEMORY, "xmlXPathContext");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "xmlXPathContext");
         goto error;
     }
 
@@ -1889,11 +1889,11 @@ static struct qemud_network_def *qemudPa
     obj = xmlXPathEval(BAD_CAST "string(/network/name[1])", ctxt);
     if ((obj == NULL) || (obj->type != XPATH_STRING) ||
         (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
-        qemudReportError(server, VIR_ERR_NO_NAME, NULL);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_NAME, NULL);
         goto error;
     }
     if (strlen((const char *)obj->stringval) >= (QEMUD_MAX_NAME_LEN-1)) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "network name length too long");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "network name length too long");
         goto error;
     }
     strcpy(def->name, (const char *)obj->stringval);
@@ -1906,12 +1906,12 @@ static struct qemud_network_def *qemudPa
         (obj->stringval == NULL) || (obj->stringval[0] == 0)) {
         int err;
         if ((err = qemudGenerateUUID(def->uuid))) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Failed to generate UUID: %s", strerror(err));
             goto error;
         }
     } else if (qemudParseUUID((const char *)obj->stringval, def->uuid) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "%s", "malformed uuid element");
         goto error;
     }
     xmlXPathFreeObject(obj);
@@ -1942,7 +1942,7 @@ static struct qemud_network_def *qemudPa
         obj->boolval) {
         if (!def->ipAddress[0] ||
             !def->netmask[0]) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Forwarding requested, but no IPv4 address/netmask provided");
             goto error;
         }
@@ -1953,7 +1953,7 @@ static struct qemud_network_def *qemudPa
             (tmp->stringval != NULL) && (tmp->stringval[0] != 0)) {
             int len;
             if ((len = xmlStrlen(tmp->stringval)) >= (BR_IFNAME_MAXLEN-1)) {
-                qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  "forward device name '%s' is too long",
                                  (char*)tmp->stringval);
                 goto error;
@@ -1996,7 +1996,7 @@ qemudParseNetworkDef(struct qemud_server
     if (!(xml = xmlReadDoc(BAD_CAST xmlStr, displayName ? displayName : "network.xml", NULL,
                            XML_PARSE_NOENT | XML_PARSE_NONET |
                            XML_PARSE_NOERROR | XML_PARSE_NOWARNING))) {
-        qemudReportError(server, VIR_ERR_XML_ERROR, NULL);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_XML_ERROR, NULL);
         return NULL;
     }
 
@@ -2026,7 +2026,7 @@ qemudAssignNetworkDef(struct qemud_serve
     }
 
     if (!(network = calloc(1, sizeof(struct qemud_network)))) {
-        qemudReportError(server, VIR_ERR_NO_MEMORY, "network");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "network");
         return NULL;
     }
 
@@ -2072,7 +2072,7 @@ qemudSaveNetworkDef(struct qemud_server 
         int err;
 
         if ((err = qemudEnsureDir(server->networkConfigDir))) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "cannot create config directory %s: %s",
                              server->networkConfigDir, strerror(err));
             return -1;
@@ -2080,14 +2080,14 @@ qemudSaveNetworkDef(struct qemud_server 
 
         if (qemudMakeConfigPath(server->networkConfigDir, def->name, ".xml",
                                 network->configFile, PATH_MAX) < 0) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "cannot construct config file path");
             return -1;
         }
 
         if (qemudMakeConfigPath(server->networkAutostartDir, def->name, ".xml",
                                 network->autostartLink, PATH_MAX) < 0) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "cannot construct autostart link path");
             network->configFile[0] = '\0';
             return -1;
@@ -2276,8 +2276,9 @@ qemudLoadConfig(struct qemud_server *ser
     struct qemud_vm *vm;
 
     if (!(def = qemudParseVMDef(server, xml, file))) {
+        virErrorPtr err = virGetLastError();
         qemudLog(QEMUD_WARN, "Error parsing QEMU guest config '%s' : %s",
-                 path, server->errorMessage);
+                 path, err->message);
         return NULL;
     }
 
@@ -2315,8 +2316,9 @@ qemudLoadNetworkConfig(struct qemud_serv
     struct qemud_network *network;
 
     if (!(def = qemudParseNetworkDef(server, xml, file))) {
+        virErrorPtr err = virGetLastError();
         qemudLog(QEMUD_WARN, "Error parsing network config '%s' : %s",
-                 path, server->errorMessage);
+                 path, err->message);
         return NULL;
     }
 
@@ -2408,9 +2410,11 @@ void qemudAutostartConfigs(struct qemud_
 
         if (network->autostart &&
             !qemudIsActiveNetwork(network) &&
-            qemudStartNetworkDaemon(server, network) < 0)
+            qemudStartNetworkDaemon(server, network) < 0) {
+            virErrorPtr err = virGetLastError();
             qemudLog(QEMUD_ERR, "Failed to autostart network '%s': %s",
-                     network->def->name, server->errorMessage);
+                     network->def->name, err->message);
+        }
 
         network = next;
     }
@@ -2421,9 +2425,11 @@ void qemudAutostartConfigs(struct qemud_
 
         if (vm->autostart &&
             !qemudIsActiveVM(vm) &&
-            qemudStartVMDaemon(server, vm) < 0)
+            qemudStartVMDaemon(server, vm) < 0) {
+            virErrorPtr err = virGetLastError();
             qemudLog(QEMUD_ERR, "Failed to autostart VM '%s': %s",
-                     vm->def->name, server->errorMessage);
+                     vm->def->name, err->message);
+        }
 
         vm = next;
     }
@@ -2470,7 +2476,7 @@ char *qemudGenerateXML(struct qemud_serv
         break;
     }
     if (!type) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "unexpected domain type %d", def->virtType);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "unexpected domain type %d", def->virtType);
         goto cleanup;
     }
 
@@ -2714,7 +2720,7 @@ char *qemudGenerateXML(struct qemud_serv
     return bufferContentAndFree (buf);
 
  no_memory:
-    qemudReportError(server, VIR_ERR_NO_MEMORY, "xml");
+    qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "xml");
  cleanup:
     if (buf) bufferFree (buf);
     return NULL;
@@ -2806,7 +2812,7 @@ char *qemudGenerateNetworkXML(struct qem
     return bufferContentAndFree (buf);
 
  no_memory:
-    qemudReportError(server, VIR_ERR_NO_MEMORY, "xml");
+    qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "xml");
     if (buf) bufferFree (buf);
     return NULL;
 }
@@ -2816,12 +2822,12 @@ int qemudDeleteConfig(struct qemud_serve
                       const char *configFile,
                       const char *name) {
     if (!configFile[0]) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "no config file for %s", name);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "no config file for %s", name);
         return -1;
     }
 
     if (unlink(configFile) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot remove config for %s", name);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot remove config for %s", name);
         return -1;
     }
 
diff -r 8ca0822730db qemud/dispatch.c
--- a/qemud/dispatch.c	Sun Jun 17 19:37:57 2007 -0400
+++ b/qemud/dispatch.c	Sun Jun 17 22:11:09 2007 -0400
@@ -39,9 +39,14 @@ static int qemudDispatchFailure(struct q
 static int qemudDispatchFailure(struct qemud_server *server ATTRIBUTE_UNUSED,
                                 struct qemud_client *client ATTRIBUTE_UNUSED,
                                 struct qemud_packet_server_data *out) {
+    virErrorPtr err = virGetLastError();
+
     out->type = QEMUD_SERVER_PKT_FAILURE;
-    out->qemud_packet_server_data_u.failureReply.code = server->errorCode;
-    strcpy(out->qemud_packet_server_data_u.failureReply.message, server->errorMessage);
+
+    out->qemud_packet_server_data_u.failureReply.code = err->code;
+    strncpy(out->qemud_packet_server_data_u.failureReply.message,
+            err->message, QEMUD_MAX_ERROR_LEN-1);
+    out->qemud_packet_server_data_u.failureReply.message[QEMUD_MAX_ERROR_LEN-1] = '\0';
     return 0;
 }
 
@@ -90,7 +95,7 @@ qemudDispatchGetCapabilities (struct qem
     char *xml = qemudGetCapabilities(server);
 
     if (strlen(xml) > QEMUD_MAX_XML_LEN) {
-        qemudReportError (server, VIR_ERR_XML_ERROR, NULL);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_XML_ERROR, NULL);
         qemudDispatchFailure (server, client, out);
         free(xml);
         return 0;
@@ -784,8 +789,7 @@ int qemudDispatch(struct qemud_server *s
     qemudDebug("> Dispatching request type %d, readonly ? %d",
                in->type, client->readonly);
 
-    server->errorCode = 0;
-    server->errorMessage[0] = '\0';
+    virResetLastError();
 
     memset(out, 0, sizeof(*out));
 
@@ -801,7 +805,7 @@ int qemudDispatch(struct qemud_server *s
 
     if (!funcs[type]) {
         qemudDebug("Illegal operation requested");
-        qemudReportError(server, VIR_ERR_OPERATION_DENIED, NULL);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_DENIED, NULL);
         qemudDispatchFailure(server, client, out);
     } else {
         if ((funcs[type])(server, client, in, out) < 0) {
diff -r 8ca0822730db qemud/driver.c
--- a/qemud/driver.c	Sun Jun 17 19:37:57 2007 -0400
+++ b/qemud/driver.c	Sun Jun 17 22:11:09 2007 -0400
@@ -50,17 +50,35 @@
 #include "driver.h"
 #include "conf.h"
 
-void qemudReportError(struct qemud_server *server,
+extern void __virRaiseError(virConnectPtr conn,
+                            virDomainPtr dom,
+                            virNetworkPtr net,
+                            int domain,
+                            int code,
+                            virErrorLevel level,
+                            const char *str1,
+                            const char *str2,
+                            const char *str3,
+                            int int1, int int2, const char *msg, ...)
+  ATTRIBUTE_FORMAT(printf, 12, 13);
+
+void qemudReportError(virConnectPtr conn,
+                      virDomainPtr dom,
+                      virNetworkPtr net,
                       int code, const char *fmt, ...) {
     va_list args;
-    server->errorCode = code;
+    char errorMessage[QEMUD_MAX_ERROR_LEN];
+
     if (fmt) {
         va_start(args, fmt);
-        vsnprintf(server->errorMessage, QEMUD_MAX_ERROR_LEN-1, fmt, args);
+        vsnprintf(errorMessage, QEMUD_MAX_ERROR_LEN-1, fmt, args);
         va_end(args);
     } else {
-        server->errorMessage[0] = '\0';
-    }
+        errorMessage[0] = '\0';
+    }
+
+    __virRaiseError(conn, dom, net, VIR_FROM_QEMU, code, VIR_ERR_ERROR,
+                    NULL, NULL, NULL, -1, -1, errorMessage);
 }
 
 static void qemudDispatchVMEvent(int fd, int events, void *opaque);
@@ -131,20 +149,20 @@ qemudExec(struct qemud_server *server, c
     int pipeerr[2] = {-1,-1};
 
     if ((null = open(_PATH_DEVNULL, O_RDONLY)) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot open %s : %s",
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot open %s : %s",
                          _PATH_DEVNULL, strerror(errno));
         goto cleanup;
     }
 
     if ((outfd != NULL && pipe(pipeout) < 0) ||
         (errfd != NULL && pipe(pipeerr) < 0)) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot create pipe : %s",
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot create pipe : %s",
                          strerror(errno));
         goto cleanup;
     }
 
     if ((pid = fork()) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot fork child process : %s",
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot fork child process : %s",
                          strerror(errno));
         goto cleanup;
     }
@@ -233,7 +251,7 @@ qemudReadMonitorOutput(struct qemud_serv
 
         ret = read(fd, buf+got, buflen-got-1);
         if (ret == 0) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "QEMU quit during %s startup\n%s", what, buf);
             return -1;
         }
@@ -243,7 +261,7 @@ qemudReadMonitorOutput(struct qemud_serv
                 continue;
 
             if (errno != EAGAIN) {
-                qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  "Failure while reading %s startup output: %s",
                                  what, strerror(errno));
                 return -1;
@@ -251,12 +269,12 @@ qemudReadMonitorOutput(struct qemud_serv
 
             ret = poll(&pfd, 1, MONITOR_TIMEOUT);
             if (ret == 0) {
-                qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  "Timed out while reading %s startup output", what);
                 return -1;
             } else if (ret == -1) {
                 if (errno != EINTR) {
-                    qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                    qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                      "Failure while reading %s startup output: %s",
                                      what, strerror(errno));
                     return -1;
@@ -267,7 +285,7 @@ qemudReadMonitorOutput(struct qemud_serv
                 if (pfd.revents & (POLLIN | POLLHUP))
                     continue;
 
-                qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+                qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                                  "Failure while reading %s startup output", what);
                 return -1;
             }
@@ -279,7 +297,7 @@ qemudReadMonitorOutput(struct qemud_serv
         }
     }
 
-    qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+    qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                      "Out of space while reading %s startup output", what);
     return -1;
 
@@ -306,17 +324,17 @@ static int qemudOpenMonitor(struct qemud
     int ret = -1;
 
     if (!(monfd = open(monitor, O_RDWR))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "Unable to open monitor path %s", monitor);
         return -1;
     }
     if (qemudSetCloseExec(monfd) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "Unable to set monitor close-on-exec flag");
         goto error;
     }
     if (qemudSetNonBlock(monfd) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "Unable to put monitor into non-blocking mode");
         goto error;
     }
@@ -437,7 +455,7 @@ int qemudStartVMDaemon(struct qemud_serv
     char logfile[PATH_MAX];
 
     if (qemudIsActiveVM(vm)) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "VM is already active");
         return -1;
     }
@@ -445,7 +463,7 @@ int qemudStartVMDaemon(struct qemud_serv
     if (vm->def->vncPort < 0) {
         int port = qemudNextFreeVNCPort(server);
         if (port < 0) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Unable to find an unused VNC port");
             return -1;
         }
@@ -458,7 +476,7 @@ int qemudStartVMDaemon(struct qemud_serv
          strlen(vm->def->name) + /* basename */
          4 + /* suffix .log */
          1 /* NULL */) > PATH_MAX) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "config file path too long: %s/%s.log",
                          server->logDir, vm->def->name);
         return -1;
@@ -469,7 +487,7 @@ int qemudStartVMDaemon(struct qemud_serv
     strcat(logfile, ".log");
 
     if (qemudEnsureDir(server->logDir) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot create log directory %s: %s",
                          server->logDir, strerror(errno));
         return -1;
@@ -477,7 +495,7 @@ int qemudStartVMDaemon(struct qemud_serv
 
     if ((vm->logfile = open(logfile, O_CREAT | O_TRUNC | O_WRONLY,
                             S_IRUSR | S_IWUSR)) < 0) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to create logfile %s: %s",
                          logfile, strerror(errno));
         return -1;
@@ -740,7 +758,7 @@ qemudBuildDnsmasqArgv(struct qemud_serve
             free((*argv)[i]);
         free(*argv);
     }
-    qemudReportError(server, VIR_ERR_NO_MEMORY, "dnsmasq argv");
+    qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "dnsmasq argv");
     return -1;
 }
 
@@ -753,7 +771,7 @@ dhcpStartDhcpDaemon(struct qemud_server 
     int ret, i;
 
     if (network->def->ipAddress[0] == '\0') {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot start dhcp daemon without IP address for server");
         return -1;
     }
@@ -777,21 +795,21 @@ qemudAddIptablesRules(struct qemud_serve
     int err;
 
     if (!server->iptables && !(server->iptables = iptablesContextNew())) {
-        qemudReportError(server, VIR_ERR_NO_MEMORY, "iptables support");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, "iptables support");
         return 1;
     }
 
 
     /* allow DHCP requests through to dnsmasq */
     if ((err = iptablesAddTcpInput(server->iptables, network->bridge, 67))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to add iptables rule to allow DHCP requests from '%s' : %s\n",
                          network->bridge, strerror(err));
         goto err1;
     }
 
     if ((err = iptablesAddUdpInput(server->iptables, network->bridge, 67))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to add iptables rule to allow DHCP requests from '%s' : %s\n",
                          network->bridge, strerror(err));
         goto err2;
@@ -799,14 +817,14 @@ qemudAddIptablesRules(struct qemud_serve
 
     /* allow DNS requests through to dnsmasq */
     if ((err = iptablesAddTcpInput(server->iptables, network->bridge, 53))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to add iptables rule to allow DNS requests from '%s' : %s\n",
                          network->bridge, strerror(err));
         goto err3;
     }
 
     if ((err = iptablesAddUdpInput(server->iptables, network->bridge, 53))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to add iptables rule to allow DNS requests from '%s' : %s\n",
                          network->bridge, strerror(err));
         goto err4;
@@ -816,14 +834,14 @@ qemudAddIptablesRules(struct qemud_serve
     /* Catch all rules to block forwarding to/from bridges */
 
     if ((err = iptablesAddForwardRejectOut(server->iptables, network->bridge))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to add iptables rule to block outbound traffic from '%s' : %s\n",
                          network->bridge, strerror(err));
         goto err5;
     }
 
     if ((err = iptablesAddForwardRejectIn(server->iptables, network->bridge))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to add iptables rule to block inbound traffic to '%s' : %s\n",
                          network->bridge, strerror(err));
         goto err6;
@@ -831,7 +849,7 @@ qemudAddIptablesRules(struct qemud_serve
 
     /* Allow traffic between guests on the same bridge */
     if ((err = iptablesAddForwardAllowCross(server->iptables, network->bridge))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to add iptables rule to allow cross bridge traffic on '%s' : %s\n",
                          network->bridge, strerror(err));
         goto err7;
@@ -847,7 +865,7 @@ qemudAddIptablesRules(struct qemud_serve
                                           network->def->network,
                                           network->bridge,
                                           network->def->forwardDev))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to add iptables rule to allow forwarding from '%s' : %s\n",
                          network->bridge, strerror(err));
         goto err8;
@@ -858,7 +876,7 @@ qemudAddIptablesRules(struct qemud_serve
                                          network->def->network,
                                          network->bridge,
                                          network->def->forwardDev))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to add iptables rule to allow forwarding to '%s' : %s\n",
                          network->bridge, strerror(err));
         goto err9;
@@ -868,7 +886,7 @@ qemudAddIptablesRules(struct qemud_serve
     if ((err = iptablesAddForwardMasquerade(server->iptables,
                                             network->def->network,
                                             network->def->forwardDev))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to add iptables rule to enable masquerading : %s\n",
                          strerror(err));
         goto err10;
@@ -958,13 +976,13 @@ int qemudStartNetworkDaemon(struct qemud
     int err;
 
     if (qemudIsActiveNetwork(network)) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "network is already active");
         return -1;
     }
 
     if (!server->brctl && (err = brInit(&server->brctl))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot initialize bridge support: %s", strerror(err));
         return -1;
     }
@@ -977,14 +995,14 @@ int qemudStartNetworkDaemon(struct qemud
     }
 
     if ((err = brAddBridge(server->brctl, name, network->bridge, sizeof(network->bridge)))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot create bridge '%s' : %s", name, strerror(err));
         return -1;
     }
 
     if (network->def->ipAddress[0] &&
         (err = brSetInetAddress(server->brctl, network->bridge, network->def->ipAddress))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot set IP address on bridge '%s' to '%s' : %s\n",
                          network->bridge, network->def->ipAddress, strerror(err));
         goto err_delbr;
@@ -992,7 +1010,7 @@ int qemudStartNetworkDaemon(struct qemud
 
     if (network->def->netmask[0] &&
         (err = brSetInetNetmask(server->brctl, network->bridge, network->def->netmask))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "cannot set netmask on bridge '%s' to '%s' : %s\n",
                          network->bridge, network->def->netmask, strerror(err));
         goto err_delbr;
@@ -1000,7 +1018,7 @@ int qemudStartNetworkDaemon(struct qemud
 
     if (network->def->ipAddress[0] &&
         (err = brSetInterfaceUp(server->brctl, network->bridge, 1))) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to bring the bridge '%s' up : %s\n",
                          network->bridge, strerror(err));
         goto err_delbr;
@@ -1011,7 +1029,7 @@ int qemudStartNetworkDaemon(struct qemud
 
     if (network->def->forward &&
         !qemudEnableIpForwarding()) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                          "failed to enable IP forwarding : %s\n", strerror(err));
         goto err_delbr2;
     }
@@ -1299,7 +1317,7 @@ char *qemudGetCapabilities(struct qemud_
     /* Construct the XML. */
     xml = bufferNew (1024);
     if (!xml) {
-        qemudReportError (server, VIR_ERR_NO_MEMORY, NULL);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, NULL);
         return NULL;
     }
 
@@ -1315,7 +1333,7 @@ char *qemudGetCapabilities(struct qemud_
     if (r == -1) {
     vir_buffer_failed:
         bufferFree (xml);
-        qemudReportError (server, VIR_ERR_NO_MEMORY, NULL);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_NO_MEMORY, NULL);
         return NULL;
     }
 
@@ -1556,18 +1574,18 @@ int qemudDomainSuspend(struct qemud_serv
     char *info;
     struct qemud_vm *vm = qemudFindVMByID(server, id);
     if (!vm) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
         return -1;
     }
     if (!qemudIsActiveVM(vm)) {
-        qemudReportError(server, VIR_ERR_OPERATION_FAILED, "domain is not running");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "domain is not running");
         return -1;
     }
     if (vm->state == QEMUD_STATE_PAUSED)
         return 0;
 
     if (qemudMonitorCommand(server, vm, "stop\n", &info) < 0) {
-        qemudReportError(server, VIR_ERR_OPERATION_FAILED, "suspend operation failed");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "suspend operation failed");
         return -1;
     }
     vm->state = QEMUD_STATE_PAUSED;
@@ -1581,17 +1599,17 @@ int qemudDomainResume(struct qemud_serve
     char *info;
     struct qemud_vm *vm = qemudFindVMByID(server, id);
     if (!vm) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
         return -1;
     }
     if (!qemudIsActiveVM(vm)) {
-        qemudReportError(server, VIR_ERR_OPERATION_FAILED, "domain is not running");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "domain is not running");
         return -1;
     }
     if (vm->state == QEMUD_STATE_RUNNING)
         return 0;
     if (qemudMonitorCommand(server, vm, "cont\n", &info) < 0) {
-        qemudReportError(server, VIR_ERR_OPERATION_FAILED, "resume operation failed");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "resume operation failed");
         return -1;
     }
     vm->state = QEMUD_STATE_RUNNING;
@@ -1605,7 +1623,7 @@ int qemudDomainDestroy(struct qemud_serv
     struct qemud_vm *vm = qemudFindVMByID(server, id);
 
     if (!vm) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN,
                          "no domain with matching id %d", id);
         return -1;
     }
@@ -1622,7 +1640,7 @@ int qemudDomainGetInfo(struct qemud_serv
                        unsigned int *nrVirtCpu) {
     struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
     if (!vm) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
         return -1;
     }
 
@@ -1632,7 +1650,7 @@ int qemudDomainGetInfo(struct qemud_serv
         *cputime = 0;
     } else {
         if (qemudGetProcessInfo(cputime, vm->pid) < 0) {
-            qemudReportError(server, VIR_ERR_OPERATION_FAILED, "cannot read cputime for domain");
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "cannot read cputime for domain");
             return -1;
         }
     }
@@ -1648,21 +1666,21 @@ int qemudDomainSave(struct qemud_server 
                     const char *path ATTRIBUTE_UNUSED) {
     struct qemud_vm *vm = qemudFindVMByID(server, id);
     if (!vm) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching id %d", id);
         return -1;
     }
     if (!qemudIsActiveVM(vm)) {
-        qemudReportError(server, VIR_ERR_OPERATION_FAILED, "domain is not running");
-        return -1;
-    }
-    qemudReportError(server, VIR_ERR_OPERATION_FAILED, "save is not supported");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "domain is not running");
+        return -1;
+    }
+    qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "save is not supported");
     return -1;
 }
 
 
 int qemudDomainRestore(struct qemud_server *server,
                        const char *path ATTRIBUTE_UNUSED) {
-    qemudReportError(server, VIR_ERR_OPERATION_FAILED, "restore is not supported");
+    qemudReportError(NULL, NULL, NULL, VIR_ERR_OPERATION_FAILED, "restore is not supported");
     return -1;
 }
 
@@ -1671,7 +1689,7 @@ int qemudDomainDumpXML(struct qemud_serv
     struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
     char *vmxml;
     if (!vm) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
         return -1;
     }
 
@@ -1712,7 +1730,7 @@ struct qemud_vm *qemudDomainStart(struct
     struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
 
     if (!vm) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN,
                          "no domain with matching uuid");
         return NULL;
     }
@@ -1745,12 +1763,12 @@ int qemudDomainUndefine(struct qemud_ser
     struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
 
     if (!vm) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
         return -1;
     }
 
     if (qemudIsActiveVM(vm)) {
-        qemudReportError(server, VIR_ERR_INTERNAL_ERROR, "cannot delete active domain");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "cannot delete active domain");
         return -1;
     }
 
@@ -1775,7 +1793,7 @@ int qemudDomainGetAutostart(struct qemud
     struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
 
     if (!vm) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
         return -1;
     }
 
@@ -1790,7 +1808,7 @@ int qemudDomainSetAutostart(struct qemud
     struct qemud_vm *vm = qemudFindVMByUUID(server, uuid);
 
     if (!vm) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no domain with matching uuid");
         return -1;
     }
 
@@ -1803,21 +1821,21 @@ int qemudDomainSetAutostart(struct qemud
         int err;
 
         if ((err = qemudEnsureDir(server->autostartDir))) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "cannot create autostart directory %s: %s",
                              server->autostartDir, strerror(err));
             return -1;
         }
 
         if (symlink(vm->configFile, vm->autostartLink) < 0) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Failed to create symlink '%s' to '%s': %s",
                              vm->autostartLink, vm->configFile, strerror(errno));
             return -1;
         }
     } else {
         if (unlink(vm->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Failed to delete symlink '%s': %s",
                              vm->autostartLink, strerror(errno));
             return -1;
@@ -1935,7 +1953,7 @@ int qemudNetworkUndefine(struct qemud_se
     struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
 
     if (!network) {
-        qemudReportError(server, VIR_ERR_INVALID_DOMAIN, "no network with matching uuid");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_DOMAIN, "no network with matching uuid");
         return -1;
     }
 
@@ -1958,7 +1976,7 @@ struct qemud_network *qemudNetworkStart(
     struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
 
     if (!network) {
-        qemudReportError(server, VIR_ERR_INVALID_NETWORK,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK,
                          "no network with matching uuid");
         return NULL;
     }
@@ -1970,7 +1988,7 @@ int qemudNetworkDestroy(struct qemud_ser
     struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
 
     if (!network) {
-        qemudReportError(server, VIR_ERR_INVALID_NETWORK,
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK,
                          "no network with matching uuid");
         return -1;
     }
@@ -1982,7 +2000,7 @@ int qemudNetworkDumpXML(struct qemud_ser
     struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
     char *networkxml;
     if (!network) {
-        qemudReportError(server, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
         return -1;
     }
 
@@ -2002,7 +2020,7 @@ int qemudNetworkGetBridgeName(struct qem
     struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
 
     if (!network) {
-        qemudReportError(server, VIR_ERR_INVALID_NETWORK, "no network with matching id");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK, "no network with matching id");
         return -1;
     }
 
@@ -2018,7 +2036,7 @@ int qemudNetworkGetAutostart(struct qemu
     struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
 
     if (!network) {
-        qemudReportError(server, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
         return -1;
     }
 
@@ -2033,7 +2051,7 @@ int qemudNetworkSetAutostart(struct qemu
     struct qemud_network *network = qemudFindNetworkByUUID(server, uuid);
 
     if (!network) {
-        qemudReportError(server, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
+        qemudReportError(NULL, NULL, NULL, VIR_ERR_INVALID_NETWORK, "no network with matching uuid");
         return -1;
     }
 
@@ -2046,21 +2064,21 @@ int qemudNetworkSetAutostart(struct qemu
         int err;
 
         if ((err = qemudEnsureDir(server->networkAutostartDir))) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "cannot create autostart directory %s: %s",
                              server->networkAutostartDir, strerror(err));
             return -1;
         }
 
         if (symlink(network->configFile, network->autostartLink) < 0) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Failed to create symlink '%s' to '%s': %s",
                              network->autostartLink, network->configFile, strerror(errno));
             return -1;
         }
     } else {
         if (unlink(network->autostartLink) < 0 && errno != ENOENT && errno != ENOTDIR) {
-            qemudReportError(server, VIR_ERR_INTERNAL_ERROR,
+            qemudReportError(NULL, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
                              "Failed to delete symlink '%s': %s",
                              network->autostartLink, strerror(errno));
             return -1;
diff -r 8ca0822730db qemud/driver.h
--- a/qemud/driver.h	Sun Jun 17 19:37:57 2007 -0400
+++ b/qemud/driver.h	Sun Jun 17 22:11:09 2007 -0400
@@ -43,9 +43,11 @@ void qemudReload(struct qemud_server *se
 void qemudReload(struct qemud_server *server);
 void qemudShutdown(struct qemud_server *server);
 
-void qemudReportError(struct qemud_server *server,
+void qemudReportError(virConnectPtr conn,
+                      virDomainPtr dom,
+                      virNetworkPtr net,
                       int code, const char *fmt, ...)
-    ATTRIBUTE_FORMAT(printf,3,4);
+    ATTRIBUTE_FORMAT(printf,5,6);
 
 int qemudGetNodeInfo(unsigned int *memory,
                      char *cpuModel, int cpuModelLength,
diff -r 8ca0822730db qemud/internal.h
--- a/qemud/internal.h	Sun Jun 17 19:37:57 2007 -0400
+++ b/qemud/internal.h	Sun Jun 17 22:11:09 2007 -0400
@@ -353,8 +353,6 @@ struct qemud_server {
     char *networkConfigDir;
     char *networkAutostartDir;
     char logDir[PATH_MAX];
-    char errorMessage[QEMUD_MAX_ERROR_LEN];
-    int errorCode;
     unsigned int shutdown : 1;
 };
 

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