[libvirt] [PATCH] minor usb masstorage hotadd cleanup
by Guido Günther
Hi,
this just brings qemudDomainAttachUsbMassstorageDevice in line with the
rest of the code:
* don't allow to add the same target device name more than once
* escape paths for qemu's monitor command
Cheers,
-- Guido
16 years
[libvirt] [PATCH 00/12] Domain Events - Round 2
by Ben Guthro
The following patch series implements the Events API discussed here previously in this thread:
http://www.redhat.com/archives/libvir-list/2008-September/msg00321.html and
http://www.redhat.com/archives/libvir-list/2008-October/msg00245.html
By Daniel B's advice - I have broken this patch into the following:
events-01-public-api Changes to libvirt.h, and libvirt.c
events-02-internal-api Changes to internal.h and event code
events-03-qemud Changes to the daemon
events-04-qemud-rpc-protocol Changes to the qemud rpc protocol
events-05-driver.patch Changes to the driver API
events-06-driver-qemu Changes to the qemu driver
events-07-driver-remote Changes to the remote driver
events-08-driver-lxc Minor changes to LXC driver structure to prevent compile errors
events-09-driver-openvz Minor changes to openvz driver structure to prevent compile errors
events-10-driver-test Minor changes to test driver structure to prevent compile errors
events-11-example-testapp Test app, and infrastructure changes for an example dir
events-12-python-ignore.patch Add functions to be ignored, for now
For now, domain events are only emitted from qemu/kvm guests.
16 years
[libvirt] [PATCH 5/5]: Export <device> when doing logical pool discovery
by Chris Lalancette
When doing logical pool discovery, it currently returns XML like:
<sources><source><name>myvg</name></source></sources>
However, for oVirt, we need to know the device name that corresponds to this
logical volume group as well. Therefore, extend the
virStorageBackendLogicalFindPoolSources function to return this information as
well. This required pretty much a complete rewrite of the discovery function,
since I needed to be able to add <device> sections to already existing XML
nodes. For that reason, this code uses direct libxml2 tree API's to handle the
parsing and the adding of nodes where necessary.
Signed-off-by: Chris Lalancette <clalance(a)redhat.com>
16 years
[libvirt] [PATCH 0/5]: Logical backend fixes and cleanups
by Chris Lalancette
All,
This series of 5 patches fixes a couple of issues with the logical backend
implementation, and also extends the xml returned by
find-storage-pool-sources-as logical to also return the <device>'s that a
logical backend is made of. Patches 1 - 4 do the cleanup, while patch 5
implements the <device> addition to the find-storage-pool-sources.
--
Chris Lalancette
16 years
[libvirt] FYI; warning while compiling lxc_driver.c
by Chris Lalancette
Just wanted to give a heads up that the LXC driver spits a warning when
compiling on i686; the exact warning is:
gcc -DHAVE_CONFIG_H -I. -I.. -I../gnulib/lib -I../gnulib/lib -I../include
-I../include -I../qemud -I/usr/include/libxml2 -DBINDIR=\"/usr/libexec\"
-DSBINDIR=\"/usr/sbin\" -DSYSCONF_DIR=\"/etc\"
-DLOCALEBASEDIR=\"/usr/share/locale\" -DLOCAL_STATE_DIR=\"/var\"
-DGETTEXT_PACKAGE=\"libvirt\" -Wall -Wformat -Wformat-security
-Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wextra -Wshadow
-Wcast-align -Wwrite-strings -Waggregate-return -Wstrict-prototypes -Winline
-Wredundant-decls -Wno-sign-compare -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fasynchronous-unwind-tables -DWITH_OPENVZ -DWITH_LXC -DWITH_QEMU -DWITH_TEST
-DWITH_REMOTE -DWITH_LIBVIRTD -DWITH_XEN -DIN_LIBVIRT -g -O2 -MT
libvirt_la-lxc_driver.lo -MD -MP -MF .deps/libvirt_la-lxc_driver.Tpo -c
lxc_driver.c -fPIC -DPIC -o .libs/libvirt_la-lxc_driver.o
lxc_driver.c: In function 'lxcGetSchedulerParameters':
lxc_driver.c:1211: warning: dereferencing type-punned pointer will break
strict-aliasing rules
Generally I would go and fix such things, but I didn't spend any time to look at
the code, and I don't have an LXC environment handy to test on, so I didn't want
to break anything. I just thought I would point it out.
--
Chris Lalancette
16 years
[libvirt] PATCH: Pass 'remote_error' object to RPC handlers
by Daniel P. Berrange
In the libvirtd daemon, remote.c file the current RPC handlers have
a return value contract saying
0 - success
-1 - failure in libvirt call, no error returned
-2 - failure in dispatch process, error already serialized & sent
While this isn't a problem for the code as it stands today, for the thread
support I want to be able to avoid the dispatch handlers having to touch
the 'struct qemud_client' object in normal usage. Allowing the RPC
handlers to directly serialize & send the error makes this impossible
because it requires access to the client object.
So this patch changes the way the RPC handlers deal with errors. The
RPC handler API changes from
typedef int (*dispatch_fn) (struct qemud_server *server,
struct qemud_client *client,
dispatch_args *args,
dispatch_ret *ret);
To
typedef int (*dispatch_fn) (struct qemud_server *server,
struct qemud_client *client,
remote_error *err,
dispatch_args *args,
dispatch_ret *ret);
Note, the addition of a 'remote_error *err' argument. Whenever an error
occurs during the dispatch process, the RPC handler must populate this
'remote_error *err' object with the error details. This rule applies
whether its a libvirt error, or a dispatch process error, so there is
no longer any need to have separate -1 or -2 return values, a simple
-1 or 0 return value suffices.
qemud/qemud.c | 12
qemud/qemud.h | 5
qemud/remote.c | 1450 +++++++++++++++++++------------------
qemud/remote_dispatch_prototypes.h | 208 ++---
qemud/remote_generate_stubs.pl | 2
src/domain_conf.c | 8
6 files changed, 896 insertions(+), 789 deletions(-)
This is a rather ugly / unreadable patch I'm afraid - its worth also
looking at the complete before & after code to understand it better.
Daniel
diff --git a/qemud/qemud.c b/qemud/qemud.c
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -1324,13 +1324,12 @@ static int qemudClientRead(struct qemud_
static void qemudDispatchClientRead(struct qemud_server *server, struct qemud_client *client) {
-
+ unsigned int len;
/*qemudDebug ("qemudDispatchClientRead: mode = %d", client->mode);*/
switch (client->mode) {
case QEMUD_MODE_RX_HEADER: {
XDR x;
- unsigned int len;
if (qemudClientRead(server, client) < 0)
return; /* Error, or blocking */
@@ -1381,7 +1380,14 @@ static void qemudDispatchClientRead(stru
if (client->bufferOffset < client->bufferLength)
return; /* Not read enough */
- remoteDispatchClientRequest (server, client);
+ if ((len = remoteDispatchClientRequest (server, client)) == 0)
+ qemudDispatchClientFailure(server, client);
+
+ /* Set up the output buffer. */
+ client->mode = QEMUD_MODE_TX_PACKET;
+ client->bufferLength = len;
+ client->bufferOffset = 0;
+
if (qemudRegisterClientEvent(server, client, 1) < 0)
qemudDispatchClientFailure(server, client);
diff --git a/qemud/qemud.h b/qemud/qemud.h
--- a/qemud/qemud.h
+++ b/qemud/qemud.h
@@ -174,8 +174,9 @@ void qemudLog(int priority, const char *
#define qemudDebug(fmt, ...) do {} while(0)
#endif
-void remoteDispatchClientRequest (struct qemud_server *server,
- struct qemud_client *client);
+unsigned int
+remoteDispatchClientRequest (struct qemud_server *server,
+ struct qemud_client *client);
#if HAVE_POLKIT
int qemudGetSocketIdentity(int fd, uid_t *uid, pid_t *pid);
diff --git a/qemud/remote.c b/qemud/remote.c
--- a/qemud/remote.c
+++ b/qemud/remote.c
@@ -54,10 +54,9 @@
#define REMOTE_DEBUG(fmt,...) qemudDebug("REMOTE: " fmt, __VA_ARGS__)
-static void remoteDispatchError (struct qemud_client *client,
- remote_message_header *req,
- const char *fmt, ...)
- ATTRIBUTE_FORMAT(printf, 3, 4);
+static void remoteDispatchFormatError (remote_error *rerr,
+ const char *fmt, ...)
+ ATTRIBUTE_FORMAT(printf, 2, 3);
static virDomainPtr get_nonnull_domain (virConnectPtr conn, remote_nonnull_domain domain);
static virNetworkPtr get_nonnull_network (virConnectPtr conn, remote_nonnull_network network);
static virStoragePoolPtr get_nonnull_storage_pool (virConnectPtr conn, remote_nonnull_storage_pool pool);
@@ -80,7 +79,7 @@ typedef union {
typedef int (*dispatch_fn) (struct qemud_server *server,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *err,
dispatch_args *args,
dispatch_ret *ret);
@@ -94,59 +93,151 @@ static const dispatch_data const dispatc
#include "remote_dispatch_table.h"
};
+
+/* Convert a libvirt virError object into wire format */
+static void
+remoteDispatchCopyError (remote_error *rerr,
+ virErrorPtr verr)
+{
+ rerr->code = verr->code;
+ rerr->domain = verr->domain;
+ rerr->message = verr->message ? malloc(sizeof(char*)) : NULL;
+ if (rerr->message) *rerr->message = strdup(verr->message);
+ rerr->level = verr->level;
+ rerr->str1 = verr->str1 ? malloc(sizeof(char*)) : NULL;
+ if (rerr->str1) *rerr->str1 = strdup(verr->str1);
+ rerr->str2 = verr->str2 ? malloc(sizeof(char*)) : NULL;
+ if (rerr->str2) *rerr->str2 = strdup(verr->str2);
+ rerr->str3 = verr->str3 ? malloc(sizeof(char*)) : NULL;
+ if (rerr->str3) *rerr->str3 = strdup(verr->str3);
+ rerr->int1 = verr->int1;
+ rerr->int2 = verr->int2;
+}
+
+
+/* A set of helpers for sending back errors to client
+ in various ways .... */
+
+static void
+remoteDispatchStringError (remote_error *rerr,
+ int code, const char *msg)
+{
+ virError verr;
+
+ memset(&verr, 0, sizeof verr);
+
+ /* Construct the dummy libvirt virError. */
+ verr.code = code;
+ verr.domain = VIR_FROM_REMOTE;
+ verr.message = (char *)msg;
+ verr.level = VIR_ERR_ERROR;
+ verr.str1 = (char *)msg;
+
+ remoteDispatchCopyError(rerr, &verr);
+}
+
+static void
+remoteDispatchAuthError (remote_error *rerr)
+{
+ remoteDispatchStringError (rerr, VIR_ERR_AUTH_FAILED, "authentication failed");
+}
+
+static void
+remoteDispatchFormatError (remote_error *rerr,
+ const char *fmt, ...)
+{
+ va_list args;
+ char msgbuf[1024];
+ char *msg = msgbuf;
+
+ va_start (args, fmt);
+ vsnprintf (msgbuf, sizeof msgbuf, fmt, args);
+ va_end (args);
+
+ remoteDispatchStringError (rerr, VIR_ERR_RPC, msg);
+}
+
+static void
+remoteDispatchGenericError (remote_error *rerr)
+{
+ remoteDispatchStringError(rerr,
+ VIR_ERR_INTERNAL_ERROR,
+ "library function returned error but did not set virterror");
+}
+
+static void
+remoteDispatchOOMError (remote_error *rerr)
+{
+ remoteDispatchStringError(rerr,
+ VIR_ERR_NO_MEMORY,
+ NULL);
+}
+
+static void
+remoteDispatchConnError (remote_error *rerr,
+ virConnectPtr conn)
+{
+ virErrorPtr verr;
+
+ if (conn)
+ verr = virConnGetLastError(conn);
+ else
+ verr = virGetLastError();
+ if (verr)
+ remoteDispatchCopyError(rerr, verr);
+ else
+ remoteDispatchGenericError(rerr);
+}
+
+
/* This function gets called from qemud when it detects an incoming
* remote protocol message. At this point, client->buffer contains
* the full call message (including length word which we skip).
*/
-void
+unsigned int
remoteDispatchClientRequest (struct qemud_server *server,
struct qemud_client *client)
{
XDR xdr;
remote_message_header req, rep;
+ remote_error rerr;
dispatch_args args;
dispatch_ret ret;
const dispatch_data *data = NULL;
- int rv, len;
+ int rv = -1, len;
memset(&args, 0, sizeof args);
memset(&ret, 0, sizeof ret);
+ memset(&rerr, 0, sizeof rerr);
/* Parse the header. */
xdrmem_create (&xdr, client->buffer, client->bufferLength, XDR_DECODE);
- if (!xdr_remote_message_header (&xdr, &req)) {
- remoteDispatchError (client, NULL, "%s", _("xdr_remote_message_header"));
- xdr_destroy (&xdr);
- return;
- }
+ if (!xdr_remote_message_header (&xdr, &req))
+ goto fatal_error;
/* Check version, etc. */
if (req.prog != REMOTE_PROGRAM) {
- remoteDispatchError (client, &req,
- _("program mismatch (actual %x, expected %x)"),
- req.prog, REMOTE_PROGRAM);
- xdr_destroy (&xdr);
- return;
+ remoteDispatchFormatError (&rerr,
+ _("program mismatch (actual %x, expected %x)"),
+ req.prog, REMOTE_PROGRAM);
+ goto rpc_error;
}
if (req.vers != REMOTE_PROTOCOL_VERSION) {
- remoteDispatchError (client, &req,
- _("version mismatch (actual %x, expected %x)"),
- req.vers, REMOTE_PROTOCOL_VERSION);
- xdr_destroy (&xdr);
- return;
+ remoteDispatchFormatError (&rerr,
+ _("version mismatch (actual %x, expected %x)"),
+ req.vers, REMOTE_PROTOCOL_VERSION);
+ goto rpc_error;
}
if (req.direction != REMOTE_CALL) {
- remoteDispatchError (client, &req, _("direction (%d) != REMOTE_CALL"),
- (int) req.direction);
- xdr_destroy (&xdr);
- return;
+ remoteDispatchFormatError (&rerr, _("direction (%d) != REMOTE_CALL"),
+ (int) req.direction);
+ goto rpc_error;
}
if (req.status != REMOTE_OK) {
- remoteDispatchError (client, &req, _("status (%d) != REMOTE_OK"),
- (int) req.status);
- xdr_destroy (&xdr);
- return;
+ remoteDispatchFormatError (&rerr, _("status (%d) != REMOTE_OK"),
+ (int) req.status);
+ goto rpc_error;
}
/* If client is marked as needing auth, don't allow any RPC ops,
@@ -159,47 +250,35 @@ remoteDispatchClientRequest (struct qemu
req.proc != REMOTE_PROC_AUTH_SASL_STEP &&
req.proc != REMOTE_PROC_AUTH_POLKIT
) {
- remoteDispatchError (client, &req, "%s", _("authentication required"));
- xdr_destroy (&xdr);
- return;
+ /* Explicitly *NOT* calling remoteDispatchAuthError() because
+ we want back-compatability with libvirt clients which don't
+ support the VIR_ERR_AUTH_FAILED error code */
+ remoteDispatchFormatError (&rerr, "%s", _("authentication required"));
+ goto rpc_error;
}
}
if (req.proc >= ARRAY_CARDINALITY(dispatch_table) ||
dispatch_table[req.proc].fn == NULL) {
- remoteDispatchError (client, &req, _("unknown procedure: %d"),
- req.proc);
- xdr_destroy (&xdr);
- return;
+ remoteDispatchFormatError (&rerr, _("unknown procedure: %d"),
+ req.proc);
+ goto rpc_error;
}
data = &(dispatch_table[req.proc]);
/* De-serialize args off the wire */
if (!((data->args_filter)(&xdr, &args))) {
- remoteDispatchError (client, &req, "%s", _("parse args failed"));
- xdr_destroy (&xdr);
+ remoteDispatchFormatError (&rerr, "%s", _("parse args failed"));
+ goto rpc_error;
}
- xdr_destroy (&xdr);
-
/* Call function. */
- rv = (data->fn)(server, client, &req, &args, &ret);
+ rv = (data->fn)(server, client, &rerr, &args, &ret);
xdr_free (data->args_filter, (char*)&args);
- /* Dispatch function must return -2, -1 or 0. Anything else is
- * an internal error.
- */
- if (rv < -2 || rv > 0) {
- remoteDispatchError (client, &req,
- _("internal error - dispatch function returned invalid code %d"), rv);
- return;
- }
-
- /* Dispatch error? If so then the function has already set up the
- * return buffer, so just return immediately.
- */
- if (rv == -2) return;
+rpc_error:
+ xdr_destroy (&xdr);
/* Return header. */
rep.prog = req.prog;
@@ -207,226 +286,61 @@ remoteDispatchClientRequest (struct qemu
rep.proc = req.proc;
rep.direction = REMOTE_REPLY;
rep.serial = req.serial;
- rep.status = rv == 0 ? REMOTE_OK : REMOTE_ERROR;
+ rep.status = rv < 0 ? REMOTE_ERROR : REMOTE_OK;
/* Serialise the return header. */
xdrmem_create (&xdr, client->buffer, sizeof client->buffer, XDR_ENCODE);
len = 0; /* We'll come back and write this later. */
if (!xdr_int (&xdr, &len)) {
- remoteDispatchError (client, &req, "%s", _("dummy length"));
- xdr_destroy (&xdr);
if (rv == 0) xdr_free (data->ret_filter, (char*)&ret);
- return;
+ goto fatal_error;
}
if (!xdr_remote_message_header (&xdr, &rep)) {
- remoteDispatchError (client, &req, "%s", _("serialise reply header"));
- xdr_destroy (&xdr);
if (rv == 0) xdr_free (data->ret_filter, (char*)&ret);
- return;
+ goto fatal_error;
}
/* If OK, serialise return structure, if error serialise error. */
- if (rv == 0) {
- if (!((data->ret_filter) (&xdr, &ret))) {
- remoteDispatchError (client, &req, "%s", _("serialise return struct"));
- xdr_destroy (&xdr);
- return;
- }
+ if (rv >= 0) {
+ if (!((data->ret_filter) (&xdr, &ret)))
+ goto fatal_error;
xdr_free (data->ret_filter, (char*)&ret);
} else /* error */ {
- virErrorPtr verr;
- remote_error error;
- remote_nonnull_domain dom;
- remote_nonnull_network net;
-
- verr = client->conn
- ? virConnGetLastError (client->conn)
- : virGetLastError ();
-
- if (verr) {
- error.code = verr->code;
- error.domain = verr->domain;
- error.message = verr->message ? &verr->message : NULL;
- error.level = verr->level;
- if (verr->dom) {
- dom.name = verr->dom->name;
- memcpy (dom.uuid, verr->dom->uuid, VIR_UUID_BUFLEN);
- dom.id = verr->dom->id;
- }
- error.dom = verr->dom ? &dom : NULL;
- error.str1 = verr->str1 ? &verr->str1 : NULL;
- error.str2 = verr->str2 ? &verr->str2 : NULL;
- error.str3 = verr->str3 ? &verr->str3 : NULL;
- error.int1 = verr->int1;
- error.int2 = verr->int2;
- if (verr->net) {
- net.name = verr->net->name;
- memcpy (net.uuid, verr->net->uuid, VIR_UUID_BUFLEN);
- }
- error.net = verr->net ? &net : NULL;
- } else {
- /* Error was NULL so synthesize an error. */
- char msgbuf[] = "remoteDispatchClientRequest: internal error: library function returned error but did not set virterror";
- char *msg = msgbuf;
-
- error.code = VIR_ERR_RPC;
- error.domain = VIR_FROM_REMOTE;
- error.message = &msg;
- error.level = VIR_ERR_ERROR;
- error.dom = NULL;
- error.str1 = &msg;
- error.str2 = NULL;
- error.str3 = NULL;
- error.int1 = 0;
- error.int2 = 0;
- error.net = NULL;
- }
-
- if (!xdr_remote_error (&xdr, &error)) {
- remoteDispatchError (client, &req, "%s", _("serialise return error"));
- xdr_destroy (&xdr);
- return;
- }
+ /* Error was NULL so synthesize an error. */
+ if (rerr.code == 0)
+ remoteDispatchGenericError(&rerr);
+ if (!xdr_remote_error (&xdr, &rerr))
+ goto fatal_error;
}
/* Write the length word. */
len = xdr_getpos (&xdr);
- if (xdr_setpos (&xdr, 0) == 0) {
- remoteDispatchError (client, &req, "%s", _("xdr_setpos"));
- xdr_destroy (&xdr);
- return;
- }
+ if (xdr_setpos (&xdr, 0) == 0)
+ goto fatal_error;
- if (!xdr_int (&xdr, &len)) {
- remoteDispatchError (client, &req, "%s", _("serialise return length"));
- xdr_destroy (&xdr);
- return;
- }
+ if (!xdr_int (&xdr, &len))
+ goto fatal_error;
xdr_destroy (&xdr);
- /* Set up the output buffer. */
- client->mode = QEMUD_MODE_TX_PACKET;
- client->bufferLength = len;
- client->bufferOffset = 0;
+ return len;
+
+fatal_error:
+ /* Seriously bad stuff happened, so we'll kill off this client
+ and not send back any RPC error */
+ xdr_destroy (&xdr);
+ return 0;
}
-
-/* An error occurred during the dispatching process itself (ie. not
- * an error from the function being called). We return an error
- * reply.
- */
-static void
-remoteDispatchSendError (struct qemud_client *client,
- remote_message_header *req,
- int code, const char *msg)
-{
- remote_message_header rep;
- remote_error error;
- XDR xdr;
- int len;
-
- /* Future versions of the protocol may use different vers or prog. Try
- * our hardest to send back a message that such clients could see.
- */
- if (req) {
- rep.prog = req->prog;
- rep.vers = req->vers;
- rep.proc = req->proc;
- rep.direction = REMOTE_REPLY;
- rep.serial = req->serial;
- rep.status = REMOTE_ERROR;
- } else {
- rep.prog = REMOTE_PROGRAM;
- rep.vers = REMOTE_PROTOCOL_VERSION;
- rep.proc = REMOTE_PROC_OPEN;
- rep.direction = REMOTE_REPLY;
- rep.serial = 1;
- rep.status = REMOTE_ERROR;
- }
-
- /* Construct the error. */
- error.code = code;
- error.domain = VIR_FROM_REMOTE;
- error.message = (char**)&msg;
- error.level = VIR_ERR_ERROR;
- error.dom = NULL;
- error.str1 = (char**)&msg;
- error.str2 = NULL;
- error.str3 = NULL;
- error.int1 = 0;
- error.int2 = 0;
- error.net = NULL;
-
- /* Serialise the return header and error. */
- xdrmem_create (&xdr, client->buffer, sizeof client->buffer, XDR_ENCODE);
-
- len = 0; /* We'll come back and write this later. */
- if (!xdr_int (&xdr, &len)) {
- xdr_destroy (&xdr);
- return;
- }
-
- if (!xdr_remote_message_header (&xdr, &rep)) {
- xdr_destroy (&xdr);
- return;
- }
-
- if (!xdr_remote_error (&xdr, &error)) {
- xdr_destroy (&xdr);
- return;
- }
-
- len = xdr_getpos (&xdr);
- if (xdr_setpos (&xdr, 0) == 0) {
- xdr_destroy (&xdr);
- return;
- }
-
- if (!xdr_int (&xdr, &len)) {
- xdr_destroy (&xdr);
- return;
- }
-
- xdr_destroy (&xdr);
-
- /* Send it. */
- client->mode = QEMUD_MODE_TX_PACKET;
- client->bufferLength = len;
- client->bufferOffset = 0;
-}
-
-static void
-remoteDispatchFailAuth (struct qemud_client *client,
- remote_message_header *req)
-{
- remoteDispatchSendError (client, req, VIR_ERR_AUTH_FAILED, "authentication failed");
-}
-
-static void
-remoteDispatchError (struct qemud_client *client,
- remote_message_header *req,
- const char *fmt, ...)
-{
- va_list args;
- char msgbuf[1024];
- char *msg = msgbuf;
-
- va_start (args, fmt);
- vsnprintf (msgbuf, sizeof msgbuf, fmt, args);
- va_end (args);
-
- remoteDispatchSendError (client, req, VIR_ERR_RPC, msg);
-}
-
/*----- Functions. -----*/
static int
remoteDispatchOpen (struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client, remote_message_header *req,
+ struct qemud_client *client,
+ remote_error *rerr,
struct remote_open_args *args, void *ret ATTRIBUTE_UNUSED)
{
const char *name;
@@ -434,8 +348,8 @@ remoteDispatchOpen (struct qemud_server
/* Already opened? */
if (client->conn) {
- remoteDispatchError (client, req, "%s", _("connection already open"));
- return -2;
+ remoteDispatchFormatError (rerr, "%s", _("connection already open"));
+ return -1;
}
name = args->name ? *args->name : NULL;
@@ -451,60 +365,77 @@ remoteDispatchOpen (struct qemud_server
? virConnectOpenReadOnly (name)
: virConnectOpen (name);
- return client->conn ? 0 : -1;
+ if (client->conn == NULL) {
+ remoteDispatchConnError(rerr, NULL);
+ return -1;
+ }
+
+ return 0;
}
#define CHECK_CONN(client) \
if (!client->conn) { \
- remoteDispatchError (client, req, "%s", _("connection not open")); \
- return -2; \
+ remoteDispatchFormatError (rerr, "%s", _("connection not open")); \
+ return -1; \
}
static int
remoteDispatchClose (struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client, remote_message_header *req,
+ struct qemud_client *client,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED, void *ret ATTRIBUTE_UNUSED)
{
- int rv;
CHECK_CONN(client);
- rv = virConnectClose (client->conn);
- if (rv == 0) client->conn = NULL;
+ if (virConnectClose (client->conn) < 0) {
+ remoteDispatchConnError(rerr, NULL);
+ return -1;
+ }
- return rv;
+ client->conn = NULL;
+
+ return 0;
}
static int
remoteDispatchSupportsFeature (struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client, remote_message_header *req,
+ struct qemud_client *client,
+ remote_error *rerr,
remote_supports_feature_args *args, remote_supports_feature_ret *ret)
{
CHECK_CONN(client);
ret->supported = __virDrvSupportsFeature (client->conn, args->feature);
- if (ret->supported == -1) return -1;
+ if (ret->supported == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
static int
remoteDispatchGetType (struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client, remote_message_header *req,
+ struct qemud_client *client,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED, remote_get_type_ret *ret)
{
const char *type;
CHECK_CONN(client);
type = virConnectGetType (client->conn);
- if (type == NULL) return -1;
+ if (type == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
/* We have to strdup because remoteDispatchClientRequest will
* free this string after it's been serialised.
*/
ret->type = strdup (type);
if (!ret->type) {
- remoteDispatchError (client, req, "%s", _("out of memory in strdup"));
- return -2;
+ remoteDispatchFormatError (rerr, "%s", _("out of memory in strdup"));
+ return -1;
}
return 0;
@@ -513,15 +444,17 @@ static int
static int
remoteDispatchGetVersion (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_get_version_ret *ret)
{
unsigned long hvVer;
CHECK_CONN(client);
- if (virConnectGetVersion (client->conn, &hvVer) == -1)
+ if (virConnectGetVersion (client->conn, &hvVer) == -1) {
+ remoteDispatchConnError(rerr, client->conn);
return -1;
+ }
ret->hv_ver = hvVer;
return 0;
@@ -530,7 +463,7 @@ static int
static int
remoteDispatchGetHostname (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_get_hostname_ret *ret)
{
@@ -538,7 +471,10 @@ remoteDispatchGetHostname (struct qemud_
CHECK_CONN(client);
hostname = virConnectGetHostname (client->conn);
- if (hostname == NULL) return -1;
+ if (hostname == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
ret->hostname = hostname;
return 0;
@@ -547,7 +483,7 @@ static int
static int
remoteDispatchGetMaxVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_get_max_vcpus_args *args,
remote_get_max_vcpus_ret *ret)
{
@@ -556,7 +492,10 @@ remoteDispatchGetMaxVcpus (struct qemud_
type = args->type ? *args->type : NULL;
ret->max_vcpus = virConnectGetMaxVcpus (client->conn, type);
- if (ret->max_vcpus == -1) return -1;
+ if (ret->max_vcpus == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -564,15 +503,17 @@ static int
static int
remoteDispatchNodeGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_node_get_info_ret *ret)
{
virNodeInfo info;
CHECK_CONN(client);
- if (virNodeGetInfo (client->conn, &info) == -1)
+ if (virNodeGetInfo (client->conn, &info) == -1) {
+ remoteDispatchConnError(rerr, client->conn);
return -1;
+ }
memcpy (ret->model, info.model, sizeof ret->model);
ret->memory = info.memory;
@@ -589,7 +530,7 @@ static int
static int
remoteDispatchGetCapabilities (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_get_capabilities_ret *ret)
{
@@ -597,7 +538,10 @@ remoteDispatchGetCapabilities (struct qe
CHECK_CONN(client);
caps = virConnectGetCapabilities (client->conn);
- if (caps == NULL) return -1;
+ if (caps == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
ret->capabilities = caps;
return 0;
@@ -606,22 +550,22 @@ static int
static int
remoteDispatchNodeGetCellsFreeMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_node_get_cells_free_memory_args *args,
remote_node_get_cells_free_memory_ret *ret)
{
CHECK_CONN(client);
if (args->maxCells > REMOTE_NODE_MAX_CELLS) {
- remoteDispatchError (client, req,
- "%s", _("maxCells > REMOTE_NODE_MAX_CELLS"));
- return -2;
+ remoteDispatchFormatError (rerr,
+ "%s", _("maxCells > REMOTE_NODE_MAX_CELLS"));
+ return -1;
}
/* Allocate return buffer. */
if (VIR_ALLOC_N(ret->freeMems.freeMems_val, args->maxCells) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->freeMems.freeMems_len = virNodeGetCellsFreeMemory(client->conn,
@@ -630,6 +574,7 @@ remoteDispatchNodeGetCellsFreeMemory (st
args->maxCells);
if (ret->freeMems.freeMems_len == 0) {
VIR_FREE(ret->freeMems.freeMems_val);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -640,7 +585,7 @@ static int
static int
remoteDispatchNodeGetFreeMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_node_get_free_memory_ret *ret)
{
@@ -648,8 +593,10 @@ remoteDispatchNodeGetFreeMemory (struct
CHECK_CONN(client);
freeMem = virNodeGetFreeMemory(client->conn);
- if (freeMem == 0) return -1;
-
+ if (freeMem == 0) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
ret->freeMem = freeMem;
return 0;
}
@@ -658,7 +605,7 @@ static int
static int
remoteDispatchDomainGetSchedulerType (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_get_scheduler_type_args *args,
remote_domain_get_scheduler_type_ret *ret)
{
@@ -669,13 +616,14 @@ remoteDispatchDomainGetSchedulerType (st
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
type = virDomainGetSchedulerType (dom, &nparams);
if (type == NULL) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -688,7 +636,7 @@ static int
static int
remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_get_scheduler_parameters_args *args,
remote_domain_get_scheduler_parameters_ret *ret)
{
@@ -700,25 +648,26 @@ remoteDispatchDomainGetSchedulerParamete
nparams = args->nparams;
if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
- remoteDispatchError (client, req, "%s", _("nparams too large"));
- return -2;
+ remoteDispatchFormatError (rerr, "%s", _("nparams too large"));
+ return -1;
}
if (VIR_ALLOC_N(params, nparams) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
VIR_FREE(params);
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
r = virDomainGetSchedulerParameters (dom, params, &nparams);
if (r == -1) {
virDomainFree(dom);
VIR_FREE(params);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -748,7 +697,7 @@ remoteDispatchDomainGetSchedulerParamete
case VIR_DOMAIN_SCHED_FIELD_BOOLEAN:
ret->params.params_val[i].value.remote_sched_param_value_u.b = params[i].value.b; break;
default:
- remoteDispatchError (client, req, "%s", _("unknown type"));
+ remoteDispatchFormatError (rerr, "%s", _("unknown type"));
goto cleanup;
}
}
@@ -758,19 +707,19 @@ remoteDispatchDomainGetSchedulerParamete
return 0;
oom:
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
+ remoteDispatchOOMError(rerr);
cleanup:
virDomainFree(dom);
for (i = 0 ; i < nparams ; i++)
VIR_FREE(ret->params.params_val[i].field);
VIR_FREE(params);
- return -2;
+ return -1;
}
static int
remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_set_scheduler_parameters_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -782,12 +731,12 @@ remoteDispatchDomainSetSchedulerParamete
nparams = args->params.params_len;
if (nparams > REMOTE_DOMAIN_SCHEDULER_PARAMETERS_MAX) {
- remoteDispatchError (client, req, "%s", _("nparams too large"));
- return -2;
+ remoteDispatchFormatError (rerr, "%s", _("nparams too large"));
+ return -1;
}
if (VIR_ALLOC_N(params, nparams)) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
/* Deserialise parameters. */
@@ -815,14 +764,17 @@ remoteDispatchDomainSetSchedulerParamete
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
VIR_FREE(params);
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
r = virDomainSetSchedulerParameters (dom, params, nparams);
virDomainFree(dom);
VIR_FREE(params);
- if (r == -1) return -1;
+ if (r == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -830,7 +782,7 @@ static int
static int
remoteDispatchDomainBlockStats (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_block_stats_args *args,
remote_domain_block_stats_ret *ret)
{
@@ -841,13 +793,14 @@ remoteDispatchDomainBlockStats (struct q
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
path = args->path;
if (virDomainBlockStats (dom, path, &stats, sizeof stats) == -1) {
virDomainFree (dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree (dom);
@@ -864,7 +817,7 @@ static int
static int
remoteDispatchDomainInterfaceStats (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_interface_stats_args *args,
remote_domain_interface_stats_ret *ret)
{
@@ -875,13 +828,14 @@ remoteDispatchDomainInterfaceStats (stru
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
path = args->path;
if (virDomainInterfaceStats (dom, path, &stats, sizeof stats) == -1) {
virDomainFree (dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree (dom);
@@ -901,7 +855,7 @@ static int
static int
remoteDispatchDomainBlockPeek (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_block_peek_args *args,
remote_domain_block_peek_ret *ret)
{
@@ -914,8 +868,8 @@ remoteDispatchDomainBlockPeek (struct qe
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
path = args->path;
offset = args->offset;
@@ -924,22 +878,23 @@ remoteDispatchDomainBlockPeek (struct qe
if (size > REMOTE_DOMAIN_BLOCK_PEEK_BUFFER_MAX) {
virDomainFree (dom);
- remoteDispatchError (client, req,
- "%s", _("size > maximum buffer size"));
- return -2;
+ remoteDispatchFormatError (rerr,
+ "%s", _("size > maximum buffer size"));
+ return -1;
}
ret->buffer.buffer_len = size;
if (VIR_ALLOC_N(ret->buffer.buffer_val, size) < 0) {
virDomainFree (dom);
- remoteDispatchError (client, req, "%s", strerror (errno));
- return -2;
+ remoteDispatchFormatError (rerr, "%s", strerror (errno));
+ return -1;
}
if (virDomainBlockPeek (dom, path, offset, size,
ret->buffer.buffer_val, flags) == -1) {
/* free (ret->buffer.buffer_val); - caller frees */
virDomainFree (dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree (dom);
@@ -950,7 +905,7 @@ static int
static int
remoteDispatchDomainMemoryPeek (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_memory_peek_args *args,
remote_domain_memory_peek_ret *ret)
{
@@ -962,31 +917,32 @@ remoteDispatchDomainMemoryPeek (struct q
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
offset = args->offset;
size = args->size;
flags = args->flags;
if (size > REMOTE_DOMAIN_MEMORY_PEEK_BUFFER_MAX) {
- remoteDispatchError (client, req,
- "%s", _("size > maximum buffer size"));
+ remoteDispatchFormatError (rerr,
+ "%s", _("size > maximum buffer size"));
virDomainFree (dom);
- return -2;
+ return -1;
}
ret->buffer.buffer_len = size;
if (VIR_ALLOC_N (ret->buffer.buffer_val, size) < 0) {
- remoteDispatchError (client, req, "%s", strerror (errno));
+ remoteDispatchFormatError (rerr, "%s", strerror (errno));
virDomainFree (dom);
- return -2;
+ return -1;
}
if (virDomainMemoryPeek (dom, offset, size,
ret->buffer.buffer_val, flags) == -1) {
/* free (ret->buffer.buffer_val); - caller frees */
virDomainFree (dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree (dom);
@@ -997,7 +953,7 @@ static int
static int
remoteDispatchDomainAttachDevice (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_attach_device_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1006,12 +962,13 @@ remoteDispatchDomainAttachDevice (struct
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainAttachDevice (dom, args->xml) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1021,7 +978,7 @@ static int
static int
remoteDispatchDomainCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1030,12 +987,13 @@ remoteDispatchDomainCreate (struct qemud
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainCreate (dom) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1045,7 +1003,7 @@ static int
static int
remoteDispatchDomainCreateXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_create_xml_args *args,
remote_domain_create_xml_ret *ret)
{
@@ -1053,7 +1011,10 @@ remoteDispatchDomainCreateXml (struct qe
CHECK_CONN(client);
dom = virDomainCreateXML (client->conn, args->xml_desc, args->flags);
- if (dom == NULL) return -1;
+ if (dom == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_domain (&ret->dom, dom);
virDomainFree(dom);
@@ -1064,7 +1025,7 @@ static int
static int
remoteDispatchDomainDefineXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_define_xml_args *args,
remote_domain_define_xml_ret *ret)
{
@@ -1072,7 +1033,10 @@ remoteDispatchDomainDefineXml (struct qe
CHECK_CONN(client);
dom = virDomainDefineXML (client->conn, args->xml);
- if (dom == NULL) return -1;
+ if (dom == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_domain (&ret->dom, dom);
virDomainFree(dom);
@@ -1083,7 +1047,7 @@ static int
static int
remoteDispatchDomainDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1092,12 +1056,13 @@ remoteDispatchDomainDestroy (struct qemu
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainDestroy (dom) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1107,7 +1072,7 @@ static int
static int
remoteDispatchDomainDetachDevice (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_detach_device_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1116,12 +1081,13 @@ remoteDispatchDomainDetachDevice (struct
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainDetachDevice (dom, args->xml) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -1132,7 +1098,7 @@ static int
static int
remoteDispatchDomainDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_dump_xml_args *args,
remote_domain_dump_xml_ret *ret)
{
@@ -1141,15 +1107,16 @@ remoteDispatchDomainDumpXml (struct qemu
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
/* remoteDispatchClientRequest will free this. */
ret->xml = virDomainGetXMLDesc (dom, args->flags);
if (!ret->xml) {
- virDomainFree(dom);
- return -1;
+ virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
virDomainFree(dom);
return 0;
@@ -1158,7 +1125,7 @@ static int
static int
remoteDispatchDomainGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_get_autostart_args *args,
remote_domain_get_autostart_ret *ret)
{
@@ -1167,12 +1134,13 @@ remoteDispatchDomainGetAutostart (struct
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainGetAutostart (dom, &ret->autostart) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1182,7 +1150,7 @@ static int
static int
remoteDispatchDomainGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_get_info_args *args,
remote_domain_get_info_ret *ret)
{
@@ -1192,12 +1160,13 @@ remoteDispatchDomainGetInfo (struct qemu
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainGetInfo (dom, &info) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -1215,7 +1184,7 @@ static int
static int
remoteDispatchDomainGetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_get_max_memory_args *args,
remote_domain_get_max_memory_ret *ret)
{
@@ -1224,13 +1193,14 @@ remoteDispatchDomainGetMaxMemory (struct
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
ret->memory = virDomainGetMaxMemory (dom);
if (ret->memory == 0) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1240,7 +1210,7 @@ static int
static int
remoteDispatchDomainGetMaxVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_get_max_vcpus_args *args,
remote_domain_get_max_vcpus_ret *ret)
{
@@ -1249,13 +1219,14 @@ remoteDispatchDomainGetMaxVcpus (struct
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
ret->num = virDomainGetMaxVcpus (dom);
if (ret->num == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1265,7 +1236,7 @@ static int
static int
remoteDispatchDomainGetOsType (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_get_os_type_args *args,
remote_domain_get_os_type_ret *ret)
{
@@ -1274,15 +1245,16 @@ remoteDispatchDomainGetOsType (struct qe
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
/* remoteDispatchClientRequest will free this */
ret->type = virDomainGetOSType (dom);
if (ret->type == NULL) {
- virDomainFree(dom);
- return -1;
+ virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
virDomainFree(dom);
return 0;
@@ -1291,7 +1263,7 @@ static int
static int
remoteDispatchDomainGetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_get_vcpus_args *args,
remote_domain_get_vcpus_ret *ret)
{
@@ -1303,20 +1275,20 @@ remoteDispatchDomainGetVcpus (struct qem
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (args->maxinfo > REMOTE_VCPUINFO_MAX) {
virDomainFree(dom);
- remoteDispatchError (client, req, "%s", _("maxinfo > REMOTE_VCPUINFO_MAX"));
- return -2;
+ remoteDispatchFormatError (rerr, "%s", _("maxinfo > REMOTE_VCPUINFO_MAX"));
+ return -1;
}
if (args->maxinfo * args->maplen > REMOTE_CPUMAPS_MAX) {
virDomainFree(dom);
- remoteDispatchError (client, req, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX"));
- return -2;
+ remoteDispatchFormatError (rerr, "%s", _("maxinfo * maplen > REMOTE_CPUMAPS_MAX"));
+ return -1;
}
/* Allocate buffers to take the results. */
@@ -1332,6 +1304,7 @@ remoteDispatchDomainGetVcpus (struct qem
VIR_FREE(info);
VIR_FREE(cpumaps);
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -1362,14 +1335,14 @@ oom:
VIR_FREE(info);
VIR_FREE(cpumaps);
virDomainFree(dom);
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
static int
remoteDispatchDomainMigratePrepare (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_migrate_prepare_args *args,
remote_domain_migrate_prepare_ret *ret)
{
@@ -1386,8 +1359,8 @@ remoteDispatchDomainMigratePrepare (stru
/* Wacky world of XDR ... */
if (VIR_ALLOC(uri_out) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
r = __virDomainMigratePrepare (client->conn, &cookie, &cookielen,
@@ -1395,6 +1368,7 @@ remoteDispatchDomainMigratePrepare (stru
args->flags, dname, args->resource);
if (r == -1) {
VIR_FREE(uri_out);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -1416,7 +1390,7 @@ static int
static int
remoteDispatchDomainMigratePerform (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_migrate_perform_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1427,8 +1401,8 @@ remoteDispatchDomainMigratePerform (stru
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
dname = args->dname == NULL ? NULL : *args->dname;
@@ -1439,7 +1413,10 @@ remoteDispatchDomainMigratePerform (stru
args->uri,
args->flags, dname, args->resource);
virDomainFree (dom);
- if (r == -1) return -1;
+ if (r == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -1447,7 +1424,7 @@ static int
static int
remoteDispatchDomainMigrateFinish (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_migrate_finish_args *args,
remote_domain_migrate_finish_ret *ret)
{
@@ -1459,7 +1436,10 @@ remoteDispatchDomainMigrateFinish (struc
args->cookie.cookie_len,
args->uri,
args->flags);
- if (ddom == NULL) return -1;
+ if (ddom == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_domain (&ret->ddom, ddom);
virDomainFree (ddom);
@@ -1469,22 +1449,22 @@ static int
static int
remoteDispatchListDefinedDomains (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_list_defined_domains_args *args,
remote_list_defined_domains_ret *ret)
{
CHECK_CONN(client);
if (args->maxnames > REMOTE_DOMAIN_NAME_LIST_MAX) {
- remoteDispatchError (client, req,
- "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
- return -2;
+ remoteDispatchFormatError (rerr,
+ "%s", _("maxnames > REMOTE_DOMAIN_NAME_LIST_MAX"));
+ return -1;
}
/* Allocate return buffer. */
if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -1492,6 +1472,7 @@ remoteDispatchListDefinedDomains (struct
ret->names.names_val, args->maxnames);
if (ret->names.names_len == -1) {
VIR_FREE(ret->names.names_val);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -1501,7 +1482,7 @@ static int
static int
remoteDispatchDomainLookupById (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_lookup_by_id_args *args,
remote_domain_lookup_by_id_ret *ret)
{
@@ -1509,7 +1490,10 @@ remoteDispatchDomainLookupById (struct q
CHECK_CONN(client);
dom = virDomainLookupByID (client->conn, args->id);
- if (dom == NULL) return -1;
+ if (dom == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_domain (&ret->dom, dom);
virDomainFree(dom);
@@ -1519,7 +1503,7 @@ static int
static int
remoteDispatchDomainLookupByName (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_lookup_by_name_args *args,
remote_domain_lookup_by_name_ret *ret)
{
@@ -1527,7 +1511,10 @@ remoteDispatchDomainLookupByName (struct
CHECK_CONN(client);
dom = virDomainLookupByName (client->conn, args->name);
- if (dom == NULL) return -1;
+ if (dom == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_domain (&ret->dom, dom);
virDomainFree(dom);
@@ -1537,7 +1524,7 @@ static int
static int
remoteDispatchDomainLookupByUuid (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_lookup_by_uuid_args *args,
remote_domain_lookup_by_uuid_ret *ret)
{
@@ -1545,7 +1532,10 @@ remoteDispatchDomainLookupByUuid (struct
CHECK_CONN(client);
dom = virDomainLookupByUUID (client->conn, (unsigned char *) args->uuid);
- if (dom == NULL) return -1;
+ if (dom == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_domain (&ret->dom, dom);
virDomainFree(dom);
@@ -1555,14 +1545,17 @@ static int
static int
remoteDispatchNumOfDefinedDomains (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_num_of_defined_domains_ret *ret)
{
CHECK_CONN(client);
ret->num = virConnectNumOfDefinedDomains (client->conn);
- if (ret->num == -1) return -1;
+ if (ret->num == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -1570,7 +1563,7 @@ static int
static int
remoteDispatchDomainPinVcpu (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_pin_vcpu_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1580,14 +1573,14 @@ remoteDispatchDomainPinVcpu (struct qemu
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (args->cpumap.cpumap_len > REMOTE_CPUMAP_MAX) {
virDomainFree(dom);
- remoteDispatchError (client, req, "%s", _("cpumap_len > REMOTE_CPUMAP_MAX"));
- return -2;
+ remoteDispatchFormatError (rerr, "%s", _("cpumap_len > REMOTE_CPUMAP_MAX"));
+ return -1;
}
rv = virDomainPinVcpu (dom, args->vcpu,
@@ -1595,6 +1588,7 @@ remoteDispatchDomainPinVcpu (struct qemu
args->cpumap.cpumap_len);
if (rv == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1604,7 +1598,7 @@ static int
static int
remoteDispatchDomainReboot (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_reboot_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1613,12 +1607,13 @@ remoteDispatchDomainReboot (struct qemud
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainReboot (dom, args->flags) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1628,14 +1623,16 @@ static int
static int
remoteDispatchDomainRestore (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_restore_args *args,
void *ret ATTRIBUTE_UNUSED)
{
CHECK_CONN(client);
- if (virDomainRestore (client->conn, args->from) == -1)
+ if (virDomainRestore (client->conn, args->from) == -1) {
+ remoteDispatchConnError(rerr, client->conn);
return -1;
+ }
return 0;
}
@@ -1643,7 +1640,7 @@ static int
static int
remoteDispatchDomainResume (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_resume_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1652,12 +1649,13 @@ remoteDispatchDomainResume (struct qemud
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainResume (dom) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1667,7 +1665,7 @@ static int
static int
remoteDispatchDomainSave (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_save_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1676,12 +1674,13 @@ remoteDispatchDomainSave (struct qemud_s
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainSave (dom, args->to) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1691,7 +1690,7 @@ static int
static int
remoteDispatchDomainCoreDump (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_core_dump_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1700,12 +1699,13 @@ remoteDispatchDomainCoreDump (struct qem
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainCoreDump (dom, args->to, args->flags) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1715,7 +1715,7 @@ static int
static int
remoteDispatchDomainSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_set_autostart_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1724,12 +1724,13 @@ remoteDispatchDomainSetAutostart (struct
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainSetAutostart (dom, args->autostart) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1739,7 +1740,7 @@ static int
static int
remoteDispatchDomainSetMaxMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_set_max_memory_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1748,12 +1749,13 @@ remoteDispatchDomainSetMaxMemory (struct
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainSetMaxMemory (dom, args->memory) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1763,7 +1765,7 @@ static int
static int
remoteDispatchDomainSetMemory (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_set_memory_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1772,12 +1774,13 @@ remoteDispatchDomainSetMemory (struct qe
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainSetMemory (dom, args->memory) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1787,7 +1790,7 @@ static int
static int
remoteDispatchDomainSetVcpus (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_set_vcpus_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1796,12 +1799,13 @@ remoteDispatchDomainSetVcpus (struct qem
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainSetVcpus (dom, args->nvcpus) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1811,7 +1815,7 @@ static int
static int
remoteDispatchDomainShutdown (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_shutdown_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1820,12 +1824,13 @@ remoteDispatchDomainShutdown (struct qem
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainShutdown (dom) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1835,7 +1840,7 @@ static int
static int
remoteDispatchDomainSuspend (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_suspend_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1844,12 +1849,13 @@ remoteDispatchDomainSuspend (struct qemu
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainSuspend (dom) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1859,7 +1865,7 @@ static int
static int
remoteDispatchDomainUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1868,12 +1874,13 @@ remoteDispatchDomainUndefine (struct qem
dom = get_nonnull_domain (client->conn, args->dom);
if (dom == NULL) {
- remoteDispatchError (client, req, "%s", _("domain not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virDomainUndefine (dom) == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1883,22 +1890,22 @@ static int
static int
remoteDispatchListDefinedNetworks (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_list_defined_networks_args *args,
remote_list_defined_networks_ret *ret)
{
CHECK_CONN(client);
if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
- remoteDispatchError (client, req,
- "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
- return -2;
+ remoteDispatchFormatError (rerr,
+ "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
+ return -1;
}
/* Allocate return buffer. */
if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -1906,6 +1913,7 @@ remoteDispatchListDefinedNetworks (struc
ret->names.names_val, args->maxnames);
if (ret->names.names_len == -1) {
VIR_FREE(ret->names.names_val);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -1915,28 +1923,29 @@ static int
static int
remoteDispatchListDomains (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_list_domains_args *args,
remote_list_domains_ret *ret)
{
CHECK_CONN(client);
if (args->maxids > REMOTE_DOMAIN_ID_LIST_MAX) {
- remoteDispatchError (client, req,
- "%s", _("maxids > REMOTE_DOMAIN_ID_LIST_MAX"));
- return -2;
+ remoteDispatchFormatError (rerr,
+ "%s", _("maxids > REMOTE_DOMAIN_ID_LIST_MAX"));
+ return -1;
}
/* Allocate return buffer. */
if (VIR_ALLOC_N(ret->ids.ids_val, args->maxids) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->ids.ids_len = virConnectListDomains (client->conn,
ret->ids.ids_val, args->maxids);
if (ret->ids.ids_len == -1) {
VIR_FREE(ret->ids.ids_val);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -1946,22 +1955,22 @@ static int
static int
remoteDispatchListNetworks (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_list_networks_args *args,
remote_list_networks_ret *ret)
{
CHECK_CONN(client);
if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
- remoteDispatchError (client, req,
- "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
- return -2;
+ remoteDispatchFormatError (rerr,
+ "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
+ return -1;
}
/* Allocate return buffer. */
if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -1969,6 +1978,7 @@ remoteDispatchListNetworks (struct qemud
ret->names.names_val, args->maxnames);
if (ret->names.names_len == -1) {
VIR_FREE(ret->names.names_len);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -1978,7 +1988,7 @@ static int
static int
remoteDispatchNetworkCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -1987,12 +1997,13 @@ remoteDispatchNetworkCreate (struct qemu
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "%s", _("network not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virNetworkCreate (net) == -1) {
virNetworkFree(net);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virNetworkFree(net);
@@ -2002,7 +2013,7 @@ static int
static int
remoteDispatchNetworkCreateXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_create_xml_args *args,
remote_network_create_xml_ret *ret)
{
@@ -2010,7 +2021,10 @@ remoteDispatchNetworkCreateXml (struct q
CHECK_CONN(client);
net = virNetworkCreateXML (client->conn, args->xml);
- if (net == NULL) return -1;
+ if (net == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_network (&ret->net, net);
virNetworkFree(net);
@@ -2020,7 +2034,7 @@ static int
static int
remoteDispatchNetworkDefineXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_define_xml_args *args,
remote_network_define_xml_ret *ret)
{
@@ -2028,7 +2042,10 @@ remoteDispatchNetworkDefineXml (struct q
CHECK_CONN(client);
net = virNetworkDefineXML (client->conn, args->xml);
- if (net == NULL) return -1;
+ if (net == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_network (&ret->net, net);
virNetworkFree(net);
@@ -2038,7 +2055,7 @@ static int
static int
remoteDispatchNetworkDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -2047,12 +2064,13 @@ remoteDispatchNetworkDestroy (struct qem
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "%s", _("network not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virNetworkDestroy (net) == -1) {
virNetworkFree(net);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virNetworkFree(net);
@@ -2062,7 +2080,7 @@ static int
static int
remoteDispatchNetworkDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_dump_xml_args *args,
remote_network_dump_xml_ret *ret)
{
@@ -2071,14 +2089,15 @@ remoteDispatchNetworkDumpXml (struct qem
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "%s", _("network not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
/* remoteDispatchClientRequest will free this. */
ret->xml = virNetworkGetXMLDesc (net, args->flags);
if (!ret->xml) {
virNetworkFree(net);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virNetworkFree(net);
@@ -2088,7 +2107,7 @@ static int
static int
remoteDispatchNetworkGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_get_autostart_args *args,
remote_network_get_autostart_ret *ret)
{
@@ -2097,12 +2116,13 @@ remoteDispatchNetworkGetAutostart (struc
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "%s", _("network not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virNetworkGetAutostart (net, &ret->autostart) == -1) {
virNetworkFree(net);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virNetworkFree(net);
@@ -2112,7 +2132,7 @@ static int
static int
remoteDispatchNetworkGetBridgeName (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_get_bridge_name_args *args,
remote_network_get_bridge_name_ret *ret)
{
@@ -2121,14 +2141,15 @@ remoteDispatchNetworkGetBridgeName (stru
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "%s", _("network not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
/* remoteDispatchClientRequest will free this. */
ret->name = virNetworkGetBridgeName (net);
if (!ret->name) {
virNetworkFree(net);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virNetworkFree(net);
@@ -2138,7 +2159,7 @@ static int
static int
remoteDispatchNetworkLookupByName (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_lookup_by_name_args *args,
remote_network_lookup_by_name_ret *ret)
{
@@ -2146,7 +2167,10 @@ remoteDispatchNetworkLookupByName (struc
CHECK_CONN(client);
net = virNetworkLookupByName (client->conn, args->name);
- if (net == NULL) return -1;
+ if (net == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_network (&ret->net, net);
virNetworkFree(net);
@@ -2156,7 +2180,7 @@ static int
static int
remoteDispatchNetworkLookupByUuid (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_lookup_by_uuid_args *args,
remote_network_lookup_by_uuid_ret *ret)
{
@@ -2164,7 +2188,10 @@ remoteDispatchNetworkLookupByUuid (struc
CHECK_CONN(client);
net = virNetworkLookupByUUID (client->conn, (unsigned char *) args->uuid);
- if (net == NULL) return -1;
+ if (net == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_network (&ret->net, net);
virNetworkFree(net);
@@ -2174,7 +2201,7 @@ static int
static int
remoteDispatchNetworkSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_set_autostart_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -2183,12 +2210,13 @@ remoteDispatchNetworkSetAutostart (struc
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "%s", _("network not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virNetworkSetAutostart (net, args->autostart) == -1) {
virNetworkFree(net);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virNetworkFree(net);
@@ -2198,7 +2226,7 @@ static int
static int
remoteDispatchNetworkUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_network_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -2207,12 +2235,13 @@ remoteDispatchNetworkUndefine (struct qe
net = get_nonnull_network (client->conn, args->net);
if (net == NULL) {
- remoteDispatchError (client, req, "%s", _("network not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virNetworkUndefine (net) == -1) {
virNetworkFree(net);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virNetworkFree(net);
@@ -2222,14 +2251,17 @@ static int
static int
remoteDispatchNumOfDefinedNetworks (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_num_of_defined_networks_ret *ret)
{
CHECK_CONN(client);
ret->num = virConnectNumOfDefinedNetworks (client->conn);
- if (ret->num == -1) return -1;
+ if (ret->num == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -2237,14 +2269,17 @@ static int
static int
remoteDispatchNumOfDomains (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_num_of_domains_ret *ret)
{
CHECK_CONN(client);
ret->num = virConnectNumOfDomains (client->conn);
- if (ret->num == -1) return -1;
+ if (ret->num == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -2252,14 +2287,17 @@ static int
static int
remoteDispatchNumOfNetworks (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_num_of_networks_ret *ret)
{
CHECK_CONN(client);
ret->num = virConnectNumOfNetworks (client->conn);
- if (ret->num == -1) return -1;
+ if (ret->num == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -2268,14 +2306,14 @@ static int
static int
remoteDispatchAuthList (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req ATTRIBUTE_UNUSED,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_auth_list_ret *ret)
{
ret->types.types_len = 1;
if (VIR_ALLOC_N(ret->types.types_val, ret->types.types_len) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->types.types_val[0] = client->auth;
return 0;
@@ -2286,8 +2324,7 @@ remoteDispatchAuthList (struct qemud_ser
/*
* NB, keep in sync with similar method in src/remote_internal.c
*/
-static char *addrToString(struct qemud_client *client,
- remote_message_header *req,
+static char *addrToString(remote_error *rerr,
struct sockaddr_storage *sa, socklen_t salen) {
char host[1024], port[20];
char *addr;
@@ -2297,14 +2334,14 @@ static char *addrToString(struct qemud_c
host, sizeof(host),
port, sizeof(port),
NI_NUMERICHOST | NI_NUMERICSERV)) != 0) {
- remoteDispatchError(client, req,
- _("Cannot resolve address %d: %s"),
- err, gai_strerror(err));
+ remoteDispatchFormatError(rerr,
+ _("Cannot resolve address %d: %s"),
+ err, gai_strerror(err));
return NULL;
}
if (VIR_ALLOC_N(addr, strlen(host) + 1 + strlen(port) + 1) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
+ remoteDispatchOOMError(rerr);
return NULL;
}
@@ -2324,7 +2361,7 @@ static int
static int
remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_auth_sasl_init_ret *ret)
{
@@ -2339,33 +2376,33 @@ remoteDispatchAuthSaslInit (struct qemud
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn != NULL) {
qemudLog(QEMUD_ERR, "%s", _("client tried invalid SASL init request"));
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
/* Get local address in form IPADDR:PORT */
salen = sizeof(sa);
if (getsockname(client->fd, (struct sockaddr*)&sa, &salen) < 0) {
- remoteDispatchError(client, req,
- _("failed to get sock address %d (%s)"),
- errno, strerror(errno));
- return -2;
+ remoteDispatchFormatError(rerr,
+ _("failed to get sock address %d (%s)"),
+ errno, strerror(errno));
+ return -1;
}
- if ((localAddr = addrToString(client, req, &sa, salen)) == NULL) {
- return -2;
+ if ((localAddr = addrToString(rerr, &sa, salen)) == NULL) {
+ return -1;
}
/* Get remote address in form IPADDR:PORT */
salen = sizeof(sa);
if (getpeername(client->fd, (struct sockaddr*)&sa, &salen) < 0) {
- remoteDispatchError(client, req, _("failed to get peer address %d (%s)"),
- errno, strerror(errno));
+ remoteDispatchFormatError(rerr, _("failed to get peer address %d (%s)"),
+ errno, strerror(errno));
VIR_FREE(localAddr);
- return -2;
+ return -1;
}
- if ((remoteAddr = addrToString(client, req, &sa, salen)) == NULL) {
+ if ((remoteAddr = addrToString(rerr, &sa, salen)) == NULL) {
VIR_FREE(localAddr);
- return -2;
+ return -1;
}
err = sasl_server_new("libvirt",
@@ -2381,9 +2418,9 @@ remoteDispatchAuthSaslInit (struct qemud
if (err != SASL_OK) {
qemudLog(QEMUD_ERR, _("sasl context setup failed %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
client->saslconn = NULL;
- return -2;
+ return -1;
}
/* Inform SASL that we've got an external SSF layer from TLS */
@@ -2394,10 +2431,10 @@ remoteDispatchAuthSaslInit (struct qemud
cipher = gnutls_cipher_get(client->tlssession);
if (!(ssf = (sasl_ssf_t)gnutls_cipher_get_key_size(cipher))) {
qemudLog(QEMUD_ERR, "%s", _("cannot TLS get cipher size"));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
- return -2;
+ return -1;
}
ssf *= 8; /* tls key size is bytes, sasl wants bits */
@@ -2405,10 +2442,10 @@ remoteDispatchAuthSaslInit (struct qemud
if (err != SASL_OK) {
qemudLog(QEMUD_ERR, _("cannot set SASL external SSF %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
- return -2;
+ return -1;
}
}
@@ -2434,10 +2471,10 @@ remoteDispatchAuthSaslInit (struct qemud
if (err != SASL_OK) {
qemudLog(QEMUD_ERR, _("cannot set SASL security props %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
- return -2;
+ return -1;
}
err = sasl_listmech(client->saslconn,
@@ -2451,19 +2488,19 @@ remoteDispatchAuthSaslInit (struct qemud
if (err != SASL_OK) {
qemudLog(QEMUD_ERR, _("cannot list SASL mechanisms %d (%s)"),
err, sasl_errdetail(client->saslconn));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
- return -2;
+ return -1;
}
REMOTE_DEBUG("Available mechanisms for client: '%s'", mechlist);
ret->mechlist = strdup(mechlist);
if (!ret->mechlist) {
qemudLog(QEMUD_ERR, "%s", _("cannot allocate mechlist"));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
- return -2;
+ return -1;
}
return 0;
@@ -2474,7 +2511,7 @@ remoteDispatchAuthSaslInit (struct qemud
* got what we asked for */
static int
remoteSASLCheckSSF (struct qemud_client *client,
- remote_message_header *req) {
+ remote_error *rerr) {
const void *val;
int err, ssf;
@@ -2486,7 +2523,7 @@ remoteSASLCheckSSF (struct qemud_client
if (err != SASL_OK) {
qemudLog(QEMUD_ERR, _("cannot query SASL ssf on connection %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
return -1;
@@ -2495,7 +2532,7 @@ remoteSASLCheckSSF (struct qemud_client
REMOTE_DEBUG("negotiated an SSF of %d", ssf);
if (ssf < 56) { /* 56 is good for Kerberos */
qemudLog(QEMUD_ERR, _("negotiated SSF %d was not strong enough"), ssf);
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
return -1;
@@ -2516,7 +2553,7 @@ static int
static int
remoteSASLCheckAccess (struct qemud_server *server,
struct qemud_client *client,
- remote_message_header *req) {
+ remote_error *rerr) {
const void *val;
int err;
char **wildcards;
@@ -2526,14 +2563,14 @@ remoteSASLCheckAccess (struct qemud_serv
qemudLog(QEMUD_ERR,
_("cannot query SASL username on connection %d (%s)"),
err, sasl_errstring(err, NULL, NULL));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
return -1;
}
if (val == NULL) {
qemudLog(QEMUD_ERR, "%s", _("no client username was found"));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
return -1;
@@ -2543,7 +2580,7 @@ remoteSASLCheckAccess (struct qemud_serv
client->saslUsername = strdup((const char*)val);
if (client->saslUsername == NULL) {
qemudLog(QEMUD_ERR, "%s", _("out of memory copying username"));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
return -1;
@@ -2563,7 +2600,7 @@ remoteSASLCheckAccess (struct qemud_serv
/* Denied */
qemudLog(QEMUD_ERR, _("SASL client %s not allowed in whitelist"),
client->saslUsername);
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
return -1;
@@ -2576,7 +2613,7 @@ static int
static int
remoteDispatchAuthSaslStart (struct qemud_server *server,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_auth_sasl_start_args *args,
remote_auth_sasl_start_ret *ret)
{
@@ -2588,8 +2625,8 @@ remoteDispatchAuthSaslStart (struct qemu
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn == NULL) {
qemudLog(QEMUD_ERR, "%s", _("client tried invalid SASL start request"));
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
REMOTE_DEBUG("Using SASL mechanism %s. Data %d bytes, nil: %d",
@@ -2607,23 +2644,23 @@ remoteDispatchAuthSaslStart (struct qemu
err, sasl_errdetail(client->saslconn));
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
if (serveroutlen > REMOTE_AUTH_SASL_DATA_MAX) {
qemudLog(QEMUD_ERR, _("sasl start reply data too long %d"),
serveroutlen);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
/* NB, distinction of NULL vs "" is *critical* in SASL */
if (serverout) {
if (VIR_ALLOC_N(ret->data.data_val, serveroutlen) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
memcpy(ret->data.data_val, serverout, serveroutlen);
} else {
@@ -2636,12 +2673,12 @@ remoteDispatchAuthSaslStart (struct qemu
if (err == SASL_CONTINUE) {
ret->complete = 0;
} else {
- if (remoteSASLCheckSSF(client, req) < 0)
- return -2;
+ if (remoteSASLCheckSSF(client, rerr) < 0)
+ return -1;
/* Check username whitelist ACL */
- if (remoteSASLCheckAccess(server, client, req) < 0)
- return -2;
+ if (remoteSASLCheckAccess(server, client, rerr) < 0)
+ return -1;
REMOTE_DEBUG("Authentication successful %d", client->fd);
ret->complete = 1;
@@ -2655,7 +2692,7 @@ static int
static int
remoteDispatchAuthSaslStep (struct qemud_server *server,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_auth_sasl_step_args *args,
remote_auth_sasl_step_ret *ret)
{
@@ -2667,8 +2704,8 @@ remoteDispatchAuthSaslStep (struct qemud
if (client->auth != REMOTE_AUTH_SASL ||
client->saslconn == NULL) {
qemudLog(QEMUD_ERR, "%s", _("client tried invalid SASL start request"));
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
REMOTE_DEBUG("Using SASL Data %d bytes, nil: %d",
@@ -2685,8 +2722,8 @@ remoteDispatchAuthSaslStep (struct qemud
err, sasl_errdetail(client->saslconn));
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
if (serveroutlen > REMOTE_AUTH_SASL_DATA_MAX) {
@@ -2694,15 +2731,15 @@ remoteDispatchAuthSaslStep (struct qemud
serveroutlen);
sasl_dispose(&client->saslconn);
client->saslconn = NULL;
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
/* NB, distinction of NULL vs "" is *critical* in SASL */
if (serverout) {
if (VIR_ALLOC_N(ret->data.data_val, serveroutlen) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
memcpy(ret->data.data_val, serverout, serveroutlen);
} else {
@@ -2715,12 +2752,12 @@ remoteDispatchAuthSaslStep (struct qemud
if (err == SASL_CONTINUE) {
ret->complete = 0;
} else {
- if (remoteSASLCheckSSF(client, req) < 0)
- return -2;
+ if (remoteSASLCheckSSF(client, rerr) < 0)
+ return -1;
/* Check username whitelist ACL */
- if (remoteSASLCheckAccess(server, client, req) < 0)
- return -2;
+ if (remoteSASLCheckAccess(server, client, rerr) < 0)
+ return -1;
REMOTE_DEBUG("Authentication successful %d", client->fd);
ret->complete = 1;
@@ -2735,36 +2772,36 @@ static int
static int
remoteDispatchAuthSaslInit (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_auth_sasl_init_ret *ret ATTRIBUTE_UNUSED)
{
qemudLog(QEMUD_ERR, "%s", _("client tried unsupported SASL init request"));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
return -1;
}
static int
remoteDispatchAuthSaslStart (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_auth_sasl_start_args *args ATTRIBUTE_UNUSED,
remote_auth_sasl_start_ret *ret ATTRIBUTE_UNUSED)
{
qemudLog(QEMUD_ERR, "%s", _("client tried unsupported SASL start request"));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
return -1;
}
static int
remoteDispatchAuthSaslStep (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_auth_sasl_step_args *args ATTRIBUTE_UNUSED,
remote_auth_sasl_step_ret *ret ATTRIBUTE_UNUSED)
{
qemudLog(QEMUD_ERR, "%s", _("client tried unsupported SASL step request"));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
return -1;
}
#endif /* HAVE_SASL */
@@ -2774,7 +2811,7 @@ static int
static int
remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_auth_polkit_ret *ret)
{
@@ -2794,14 +2831,14 @@ remoteDispatchAuthPolkit (struct qemud_s
if (client->auth != REMOTE_AUTH_POLKIT) {
qemudLog(QEMUD_ERR,
"%s", _("client tried invalid PolicyKit init request"));
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
if (qemudGetSocketIdentity(client->fd, &callerUid, &callerPid) < 0) {
qemudLog(QEMUD_ERR, "%s", _("cannot get peer socket identity"));
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
qemudLog(QEMUD_INFO, _("Checking PID %d running as %d"),
@@ -2812,16 +2849,16 @@ remoteDispatchAuthPolkit (struct qemud_s
qemudLog(QEMUD_ERR, _("Failed to lookup policy kit caller: %s"),
err.message);
dbus_error_free(&err);
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
if (!(pkaction = polkit_action_new())) {
qemudLog(QEMUD_ERR, _("Failed to create polkit action %s\n"),
strerror(errno));
polkit_caller_unref(pkcaller);
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
polkit_action_set_action_id(pkaction, action);
@@ -2835,8 +2872,8 @@ remoteDispatchAuthPolkit (struct qemud_s
polkit_caller_unref(pkcaller);
polkit_action_unref(pkaction);
dbus_error_free(&err);
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
#if HAVE_POLKIT_CONTEXT_IS_CALLER_AUTHORIZED
@@ -2850,8 +2887,8 @@ remoteDispatchAuthPolkit (struct qemud_s
_("Policy kit failed to check authorization %d %s"),
polkit_error_get_error_code(pkerr),
polkit_error_get_error_message(pkerr));
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
#else
pkresult = polkit_context_can_caller_do_action(pkcontext,
@@ -2867,8 +2904,8 @@ remoteDispatchAuthPolkit (struct qemud_s
" result: %s\n"),
action, callerPid, callerUid,
polkit_result_to_string_representation(pkresult));
- remoteDispatchFailAuth(client, req);
- return -2;
+ remoteDispatchAuthError(rerr);
+ return -1;
}
qemudLog(QEMUD_INFO,
_("Policy allowed action %s from pid %d, uid %d, result %s"),
@@ -2884,14 +2921,14 @@ remoteDispatchAuthPolkit (struct qemud_s
static int
remoteDispatchAuthPolkit (struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client,
- remote_message_header *req,
- void *args ATTRIBUTE_UNUSED,
- remote_auth_polkit_ret *ret ATTRIBUTE_UNUSED)
+ struct qemud_client *client,
+ remote_error *rerr,
+ void *args ATTRIBUTE_UNUSED,
+ remote_auth_polkit_ret *ret ATTRIBUTE_UNUSED)
{
qemudLog(QEMUD_ERR,
"%s", _("client tried unsupported PolicyKit init request"));
- remoteDispatchFailAuth(client, req);
+ remoteDispatchAuthError(rerr);
return -1;
}
#endif /* HAVE_POLKIT */
@@ -2905,22 +2942,22 @@ static int
static int
remoteDispatchListDefinedStoragePools (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_list_defined_storage_pools_args *args,
remote_list_defined_storage_pools_ret *ret)
{
CHECK_CONN(client);
if (args->maxnames > REMOTE_NETWORK_NAME_LIST_MAX) {
- remoteDispatchError (client, req,
- "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
- return -2;
+ remoteDispatchFormatError (rerr,
+ "%s", _("maxnames > REMOTE_NETWORK_NAME_LIST_MAX"));
+ return -1;
}
/* Allocate return buffer. */
if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -2928,6 +2965,7 @@ remoteDispatchListDefinedStoragePools (s
ret->names.names_val, args->maxnames);
if (ret->names.names_len == -1) {
VIR_FREE(ret->names.names_val);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -2937,22 +2975,22 @@ static int
static int
remoteDispatchListStoragePools (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_list_storage_pools_args *args,
remote_list_storage_pools_ret *ret)
{
CHECK_CONN(client);
if (args->maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX) {
- remoteDispatchError (client, req,
- "%s", _("maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX"));
- return -2;
+ remoteDispatchFormatError (rerr,
+ "%s", _("maxnames > REMOTE_STORAGE_POOL_NAME_LIST_MAX"));
+ return -1;
}
/* Allocate return buffer. */
if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -2960,6 +2998,7 @@ remoteDispatchListStoragePools (struct q
ret->names.names_val, args->maxnames);
if (ret->names.names_len == -1) {
VIR_FREE(ret->names.names_val);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -2969,7 +3008,7 @@ static int
static int
remoteDispatchFindStoragePoolSources (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_find_storage_pool_sources_args *args,
remote_find_storage_pool_sources_ret *ret)
{
@@ -2980,8 +3019,10 @@ remoteDispatchFindStoragePoolSources (st
args->type,
args->srcSpec ? *args->srcSpec : NULL,
args->flags);
- if (ret->xml == NULL)
+ if (ret->xml == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
return -1;
+ }
return 0;
}
@@ -2990,7 +3031,7 @@ static int
static int
remoteDispatchStoragePoolCreate (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_create_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -2999,12 +3040,13 @@ remoteDispatchStoragePoolCreate (struct
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStoragePoolCreate (pool, args->flags) == -1) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStoragePoolFree(pool);
@@ -3014,7 +3056,7 @@ static int
static int
remoteDispatchStoragePoolCreateXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_create_xml_args *args,
remote_storage_pool_create_xml_ret *ret)
{
@@ -3022,7 +3064,10 @@ remoteDispatchStoragePoolCreateXml (stru
CHECK_CONN(client);
pool = virStoragePoolCreateXML (client->conn, args->xml, args->flags);
- if (pool == NULL) return -1;
+ if (pool == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_storage_pool (&ret->pool, pool);
virStoragePoolFree(pool);
@@ -3032,7 +3077,7 @@ static int
static int
remoteDispatchStoragePoolDefineXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_define_xml_args *args,
remote_storage_pool_define_xml_ret *ret)
{
@@ -3040,7 +3085,10 @@ remoteDispatchStoragePoolDefineXml (stru
CHECK_CONN(client);
pool = virStoragePoolDefineXML (client->conn, args->xml, args->flags);
- if (pool == NULL) return -1;
+ if (pool == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_storage_pool (&ret->pool, pool);
virStoragePoolFree(pool);
@@ -3049,22 +3097,23 @@ remoteDispatchStoragePoolDefineXml (stru
static int
remoteDispatchStoragePoolBuild (struct qemud_server *server ATTRIBUTE_UNUSED,
- struct qemud_client *client,
- remote_message_header *req,
- remote_storage_pool_build_args *args,
- void *ret ATTRIBUTE_UNUSED)
+ struct qemud_client *client,
+ remote_error *rerr,
+ remote_storage_pool_build_args *args,
+ void *ret ATTRIBUTE_UNUSED)
{
virStoragePoolPtr pool;
CHECK_CONN(client);
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStoragePoolBuild (pool, args->flags) == -1) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStoragePoolFree(pool);
@@ -3075,7 +3124,7 @@ static int
static int
remoteDispatchStoragePoolDestroy (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_destroy_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -3084,12 +3133,13 @@ remoteDispatchStoragePoolDestroy (struct
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStoragePoolDestroy (pool) == -1) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStoragePoolFree(pool);
@@ -3099,7 +3149,7 @@ static int
static int
remoteDispatchStoragePoolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_delete_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -3108,12 +3158,13 @@ remoteDispatchStoragePoolDelete (struct
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStoragePoolDelete (pool, args->flags) == -1) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStoragePoolFree(pool);
@@ -3123,7 +3174,7 @@ static int
static int
remoteDispatchStoragePoolRefresh (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_refresh_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -3132,12 +3183,13 @@ remoteDispatchStoragePoolRefresh (struct
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStoragePoolRefresh (pool, args->flags) == -1) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStoragePoolFree(pool);
@@ -3147,7 +3199,7 @@ static int
static int
remoteDispatchStoragePoolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_get_info_args *args,
remote_storage_pool_get_info_ret *ret)
{
@@ -3157,12 +3209,13 @@ remoteDispatchStoragePoolGetInfo (struct
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStoragePoolGetInfo (pool, &info) == -1) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -3179,7 +3232,7 @@ static int
static int
remoteDispatchStoragePoolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_dump_xml_args *args,
remote_storage_pool_dump_xml_ret *ret)
{
@@ -3188,14 +3241,15 @@ remoteDispatchStoragePoolDumpXml (struct
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
/* remoteDispatchClientRequest will free this. */
ret->xml = virStoragePoolGetXMLDesc (pool, args->flags);
if (!ret->xml) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStoragePoolFree(pool);
@@ -3205,7 +3259,7 @@ static int
static int
remoteDispatchStoragePoolGetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_get_autostart_args *args,
remote_storage_pool_get_autostart_ret *ret)
{
@@ -3214,12 +3268,13 @@ remoteDispatchStoragePoolGetAutostart (s
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStoragePoolGetAutostart (pool, &ret->autostart) == -1) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStoragePoolFree(pool);
@@ -3230,7 +3285,7 @@ static int
static int
remoteDispatchStoragePoolLookupByName (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_lookup_by_name_args *args,
remote_storage_pool_lookup_by_name_ret *ret)
{
@@ -3238,7 +3293,10 @@ remoteDispatchStoragePoolLookupByName (s
CHECK_CONN(client);
pool = virStoragePoolLookupByName (client->conn, args->name);
- if (pool == NULL) return -1;
+ if (pool == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_storage_pool (&ret->pool, pool);
virStoragePoolFree(pool);
@@ -3248,7 +3306,7 @@ static int
static int
remoteDispatchStoragePoolLookupByUuid (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_lookup_by_uuid_args *args,
remote_storage_pool_lookup_by_uuid_ret *ret)
{
@@ -3256,7 +3314,10 @@ remoteDispatchStoragePoolLookupByUuid (s
CHECK_CONN(client);
pool = virStoragePoolLookupByUUID (client->conn, (unsigned char *) args->uuid);
- if (pool == NULL) return -1;
+ if (pool == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_storage_pool (&ret->pool, pool);
virStoragePoolFree(pool);
@@ -3266,7 +3327,7 @@ static int
static int
remoteDispatchStoragePoolLookupByVolume (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_lookup_by_volume_args *args,
remote_storage_pool_lookup_by_volume_ret *ret)
{
@@ -3275,10 +3336,17 @@ remoteDispatchStoragePoolLookupByVolume
CHECK_CONN(client);
vol = get_nonnull_storage_vol (client->conn, args->vol);
+ if (vol == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
pool = virStoragePoolLookupByVolume (vol);
virStorageVolFree(vol);
- if (pool == NULL) return -1;
+ if (pool == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_storage_pool (&ret->pool, pool);
virStoragePoolFree(pool);
@@ -3288,7 +3356,7 @@ static int
static int
remoteDispatchStoragePoolSetAutostart (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_set_autostart_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -3297,12 +3365,13 @@ remoteDispatchStoragePoolSetAutostart (s
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStoragePoolSetAutostart (pool, args->autostart) == -1) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStoragePoolFree(pool);
@@ -3312,7 +3381,7 @@ static int
static int
remoteDispatchStoragePoolUndefine (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_undefine_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -3321,12 +3390,13 @@ remoteDispatchStoragePoolUndefine (struc
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStoragePoolUndefine (pool) == -1) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStoragePoolFree(pool);
@@ -3336,14 +3406,17 @@ static int
static int
remoteDispatchNumOfStoragePools (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_num_of_storage_pools_ret *ret)
{
CHECK_CONN(client);
ret->num = virConnectNumOfStoragePools (client->conn);
- if (ret->num == -1) return -1;
+ if (ret->num == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -3351,14 +3424,17 @@ static int
static int
remoteDispatchNumOfDefinedStoragePools (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_num_of_defined_storage_pools_ret *ret)
{
CHECK_CONN(client);
ret->num = virConnectNumOfDefinedStoragePools (client->conn);
- if (ret->num == -1) return -1;
+ if (ret->num == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -3366,7 +3442,7 @@ static int
static int
remoteDispatchStoragePoolListVolumes (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_list_volumes_args *args,
remote_storage_pool_list_volumes_ret *ret)
{
@@ -3374,22 +3450,22 @@ remoteDispatchStoragePoolListVolumes (st
CHECK_CONN(client);
if (args->maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX) {
- remoteDispatchError (client, req,
- "%s", _("maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX"));
- return -2;
+ remoteDispatchFormatError (rerr,
+ "%s", _("maxnames > REMOTE_STORAGE_VOL_NAME_LIST_MAX"));
+ return -1;
}
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
/* Allocate return buffer. */
if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
virStoragePoolFree(pool);
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -3398,6 +3474,7 @@ remoteDispatchStoragePoolListVolumes (st
virStoragePoolFree(pool);
if (ret->names.names_len == -1) {
VIR_FREE(ret->names.names_val);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -3408,7 +3485,7 @@ static int
static int
remoteDispatchStoragePoolNumOfVolumes (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_pool_num_of_volumes_args *args,
remote_storage_pool_num_of_volumes_ret *ret)
{
@@ -3417,13 +3494,16 @@ remoteDispatchStoragePoolNumOfVolumes (s
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
ret->num = virStoragePoolNumOfVolumes (pool);
virStoragePoolFree(pool);
- if (ret->num == -1) return -1;
+ if (ret->num == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -3438,7 +3518,7 @@ static int
static int
remoteDispatchStorageVolCreateXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_vol_create_xml_args *args,
remote_storage_vol_create_xml_ret *ret)
{
@@ -3448,13 +3528,16 @@ remoteDispatchStorageVolCreateXml (struc
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
vol = virStorageVolCreateXML (pool, args->xml, args->flags);
virStoragePoolFree(pool);
- if (vol == NULL) return -1;
+ if (vol == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_storage_vol (&ret->vol, vol);
virStorageVolFree(vol);
@@ -3465,7 +3548,7 @@ static int
static int
remoteDispatchStorageVolDelete (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_vol_delete_args *args,
void *ret ATTRIBUTE_UNUSED)
{
@@ -3474,12 +3557,13 @@ remoteDispatchStorageVolDelete (struct q
vol = get_nonnull_storage_vol (client->conn, args->vol);
if (vol == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_vol not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStorageVolDelete (vol, args->flags) == -1) {
virStorageVolFree(vol);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStorageVolFree(vol);
@@ -3489,7 +3573,7 @@ static int
static int
remoteDispatchStorageVolGetInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_vol_get_info_args *args,
remote_storage_vol_get_info_ret *ret)
{
@@ -3499,12 +3583,13 @@ remoteDispatchStorageVolGetInfo (struct
vol = get_nonnull_storage_vol (client->conn, args->vol);
if (vol == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_vol not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStorageVolGetInfo (vol, &info) == -1) {
virStorageVolFree(vol);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -3520,7 +3605,7 @@ static int
static int
remoteDispatchStorageVolDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_vol_dump_xml_args *args,
remote_storage_vol_dump_xml_ret *ret)
{
@@ -3529,14 +3614,15 @@ remoteDispatchStorageVolDumpXml (struct
vol = get_nonnull_storage_vol (client->conn, args->vol);
if (vol == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_vol not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
/* remoteDispatchClientRequest will free this. */
ret->xml = virStorageVolGetXMLDesc (vol, args->flags);
if (!ret->xml) {
virStorageVolFree(vol);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStorageVolFree(vol);
@@ -3547,7 +3633,7 @@ static int
static int
remoteDispatchStorageVolGetPath (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_vol_get_path_args *args,
remote_storage_vol_get_path_ret *ret)
{
@@ -3556,14 +3642,15 @@ remoteDispatchStorageVolGetPath (struct
vol = get_nonnull_storage_vol (client->conn, args->vol);
if (vol == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_vol not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
/* remoteDispatchClientRequest will free this. */
ret->name = virStorageVolGetPath (vol);
if (!ret->name) {
virStorageVolFree(vol);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStorageVolFree(vol);
@@ -3574,7 +3661,7 @@ static int
static int
remoteDispatchStorageVolLookupByName (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_vol_lookup_by_name_args *args,
remote_storage_vol_lookup_by_name_ret *ret)
{
@@ -3584,13 +3671,16 @@ remoteDispatchStorageVolLookupByName (st
pool = get_nonnull_storage_pool (client->conn, args->pool);
if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not found"));
- return -2;
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
vol = virStorageVolLookupByName (pool, args->name);
virStoragePoolFree(pool);
- if (vol == NULL) return -1;
+ if (vol == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_storage_vol (&ret->vol, vol);
virStorageVolFree(vol);
@@ -3600,7 +3690,7 @@ static int
static int
remoteDispatchStorageVolLookupByKey (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_vol_lookup_by_key_args *args,
remote_storage_vol_lookup_by_key_ret *ret)
{
@@ -3608,7 +3698,10 @@ remoteDispatchStorageVolLookupByKey (str
CHECK_CONN(client);
vol = virStorageVolLookupByKey (client->conn, args->key);
- if (vol == NULL) return -1;
+ if (vol == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_storage_vol (&ret->vol, vol);
virStorageVolFree(vol);
@@ -3619,7 +3712,7 @@ static int
static int
remoteDispatchStorageVolLookupByPath (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_storage_vol_lookup_by_path_args *args,
remote_storage_vol_lookup_by_path_ret *ret)
{
@@ -3627,7 +3720,10 @@ remoteDispatchStorageVolLookupByPath (st
CHECK_CONN(client);
vol = virStorageVolLookupByPath (client->conn, args->path);
- if (vol == NULL) return -1;
+ if (vol == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_storage_vol (&ret->vol, vol);
virStorageVolFree(vol);
diff --git a/qemud/remote_dispatch_prototypes.h b/qemud/remote_dispatch_prototypes.h
--- a/qemud/remote_dispatch_prototypes.h
+++ b/qemud/remote_dispatch_prototypes.h
@@ -2,107 +2,107 @@
* Do not edit this file. Any changes you make will be lost.
*/
-static int remoteDispatchAuthList (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_auth_list_ret *ret);
-static int remoteDispatchAuthPolkit (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_auth_polkit_ret *ret);
-static int remoteDispatchAuthSaslInit (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_auth_sasl_init_ret *ret);
-static int remoteDispatchAuthSaslStart (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_auth_sasl_start_args *args, remote_auth_sasl_start_ret *ret);
-static int remoteDispatchAuthSaslStep (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_auth_sasl_step_args *args, remote_auth_sasl_step_ret *ret);
-static int remoteDispatchClose (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, void *ret);
-static int remoteDispatchDomainAttachDevice (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_attach_device_args *args, void *ret);
-static int remoteDispatchDomainBlockPeek (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_block_peek_args *args, remote_domain_block_peek_ret *ret);
-static int remoteDispatchDomainBlockStats (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_block_stats_args *args, remote_domain_block_stats_ret *ret);
-static int remoteDispatchDomainCoreDump (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_core_dump_args *args, void *ret);
-static int remoteDispatchDomainCreate (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_create_args *args, void *ret);
-static int remoteDispatchDomainCreateXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_create_xml_args *args, remote_domain_create_xml_ret *ret);
-static int remoteDispatchDomainDefineXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_define_xml_args *args, remote_domain_define_xml_ret *ret);
-static int remoteDispatchDomainDestroy (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_destroy_args *args, void *ret);
-static int remoteDispatchDomainDetachDevice (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_detach_device_args *args, void *ret);
-static int remoteDispatchDomainDumpXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_dump_xml_args *args, remote_domain_dump_xml_ret *ret);
-static int remoteDispatchDomainGetAutostart (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_autostart_args *args, remote_domain_get_autostart_ret *ret);
-static int remoteDispatchDomainGetInfo (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_info_args *args, remote_domain_get_info_ret *ret);
-static int remoteDispatchDomainGetMaxMemory (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_max_memory_args *args, remote_domain_get_max_memory_ret *ret);
-static int remoteDispatchDomainGetMaxVcpus (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_max_vcpus_args *args, remote_domain_get_max_vcpus_ret *ret);
-static int remoteDispatchDomainGetOsType (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_os_type_args *args, remote_domain_get_os_type_ret *ret);
-static int remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_scheduler_parameters_args *args, remote_domain_get_scheduler_parameters_ret *ret);
-static int remoteDispatchDomainGetSchedulerType (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_scheduler_type_args *args, remote_domain_get_scheduler_type_ret *ret);
-static int remoteDispatchDomainGetVcpus (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_get_vcpus_args *args, remote_domain_get_vcpus_ret *ret);
-static int remoteDispatchDomainInterfaceStats (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_interface_stats_args *args, remote_domain_interface_stats_ret *ret);
-static int remoteDispatchDomainLookupById (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_lookup_by_id_args *args, remote_domain_lookup_by_id_ret *ret);
-static int remoteDispatchDomainLookupByName (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_lookup_by_name_args *args, remote_domain_lookup_by_name_ret *ret);
-static int remoteDispatchDomainLookupByUuid (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_lookup_by_uuid_args *args, remote_domain_lookup_by_uuid_ret *ret);
-static int remoteDispatchDomainMemoryPeek (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_memory_peek_args *args, remote_domain_memory_peek_ret *ret);
-static int remoteDispatchDomainMigrateFinish (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_migrate_finish_args *args, remote_domain_migrate_finish_ret *ret);
-static int remoteDispatchDomainMigratePerform (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_migrate_perform_args *args, void *ret);
-static int remoteDispatchDomainMigratePrepare (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_migrate_prepare_args *args, remote_domain_migrate_prepare_ret *ret);
-static int remoteDispatchDomainPinVcpu (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_pin_vcpu_args *args, void *ret);
-static int remoteDispatchDomainReboot (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_reboot_args *args, void *ret);
-static int remoteDispatchDomainRestore (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_restore_args *args, void *ret);
-static int remoteDispatchDomainResume (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_resume_args *args, void *ret);
-static int remoteDispatchDomainSave (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_save_args *args, void *ret);
-static int remoteDispatchDomainSetAutostart (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_set_autostart_args *args, void *ret);
-static int remoteDispatchDomainSetMaxMemory (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_set_max_memory_args *args, void *ret);
-static int remoteDispatchDomainSetMemory (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_set_memory_args *args, void *ret);
-static int remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_set_scheduler_parameters_args *args, void *ret);
-static int remoteDispatchDomainSetVcpus (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_set_vcpus_args *args, void *ret);
-static int remoteDispatchDomainShutdown (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_shutdown_args *args, void *ret);
-static int remoteDispatchDomainSuspend (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_suspend_args *args, void *ret);
-static int remoteDispatchDomainUndefine (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_domain_undefine_args *args, void *ret);
-static int remoteDispatchFindStoragePoolSources (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_find_storage_pool_sources_args *args, remote_find_storage_pool_sources_ret *ret);
-static int remoteDispatchGetCapabilities (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_get_capabilities_ret *ret);
-static int remoteDispatchGetHostname (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_get_hostname_ret *ret);
-static int remoteDispatchGetMaxVcpus (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_get_max_vcpus_args *args, remote_get_max_vcpus_ret *ret);
-static int remoteDispatchGetType (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_get_type_ret *ret);
-static int remoteDispatchGetVersion (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_get_version_ret *ret);
-static int remoteDispatchListDefinedDomains (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_list_defined_domains_args *args, remote_list_defined_domains_ret *ret);
-static int remoteDispatchListDefinedNetworks (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_list_defined_networks_args *args, remote_list_defined_networks_ret *ret);
-static int remoteDispatchListDefinedStoragePools (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_list_defined_storage_pools_args *args, remote_list_defined_storage_pools_ret *ret);
-static int remoteDispatchListDomains (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_list_domains_args *args, remote_list_domains_ret *ret);
-static int remoteDispatchListNetworks (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_list_networks_args *args, remote_list_networks_ret *ret);
-static int remoteDispatchListStoragePools (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_list_storage_pools_args *args, remote_list_storage_pools_ret *ret);
-static int remoteDispatchNetworkCreate (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_create_args *args, void *ret);
-static int remoteDispatchNetworkCreateXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_create_xml_args *args, remote_network_create_xml_ret *ret);
-static int remoteDispatchNetworkDefineXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_define_xml_args *args, remote_network_define_xml_ret *ret);
-static int remoteDispatchNetworkDestroy (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_destroy_args *args, void *ret);
-static int remoteDispatchNetworkDumpXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_dump_xml_args *args, remote_network_dump_xml_ret *ret);
-static int remoteDispatchNetworkGetAutostart (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_get_autostart_args *args, remote_network_get_autostart_ret *ret);
-static int remoteDispatchNetworkGetBridgeName (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_get_bridge_name_args *args, remote_network_get_bridge_name_ret *ret);
-static int remoteDispatchNetworkLookupByName (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_lookup_by_name_args *args, remote_network_lookup_by_name_ret *ret);
-static int remoteDispatchNetworkLookupByUuid (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_lookup_by_uuid_args *args, remote_network_lookup_by_uuid_ret *ret);
-static int remoteDispatchNetworkSetAutostart (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_set_autostart_args *args, void *ret);
-static int remoteDispatchNetworkUndefine (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_network_undefine_args *args, void *ret);
-static int remoteDispatchNodeGetCellsFreeMemory (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_node_get_cells_free_memory_args *args, remote_node_get_cells_free_memory_ret *ret);
-static int remoteDispatchNodeGetFreeMemory (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_node_get_free_memory_ret *ret);
-static int remoteDispatchNodeGetInfo (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_node_get_info_ret *ret);
-static int remoteDispatchNumOfDefinedDomains (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_num_of_defined_domains_ret *ret);
-static int remoteDispatchNumOfDefinedNetworks (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_num_of_defined_networks_ret *ret);
-static int remoteDispatchNumOfDefinedStoragePools (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_num_of_defined_storage_pools_ret *ret);
-static int remoteDispatchNumOfDomains (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_num_of_domains_ret *ret);
-static int remoteDispatchNumOfNetworks (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_num_of_networks_ret *ret);
-static int remoteDispatchNumOfStoragePools (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, void *args, remote_num_of_storage_pools_ret *ret);
-static int remoteDispatchOpen (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_open_args *args, void *ret);
-static int remoteDispatchStoragePoolBuild (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_build_args *args, void *ret);
-static int remoteDispatchStoragePoolCreate (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_create_args *args, void *ret);
-static int remoteDispatchStoragePoolCreateXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_create_xml_args *args, remote_storage_pool_create_xml_ret *ret);
-static int remoteDispatchStoragePoolDefineXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_define_xml_args *args, remote_storage_pool_define_xml_ret *ret);
-static int remoteDispatchStoragePoolDelete (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_delete_args *args, void *ret);
-static int remoteDispatchStoragePoolDestroy (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_destroy_args *args, void *ret);
-static int remoteDispatchStoragePoolDumpXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_dump_xml_args *args, remote_storage_pool_dump_xml_ret *ret);
-static int remoteDispatchStoragePoolGetAutostart (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_get_autostart_args *args, remote_storage_pool_get_autostart_ret *ret);
-static int remoteDispatchStoragePoolGetInfo (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_get_info_args *args, remote_storage_pool_get_info_ret *ret);
-static int remoteDispatchStoragePoolListVolumes (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_list_volumes_args *args, remote_storage_pool_list_volumes_ret *ret);
-static int remoteDispatchStoragePoolLookupByName (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_lookup_by_name_args *args, remote_storage_pool_lookup_by_name_ret *ret);
-static int remoteDispatchStoragePoolLookupByUuid (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_lookup_by_uuid_args *args, remote_storage_pool_lookup_by_uuid_ret *ret);
-static int remoteDispatchStoragePoolLookupByVolume (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_lookup_by_volume_args *args, remote_storage_pool_lookup_by_volume_ret *ret);
-static int remoteDispatchStoragePoolNumOfVolumes (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_num_of_volumes_args *args, remote_storage_pool_num_of_volumes_ret *ret);
-static int remoteDispatchStoragePoolRefresh (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_refresh_args *args, void *ret);
-static int remoteDispatchStoragePoolSetAutostart (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_set_autostart_args *args, void *ret);
-static int remoteDispatchStoragePoolUndefine (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_pool_undefine_args *args, void *ret);
-static int remoteDispatchStorageVolCreateXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_vol_create_xml_args *args, remote_storage_vol_create_xml_ret *ret);
-static int remoteDispatchStorageVolDelete (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_vol_delete_args *args, void *ret);
-static int remoteDispatchStorageVolDumpXml (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_vol_dump_xml_args *args, remote_storage_vol_dump_xml_ret *ret);
-static int remoteDispatchStorageVolGetInfo (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_vol_get_info_args *args, remote_storage_vol_get_info_ret *ret);
-static int remoteDispatchStorageVolGetPath (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_vol_get_path_args *args, remote_storage_vol_get_path_ret *ret);
-static int remoteDispatchStorageVolLookupByKey (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_vol_lookup_by_key_args *args, remote_storage_vol_lookup_by_key_ret *ret);
-static int remoteDispatchStorageVolLookupByName (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_vol_lookup_by_name_args *args, remote_storage_vol_lookup_by_name_ret *ret);
-static int remoteDispatchStorageVolLookupByPath (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_storage_vol_lookup_by_path_args *args, remote_storage_vol_lookup_by_path_ret *ret);
-static int remoteDispatchSupportsFeature (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, remote_supports_feature_args *args, remote_supports_feature_ret *ret);
+static int remoteDispatchAuthList (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_auth_list_ret *ret);
+static int remoteDispatchAuthPolkit (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_auth_polkit_ret *ret);
+static int remoteDispatchAuthSaslInit (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_auth_sasl_init_ret *ret);
+static int remoteDispatchAuthSaslStart (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_auth_sasl_start_args *args, remote_auth_sasl_start_ret *ret);
+static int remoteDispatchAuthSaslStep (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_auth_sasl_step_args *args, remote_auth_sasl_step_ret *ret);
+static int remoteDispatchClose (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, void *ret);
+static int remoteDispatchDomainAttachDevice (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_attach_device_args *args, void *ret);
+static int remoteDispatchDomainBlockPeek (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_block_peek_args *args, remote_domain_block_peek_ret *ret);
+static int remoteDispatchDomainBlockStats (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_block_stats_args *args, remote_domain_block_stats_ret *ret);
+static int remoteDispatchDomainCoreDump (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_core_dump_args *args, void *ret);
+static int remoteDispatchDomainCreate (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_create_args *args, void *ret);
+static int remoteDispatchDomainCreateXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_create_xml_args *args, remote_domain_create_xml_ret *ret);
+static int remoteDispatchDomainDefineXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_define_xml_args *args, remote_domain_define_xml_ret *ret);
+static int remoteDispatchDomainDestroy (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_destroy_args *args, void *ret);
+static int remoteDispatchDomainDetachDevice (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_detach_device_args *args, void *ret);
+static int remoteDispatchDomainDumpXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_dump_xml_args *args, remote_domain_dump_xml_ret *ret);
+static int remoteDispatchDomainGetAutostart (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_get_autostart_args *args, remote_domain_get_autostart_ret *ret);
+static int remoteDispatchDomainGetInfo (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_get_info_args *args, remote_domain_get_info_ret *ret);
+static int remoteDispatchDomainGetMaxMemory (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_get_max_memory_args *args, remote_domain_get_max_memory_ret *ret);
+static int remoteDispatchDomainGetMaxVcpus (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_get_max_vcpus_args *args, remote_domain_get_max_vcpus_ret *ret);
+static int remoteDispatchDomainGetOsType (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_get_os_type_args *args, remote_domain_get_os_type_ret *ret);
+static int remoteDispatchDomainGetSchedulerParameters (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_get_scheduler_parameters_args *args, remote_domain_get_scheduler_parameters_ret *ret);
+static int remoteDispatchDomainGetSchedulerType (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_get_scheduler_type_args *args, remote_domain_get_scheduler_type_ret *ret);
+static int remoteDispatchDomainGetVcpus (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_get_vcpus_args *args, remote_domain_get_vcpus_ret *ret);
+static int remoteDispatchDomainInterfaceStats (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_interface_stats_args *args, remote_domain_interface_stats_ret *ret);
+static int remoteDispatchDomainLookupById (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_lookup_by_id_args *args, remote_domain_lookup_by_id_ret *ret);
+static int remoteDispatchDomainLookupByName (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_lookup_by_name_args *args, remote_domain_lookup_by_name_ret *ret);
+static int remoteDispatchDomainLookupByUuid (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_lookup_by_uuid_args *args, remote_domain_lookup_by_uuid_ret *ret);
+static int remoteDispatchDomainMemoryPeek (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_memory_peek_args *args, remote_domain_memory_peek_ret *ret);
+static int remoteDispatchDomainMigrateFinish (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_migrate_finish_args *args, remote_domain_migrate_finish_ret *ret);
+static int remoteDispatchDomainMigratePerform (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_migrate_perform_args *args, void *ret);
+static int remoteDispatchDomainMigratePrepare (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_migrate_prepare_args *args, remote_domain_migrate_prepare_ret *ret);
+static int remoteDispatchDomainPinVcpu (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_pin_vcpu_args *args, void *ret);
+static int remoteDispatchDomainReboot (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_reboot_args *args, void *ret);
+static int remoteDispatchDomainRestore (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_restore_args *args, void *ret);
+static int remoteDispatchDomainResume (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_resume_args *args, void *ret);
+static int remoteDispatchDomainSave (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_save_args *args, void *ret);
+static int remoteDispatchDomainSetAutostart (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_set_autostart_args *args, void *ret);
+static int remoteDispatchDomainSetMaxMemory (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_set_max_memory_args *args, void *ret);
+static int remoteDispatchDomainSetMemory (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_set_memory_args *args, void *ret);
+static int remoteDispatchDomainSetSchedulerParameters (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_set_scheduler_parameters_args *args, void *ret);
+static int remoteDispatchDomainSetVcpus (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_set_vcpus_args *args, void *ret);
+static int remoteDispatchDomainShutdown (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_shutdown_args *args, void *ret);
+static int remoteDispatchDomainSuspend (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_suspend_args *args, void *ret);
+static int remoteDispatchDomainUndefine (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_domain_undefine_args *args, void *ret);
+static int remoteDispatchFindStoragePoolSources (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_find_storage_pool_sources_args *args, remote_find_storage_pool_sources_ret *ret);
+static int remoteDispatchGetCapabilities (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_get_capabilities_ret *ret);
+static int remoteDispatchGetHostname (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_get_hostname_ret *ret);
+static int remoteDispatchGetMaxVcpus (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_get_max_vcpus_args *args, remote_get_max_vcpus_ret *ret);
+static int remoteDispatchGetType (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_get_type_ret *ret);
+static int remoteDispatchGetVersion (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_get_version_ret *ret);
+static int remoteDispatchListDefinedDomains (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_list_defined_domains_args *args, remote_list_defined_domains_ret *ret);
+static int remoteDispatchListDefinedNetworks (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_list_defined_networks_args *args, remote_list_defined_networks_ret *ret);
+static int remoteDispatchListDefinedStoragePools (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_list_defined_storage_pools_args *args, remote_list_defined_storage_pools_ret *ret);
+static int remoteDispatchListDomains (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_list_domains_args *args, remote_list_domains_ret *ret);
+static int remoteDispatchListNetworks (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_list_networks_args *args, remote_list_networks_ret *ret);
+static int remoteDispatchListStoragePools (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_list_storage_pools_args *args, remote_list_storage_pools_ret *ret);
+static int remoteDispatchNetworkCreate (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_create_args *args, void *ret);
+static int remoteDispatchNetworkCreateXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_create_xml_args *args, remote_network_create_xml_ret *ret);
+static int remoteDispatchNetworkDefineXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_define_xml_args *args, remote_network_define_xml_ret *ret);
+static int remoteDispatchNetworkDestroy (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_destroy_args *args, void *ret);
+static int remoteDispatchNetworkDumpXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_dump_xml_args *args, remote_network_dump_xml_ret *ret);
+static int remoteDispatchNetworkGetAutostart (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_get_autostart_args *args, remote_network_get_autostart_ret *ret);
+static int remoteDispatchNetworkGetBridgeName (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_get_bridge_name_args *args, remote_network_get_bridge_name_ret *ret);
+static int remoteDispatchNetworkLookupByName (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_lookup_by_name_args *args, remote_network_lookup_by_name_ret *ret);
+static int remoteDispatchNetworkLookupByUuid (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_lookup_by_uuid_args *args, remote_network_lookup_by_uuid_ret *ret);
+static int remoteDispatchNetworkSetAutostart (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_set_autostart_args *args, void *ret);
+static int remoteDispatchNetworkUndefine (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_network_undefine_args *args, void *ret);
+static int remoteDispatchNodeGetCellsFreeMemory (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_node_get_cells_free_memory_args *args, remote_node_get_cells_free_memory_ret *ret);
+static int remoteDispatchNodeGetFreeMemory (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_node_get_free_memory_ret *ret);
+static int remoteDispatchNodeGetInfo (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_node_get_info_ret *ret);
+static int remoteDispatchNumOfDefinedDomains (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_num_of_defined_domains_ret *ret);
+static int remoteDispatchNumOfDefinedNetworks (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_num_of_defined_networks_ret *ret);
+static int remoteDispatchNumOfDefinedStoragePools (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_num_of_defined_storage_pools_ret *ret);
+static int remoteDispatchNumOfDomains (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_num_of_domains_ret *ret);
+static int remoteDispatchNumOfNetworks (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_num_of_networks_ret *ret);
+static int remoteDispatchNumOfStoragePools (struct qemud_server *server, struct qemud_client *client, remote_error *err, void *args, remote_num_of_storage_pools_ret *ret);
+static int remoteDispatchOpen (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_open_args *args, void *ret);
+static int remoteDispatchStoragePoolBuild (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_build_args *args, void *ret);
+static int remoteDispatchStoragePoolCreate (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_create_args *args, void *ret);
+static int remoteDispatchStoragePoolCreateXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_create_xml_args *args, remote_storage_pool_create_xml_ret *ret);
+static int remoteDispatchStoragePoolDefineXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_define_xml_args *args, remote_storage_pool_define_xml_ret *ret);
+static int remoteDispatchStoragePoolDelete (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_delete_args *args, void *ret);
+static int remoteDispatchStoragePoolDestroy (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_destroy_args *args, void *ret);
+static int remoteDispatchStoragePoolDumpXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_dump_xml_args *args, remote_storage_pool_dump_xml_ret *ret);
+static int remoteDispatchStoragePoolGetAutostart (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_get_autostart_args *args, remote_storage_pool_get_autostart_ret *ret);
+static int remoteDispatchStoragePoolGetInfo (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_get_info_args *args, remote_storage_pool_get_info_ret *ret);
+static int remoteDispatchStoragePoolListVolumes (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_list_volumes_args *args, remote_storage_pool_list_volumes_ret *ret);
+static int remoteDispatchStoragePoolLookupByName (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_lookup_by_name_args *args, remote_storage_pool_lookup_by_name_ret *ret);
+static int remoteDispatchStoragePoolLookupByUuid (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_lookup_by_uuid_args *args, remote_storage_pool_lookup_by_uuid_ret *ret);
+static int remoteDispatchStoragePoolLookupByVolume (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_lookup_by_volume_args *args, remote_storage_pool_lookup_by_volume_ret *ret);
+static int remoteDispatchStoragePoolNumOfVolumes (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_num_of_volumes_args *args, remote_storage_pool_num_of_volumes_ret *ret);
+static int remoteDispatchStoragePoolRefresh (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_refresh_args *args, void *ret);
+static int remoteDispatchStoragePoolSetAutostart (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_set_autostart_args *args, void *ret);
+static int remoteDispatchStoragePoolUndefine (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_pool_undefine_args *args, void *ret);
+static int remoteDispatchStorageVolCreateXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_vol_create_xml_args *args, remote_storage_vol_create_xml_ret *ret);
+static int remoteDispatchStorageVolDelete (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_vol_delete_args *args, void *ret);
+static int remoteDispatchStorageVolDumpXml (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_vol_dump_xml_args *args, remote_storage_vol_dump_xml_ret *ret);
+static int remoteDispatchStorageVolGetInfo (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_vol_get_info_args *args, remote_storage_vol_get_info_ret *ret);
+static int remoteDispatchStorageVolGetPath (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_vol_get_path_args *args, remote_storage_vol_get_path_ret *ret);
+static int remoteDispatchStorageVolLookupByKey (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_vol_lookup_by_key_args *args, remote_storage_vol_lookup_by_key_ret *ret);
+static int remoteDispatchStorageVolLookupByName (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_vol_lookup_by_name_args *args, remote_storage_vol_lookup_by_name_ret *ret);
+static int remoteDispatchStorageVolLookupByPath (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_storage_vol_lookup_by_path_args *args, remote_storage_vol_lookup_by_path_ret *ret);
+static int remoteDispatchSupportsFeature (struct qemud_server *server, struct qemud_client *client, remote_error *err, remote_supports_feature_args *args, remote_supports_feature_ret *ret);
diff --git a/qemud/remote_generate_stubs.pl b/qemud/remote_generate_stubs.pl
--- a/qemud/remote_generate_stubs.pl
+++ b/qemud/remote_generate_stubs.pl
@@ -100,7 +100,7 @@ elsif ($opt_p) {
elsif ($opt_p) {
my @keys = sort (keys %calls);
foreach (@keys) {
- print "static int remoteDispatch$calls{$_}->{ProcName} (struct qemud_server *server, struct qemud_client *client, remote_message_header *req, $calls{$_}->{args} *args, $calls{$_}->{ret} *ret);\n";
+ print "static int remoteDispatch$calls{$_}->{ProcName} (struct qemud_server *server, struct qemud_client *client, remote_error *err, $calls{$_}->{args} *args, $calls{$_}->{ret} *ret);\n";
}
}
diff --git a/src/domain_conf.c b/src/domain_conf.c
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -482,8 +482,12 @@ void virDomainRemoveInactive(virDomainOb
memmove(doms->objs + i, doms->objs + i + 1,
sizeof(*(doms->objs)) * (doms->count - (i + 1)));
- if (VIR_REALLOC_N(doms->objs, doms->count - 1) < 0) {
- ; /* Failure to reduce memory allocation isn't fatal */
+ if (doms->count > 1) {
+ if (VIR_REALLOC_N(doms->objs, doms->count - 1) < 0) {
+ ; /* Failure to reduce memory allocation isn't fatal */
+ }
+ } else {
+ VIR_FREE(doms->objs);
}
doms->count--;
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
16 years
[libvirt] Bridge network for VM using libvirt library
by Shanmuga Rajan
Hi
I trying to create an application to manage virtual
machines using libvirt library.
Currently i am focusing with KVM hypervisor and bridge networking.
I face two issues which i cant find a solution....
First issue:
When i tried to reboot a virtual machine (using virDomain's reboot fn).
I got exception message that there was no support in the hypervisor
for reboot. is it true that we cant reboot a KVM based VM?
Second issue:
When i tried to setup a bridge network for KVM based VM.
I got error message like this ..
"QEMU quit during console startup
bind() failed"
I have listed below my steps which i tried setup bridge network.
On Dom0
===========
<<<<
brctl addbr br0
ifconfig eth0 0.0.0.0
brctl addif br0 eth0
ifconfig br0 192.168.1.82 netmask 255.255.255.0 up
route add -net 192.168.1.0 netmask 255.255.255.0 br0
route add default gw 192.168.1.1 br0
<<<<
** dom0 IP 192.168.1.82
after that i checked the network connection of the Dom0.. it was fine.
ifconfig was fine.
then i created tun/tap device like given in the following link
http://wiki.centos.org/HowTos/KVM#head-c02a0b33e7949b0bc3b151ac6e0bdfb91b...
<<<<<
sudo tunctl -b -u john
sudo ifconfig tap1 up
sudo brctl addif br0 tap1
export SDL_VIDEO_X11_DGAMOUSE=0
sudo iptables -I INPUT -i br0 -j ACCEPT
<<<<<
then i started to define vm like this...
<domain type="kvm">
<name>test82</name>
<uuid>e5520db4-ad8a-38c3-b9d9-4e3c7a1052dc</uuid>
<memory>131072</memory>
<vcpu>1</vcpu>
<on_poweroff>destroy</on_poweroff>
<os><type arch="i686">hvm</type>
<boot dev="hd"/>
</os>
<clock sync="localtime"/>
<features>
<pae/>
<acpi/>
<apic/>
</features>
<devices>
<emulator>/usr/bin/qemu-kvm</emulator>
<disk type="file" device="disk">
<source file="/dev/FluidVM_grp/Windows_NT_2003_121560222596"/>
<target dev="hda"/>
</disk>
<interface type="bridge">
<source bridge="br0"/>
</interface>
<interface type="bridge">
<source bridge="br0"/>
<target dev="tap1"/>
<mac address="00:16:3e:8f:ca:4b" />
</interface>
<graphics type="vnc" port="5900" listen="0.0.0.0"/>
</devices>
</domain>
is anything i am missing in setting up the bridge network?
Thanks and Regards,
-- Shan
16 years
[libvirt] xen+ssh
by deface
Trying to connect to remote host via ssh. keys work fine but get this
--
*Trace - *
Unable to open connection to hypervisor URI
'xen+ssh://root@remote.boxdomain.com/':
<class 'libvirt.libvirtError'> virConnectOpenAuth() failed socket closed
unexpectedly
Traceback (most recent call last):
File "/usr/share/virt-manager/virtManager/connection.py", line 430, in
_open_thread
None], flags)
File "/usr/lib/python2.5/site-packages/libvirt.py", line 98, in openAuth
if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: virConnectOpenAuth() failed socket closed unexpectedly
*Remote Log - *
Oct 19 20:12:09 zeus sshd[1332]: Accepted publickey for root from
x.x.x.x port 52555 ssh2
Oct 19 20:12:10 zeus sshd[1336]: pam_unix(sshd:session): session opened
for user root by (uid=0)
not sure where to go - any way to enable verbose/debug logging?
deface
16 years