The current RPC handler methods have two possible return codes, -1 and -2,
both indicate that an error occurred, but one says that the error has
been serialized onto the outgoing dispatch buffer already, the other
says that the caller must do serialization. This unneccessarily complex
and has a number of errors already, so this patch makes the RPC handler
responsible for all error serialization.
qemud/qemud.c | 12
qemud/qemud.h | 5
qemud/remote.c | 1710 +++++++++++++++++++------------------
qemud/remote_dispatch_prototypes.h | 234 ++---
qemud/remote_generate_stubs.pl | 2
src/domain_conf.c | 8
6 files changed, 1049 insertions(+), 922 deletions(-)
Daniel
diff --git a/qemud/qemud.c b/qemud/qemud.c
--- a/qemud/qemud.c
+++ b/qemud/qemud.c
@@ -1396,13 +1396,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 */
@@ -1453,7 +1452,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
@@ -177,8 +177,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);
void qemudDispatchClientWrite(struct qemud_server *server,
struct qemud_client *client);
diff --git a/qemud/remote.c b/qemud/remote.c
--- a/qemud/remote.c
+++ b/qemud/remote.c
@@ -55,10 +55,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);
@@ -82,7 +81,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);
@@ -103,59 +102,151 @@ remoteDispatchDomainEventSend (struct qe
int event,
int detail);
+
+/* 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,
@@ -168,47 +259,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;
+ }
+
+ /* Call function. */
+ rv = (data->fn)(server, client, &rerr, &args, &ret);
+ xdr_free (data->args_filter, (char*)&args);
+
+rpc_error:
xdr_destroy (&xdr);
-
- /* Call function. */
- rv = (data->fn)(server, client, &req, &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;
/* Return header. */
rep.prog = req.prog;
@@ -216,217 +295,51 @@ 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_int (&xdr, &len)) {
- remoteDispatchError (client, &req, "%s", _("serialise return
length"));
- xdr_destroy (&xdr);
- return;
- }
+ if (xdr_setpos (&xdr, 0) == 0)
+ goto fatal_error;
+
+ 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;
-}
-
-/* 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;
- }
-
+ 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);
-
- /* 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);
+ return 0;
}
int remoteRelayDomainEvent (virConnectPtr conn ATTRIBUTE_UNUSED,
@@ -450,7 +363,8 @@ int remoteRelayDomainEvent (virConnectPt
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;
@@ -458,8 +372,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;
@@ -475,60 +389,76 @@ remoteDispatchOpen (struct qemud_server
? virConnectOpenReadOnly (name)
: virConnectOpen (name);
- return client->conn ? 0 : -1;
-}
-
-#define CHECK_CONN(client) \
- if (!client->conn) { \
- remoteDispatchError (client, req, "%s", _("connection not
open")); \
- return -2; \
+ if (client->conn == NULL) {
+ remoteDispatchConnError(rerr, NULL);
+ return -1;
+ }
+
+ return 0;
+}
+
+#define CHECK_CONN(client) \
+ if (!client->conn) { \
+ 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;
-
- return rv;
+ CHECK_CONN(client);
+
+ if (virConnectClose (client->conn) < 0) {
+ remoteDispatchConnError(rerr, NULL);
+ return -1;
+ }
+
+ 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;
@@ -537,15 +467,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)
- return -1;
+ if (virConnectGetVersion (client->conn, &hvVer) == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
ret->hv_ver = hvVer;
return 0;
@@ -554,7 +486,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)
{
@@ -562,7 +494,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;
@@ -571,7 +506,7 @@ static int
static int
remoteDispatchGetUri (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
void *args ATTRIBUTE_UNUSED,
remote_get_uri_ret *ret)
{
@@ -579,7 +514,10 @@ remoteDispatchGetUri (struct qemud_serve
CHECK_CONN(client);
uri = virConnectGetURI (client->conn);
- if (uri == NULL) return -1;
+ if (uri == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
ret->uri = uri;
return 0;
@@ -588,7 +526,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)
{
@@ -597,7 +535,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;
}
@@ -605,15 +546,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)
- return -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;
@@ -630,7 +573,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)
{
@@ -638,7 +581,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;
@@ -647,22 +593,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,
@@ -671,6 +617,7 @@ remoteDispatchNodeGetCellsFreeMemory (st
args->maxCells);
if (ret->freeMems.freeMems_len == 0) {
VIR_FREE(ret->freeMems.freeMems_val);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -681,7 +628,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)
{
@@ -689,8 +636,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;
}
@@ -699,7 +648,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)
{
@@ -710,13 +659,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;
}
@@ -729,7 +679,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)
{
@@ -741,25 +691,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;
}
@@ -789,7 +740,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;
}
}
@@ -799,19 +750,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)
{
@@ -823,12 +774,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. */
@@ -856,14 +807,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;
}
@@ -871,7 +825,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)
{
@@ -882,13 +836,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);
@@ -905,7 +860,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)
{
@@ -916,13 +871,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);
@@ -942,7 +898,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)
{
@@ -955,8 +911,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;
@@ -965,22 +921,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);
@@ -991,7 +948,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)
{
@@ -1003,31 +960,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"));
- virDomainFree (dom);
- return -2;
+ remoteDispatchFormatError (rerr,
+ "%s", _("size > maximum buffer
size"));
+ virDomainFree (dom);
+ return -1;
}
ret->buffer.buffer_len = size;
if (VIR_ALLOC_N (ret->buffer.buffer_val, size) < 0) {
- remoteDispatchError (client, req, "%s", strerror (errno));
- virDomainFree (dom);
- return -2;
+ remoteDispatchFormatError (rerr, "%s", strerror (errno));
+ virDomainFree (dom);
+ 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);
@@ -1038,7 +996,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)
{
@@ -1047,12 +1005,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);
@@ -1062,7 +1021,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)
{
@@ -1071,12 +1030,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);
@@ -1086,7 +1046,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)
{
@@ -1094,7 +1054,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);
@@ -1105,7 +1068,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)
{
@@ -1113,7 +1076,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);
@@ -1124,7 +1090,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)
{
@@ -1133,12 +1099,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);
@@ -1148,7 +1115,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)
{
@@ -1157,12 +1124,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;
}
@@ -1173,7 +1141,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)
{
@@ -1182,15 +1150,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;
@@ -1199,7 +1168,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)
{
@@ -1208,12 +1177,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);
@@ -1223,7 +1193,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)
{
@@ -1233,12 +1203,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;
}
@@ -1256,7 +1227,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)
{
@@ -1265,13 +1236,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);
@@ -1281,7 +1253,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)
{
@@ -1290,13 +1262,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);
@@ -1306,7 +1279,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)
{
@@ -1315,15 +1288,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;
@@ -1332,7 +1306,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)
{
@@ -1344,20 +1318,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. */
@@ -1373,6 +1347,7 @@ remoteDispatchDomainGetVcpus (struct qem
VIR_FREE(info);
VIR_FREE(cpumaps);
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -1403,14 +1378,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)
{
@@ -1427,8 +1402,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,
@@ -1436,6 +1411,7 @@ remoteDispatchDomainMigratePrepare (stru
args->flags, dname, args->resource);
if (r == -1) {
VIR_FREE(uri_out);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -1457,7 +1433,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)
{
@@ -1468,8 +1444,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;
@@ -1480,7 +1456,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;
}
@@ -1488,7 +1467,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)
{
@@ -1500,7 +1479,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);
@@ -1510,7 +1492,7 @@ static int
static int
remoteDispatchDomainMigratePrepare2 (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_migrate_prepare2_args *args,
remote_domain_migrate_prepare2_ret *ret)
{
@@ -1527,15 +1509,18 @@ remoteDispatchDomainMigratePrepare2 (str
/* 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 = virDomainMigratePrepare2 (client->conn, &cookie, &cookielen,
uri_in, uri_out,
args->flags, dname, args->resource,
args->dom_xml);
- if (r == -1) return -1;
+ if (r == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
/* remoteDispatchClientRequest will free cookie, uri_out and
* the string if there is one.
@@ -1550,7 +1535,7 @@ static int
static int
remoteDispatchDomainMigrateFinish2 (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_domain_migrate_finish2_args *args,
remote_domain_migrate_finish2_ret *ret)
{
@@ -1563,7 +1548,10 @@ remoteDispatchDomainMigrateFinish2 (stru
args->uri,
args->flags,
args->retcode);
- if (ddom == NULL) return -1;
+ if (ddom == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_domain (&ret->ddom, ddom);
@@ -1573,22 +1561,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;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- 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) {
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -1596,6 +1584,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;
}
@@ -1605,7 +1594,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)
{
@@ -1613,7 +1602,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);
@@ -1623,7 +1615,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)
{
@@ -1631,7 +1623,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);
@@ -1641,7 +1636,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)
{
@@ -1649,7 +1644,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);
@@ -1659,14 +1657,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;
}
@@ -1674,7 +1675,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)
{
@@ -1684,14 +1685,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,
@@ -1699,6 +1700,7 @@ remoteDispatchDomainPinVcpu (struct qemu
args->cpumap.cpumap_len);
if (rv == -1) {
virDomainFree(dom);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virDomainFree(dom);
@@ -1708,7 +1710,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)
{
@@ -1717,12 +1719,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);
@@ -1732,14 +1735,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)
- return -1;
+ if (virDomainRestore (client->conn, args->from) == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -1747,7 +1752,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)
{
@@ -1756,12 +1761,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);
@@ -1771,7 +1777,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)
{
@@ -1780,12 +1786,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);
@@ -1795,7 +1802,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)
{
@@ -1804,12 +1811,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);
@@ -1819,7 +1827,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)
{
@@ -1828,12 +1836,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);
@@ -1843,7 +1852,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)
{
@@ -1852,12 +1861,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);
@@ -1867,7 +1877,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)
{
@@ -1876,12 +1886,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);
@@ -1891,7 +1902,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)
{
@@ -1900,12 +1911,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);
@@ -1915,7 +1927,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)
{
@@ -1924,12 +1936,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);
@@ -1939,7 +1952,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)
{
@@ -1948,12 +1961,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);
@@ -1963,7 +1977,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)
{
@@ -1972,12 +1986,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);
@@ -1987,22 +2002,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;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- 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) {
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -2010,6 +2025,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;
}
@@ -2019,28 +2035,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;
}
@@ -2050,22 +2067,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;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- 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) {
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -2073,6 +2090,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;
}
@@ -2082,7 +2100,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)
{
@@ -2091,12 +2109,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);
@@ -2106,7 +2125,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)
{
@@ -2114,7 +2133,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);
@@ -2124,7 +2146,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)
{
@@ -2132,7 +2154,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);
@@ -2142,7 +2167,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)
{
@@ -2151,12 +2176,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);
@@ -2166,7 +2192,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)
{
@@ -2175,14 +2201,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);
@@ -2192,7 +2219,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)
{
@@ -2201,12 +2228,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);
@@ -2216,7 +2244,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)
{
@@ -2225,14 +2253,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);
@@ -2242,7 +2271,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)
{
@@ -2250,7 +2279,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);
@@ -2260,7 +2292,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)
{
@@ -2268,7 +2300,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);
@@ -2278,7 +2313,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)
{
@@ -2287,12 +2322,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);
@@ -2302,7 +2338,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)
{
@@ -2311,12 +2347,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);
@@ -2326,14 +2363,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;
}
@@ -2341,14 +2381,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;
}
@@ -2356,14 +2399,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;
}
@@ -2372,14 +2418,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;
@@ -2390,8 +2436,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;
@@ -2401,14 +2446,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;
}
@@ -2428,7 +2473,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)
{
@@ -2443,33 +2488,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;
- }
- if ((localAddr = addrToString(client, req, &sa, salen)) == NULL) {
- return -2;
+ remoteDispatchFormatError(rerr,
+ _("failed to get sock address %d (%s)"),
+ errno, strerror(errno));
+ return -1;
+ }
+ 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;
- }
- if ((remoteAddr = addrToString(client, req, &sa, salen)) == NULL) {
+ return -1;
+ }
+ if ((remoteAddr = addrToString(rerr, &sa, salen)) == NULL) {
VIR_FREE(localAddr);
- return -2;
+ return -1;
}
err = sasl_server_new("libvirt",
@@ -2485,9 +2530,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);
- client->saslconn = NULL;
- return -2;
+ remoteDispatchAuthError(rerr);
+ client->saslconn = NULL;
+ return -1;
}
/* Inform SASL that we've got an external SSF layer from TLS */
@@ -2498,10 +2543,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 */
@@ -2509,10 +2554,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;
}
}
@@ -2538,10 +2583,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);
- sasl_dispose(&client->saslconn);
- client->saslconn = NULL;
- return -2;
+ remoteDispatchAuthError(rerr);
+ sasl_dispose(&client->saslconn);
+ client->saslconn = NULL;
+ return -1;
}
err = sasl_listmech(client->saslconn,
@@ -2555,19 +2600,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);
- sasl_dispose(&client->saslconn);
- client->saslconn = NULL;
- return -2;
+ remoteDispatchAuthError(rerr);
+ sasl_dispose(&client->saslconn);
+ client->saslconn = NULL;
+ 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);
- sasl_dispose(&client->saslconn);
- client->saslconn = NULL;
- return -2;
+ remoteDispatchAuthError(rerr);
+ sasl_dispose(&client->saslconn);
+ client->saslconn = NULL;
+ return -1;
}
return 0;
@@ -2578,7 +2623,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;
@@ -2590,7 +2635,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;
@@ -2599,7 +2644,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;
@@ -2620,7 +2665,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;
@@ -2630,14 +2675,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;
@@ -2647,7 +2692,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;
@@ -2667,7 +2712,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;
@@ -2680,7 +2725,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)
{
@@ -2692,8 +2737,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",
@@ -2711,23 +2756,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 {
@@ -2740,12 +2785,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;
@@ -2759,7 +2804,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)
{
@@ -2771,8 +2816,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",
@@ -2789,8 +2834,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) {
@@ -2798,15 +2843,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 {
@@ -2819,12 +2864,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;
@@ -2839,36 +2884,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 */
@@ -2878,7 +2923,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)
{
@@ -2898,14 +2943,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"),
@@ -2916,16 +2961,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);
@@ -2939,8 +2984,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
@@ -2954,8 +2999,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,
@@ -2971,8 +3016,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"),
@@ -2988,14 +3033,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 */
@@ -3009,22 +3054,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;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- 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) {
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -3032,6 +3077,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;
}
@@ -3041,22 +3087,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;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- 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) {
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -3064,6 +3110,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;
}
@@ -3073,7 +3120,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)
{
@@ -3084,8 +3131,10 @@ remoteDispatchFindStoragePoolSources (st
args->type,
args->srcSpec ? *args->srcSpec : NULL,
args->flags);
- if (ret->xml == NULL)
- return -1;
+ if (ret->xml == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -3094,7 +3143,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)
{
@@ -3103,12 +3152,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);
@@ -3118,7 +3168,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)
{
@@ -3126,7 +3176,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);
@@ -3136,7 +3189,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)
{
@@ -3144,7 +3197,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);
@@ -3153,22 +3209,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)
-{
- 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;
+ 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) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
}
if (virStoragePoolBuild (pool, args->flags) == -1) {
virStoragePoolFree(pool);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
virStoragePoolFree(pool);
@@ -3179,7 +3236,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)
{
@@ -3188,12 +3245,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);
@@ -3203,7 +3261,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)
{
@@ -3212,12 +3270,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);
@@ -3227,7 +3286,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)
{
@@ -3236,12 +3295,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);
@@ -3251,7 +3311,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)
{
@@ -3261,12 +3321,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;
}
@@ -3283,7 +3344,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)
{
@@ -3292,14 +3353,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);
@@ -3309,7 +3371,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)
{
@@ -3318,12 +3380,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);
@@ -3334,7 +3397,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)
{
@@ -3342,7 +3405,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);
@@ -3352,7 +3418,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)
{
@@ -3360,7 +3426,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);
@@ -3370,7 +3439,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)
{
@@ -3379,10 +3448,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);
@@ -3392,7 +3468,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)
{
@@ -3401,12 +3477,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);
@@ -3416,7 +3493,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)
{
@@ -3425,12 +3502,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);
@@ -3440,14 +3518,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;
}
@@ -3455,14 +3536,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;
}
@@ -3470,7 +3554,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)
{
@@ -3478,22 +3562,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;
- }
-
- pool = get_nonnull_storage_pool (client->conn, args->pool);
- if (pool == NULL) {
- remoteDispatchError (client, req, "%s", _("storage_pool not
found"));
- return -2;
- }
-
- /* 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;
+ remoteDispatchFormatError (rerr,
+ "%s", _("maxnames >
REMOTE_STORAGE_VOL_NAME_LIST_MAX"));
+ return -1;
+ }
+
+ pool = get_nonnull_storage_pool (client->conn, args->pool);
+ if (pool == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ virStoragePoolFree(pool);
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -3502,6 +3586,7 @@ remoteDispatchStoragePoolListVolumes (st
virStoragePoolFree(pool);
if (ret->names.names_len == -1) {
VIR_FREE(ret->names.names_val);
+ remoteDispatchConnError(rerr, client->conn);
return -1;
}
@@ -3512,7 +3597,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)
{
@@ -3521,13 +3606,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;
}
@@ -3542,7 +3630,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)
{
@@ -3552,13 +3640,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);
@@ -3569,7 +3660,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)
{
@@ -3578,12 +3669,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);
@@ -3593,7 +3685,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)
{
@@ -3603,12 +3695,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;
}
@@ -3624,7 +3717,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)
{
@@ -3633,14 +3726,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);
@@ -3651,7 +3745,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)
{
@@ -3660,14 +3754,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);
@@ -3678,7 +3773,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)
{
@@ -3688,13 +3783,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);
@@ -3704,7 +3802,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)
{
@@ -3712,7 +3810,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);
@@ -3723,7 +3824,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)
{
@@ -3731,7 +3832,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);
@@ -3746,7 +3850,7 @@ static int
static int
remoteDispatchNodeNumOfDevices (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_node_num_of_devices_args *args,
remote_node_num_of_devices_ret *ret)
{
@@ -3755,7 +3859,10 @@ remoteDispatchNodeNumOfDevices (struct q
ret->num = virNodeNumOfDevices (client->conn,
args->cap ? *args->cap : NULL,
args->flags);
- if (ret->num == -1) return -1;
+ if (ret->num == -1) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
return 0;
}
@@ -3764,22 +3871,22 @@ static int
static int
remoteDispatchNodeListDevices (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_node_list_devices_args *args,
remote_node_list_devices_ret *ret)
{
CHECK_CONN(client);
if (args->maxnames > REMOTE_NODE_DEVICE_NAME_LIST_MAX) {
- remoteDispatchError (client, req,
- "%s", _("maxnames >
REMOTE_NODE_DEVICE_NAME_LIST_MAX"));
- return -2;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchFormatError(rerr,
+ "%s", _("maxnames >
REMOTE_NODE_DEVICE_NAME_LIST_MAX"));
+ return -1;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
@@ -3787,6 +3894,7 @@ remoteDispatchNodeListDevices (struct qe
args->cap ? *args->cap : NULL,
ret->names.names_val, args->maxnames, args->flags);
if (ret->names.names_len == -1) {
+ remoteDispatchConnError(rerr, client->conn);
VIR_FREE(ret->names.names_val);
return -1;
}
@@ -3798,7 +3906,7 @@ static int
static int
remoteDispatchNodeDeviceLookupByName (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_node_device_lookup_by_name_args *args,
remote_node_device_lookup_by_name_ret *ret)
{
@@ -3807,7 +3915,10 @@ remoteDispatchNodeDeviceLookupByName (st
CHECK_CONN(client);
dev = virNodeDeviceLookupByName (client->conn, args->name);
- if (dev == NULL) return -1;
+ if (dev == NULL) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
make_nonnull_node_device (&ret->dev, dev);
virNodeDeviceFree(dev);
@@ -3818,7 +3929,7 @@ static int
static int
remoteDispatchNodeDeviceDumpXml (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_node_device_dump_xml_args *args,
remote_node_device_dump_xml_ret *ret)
{
@@ -3827,13 +3938,14 @@ remoteDispatchNodeDeviceDumpXml (struct
dev = virNodeDeviceLookupByName(client->conn, args->name);
if (dev == NULL) {
- remoteDispatchError (client, req, "%s", _("node_device not
found"));
- return -2;
+ remoteDispatchFormatError(rerr, "%s", _("node_device not
found"));
+ return -1;
}
/* remoteDispatchClientRequest will free this. */
ret->xml = virNodeDeviceGetXMLDesc (dev, args->flags);
if (!ret->xml) {
+ remoteDispatchConnError(rerr, client->conn);
virNodeDeviceFree(dev);
return -1;
}
@@ -3845,7 +3957,7 @@ static int
static int
remoteDispatchNodeDeviceGetParent (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_node_device_get_parent_args *args,
remote_node_device_get_parent_ret *ret)
{
@@ -3855,8 +3967,8 @@ remoteDispatchNodeDeviceGetParent (struc
dev = virNodeDeviceLookupByName(client->conn, args->name);
if (dev == NULL) {
- remoteDispatchError (client, req, "%s", _("node_device not
found"));
- return -2;
+ remoteDispatchFormatError(rerr, "%s", _("node_device not
found"));
+ return -1;
}
parent = virNodeDeviceGetParent(dev);
@@ -3867,13 +3979,13 @@ remoteDispatchNodeDeviceGetParent (struc
/* remoteDispatchClientRequest will free this. */
char **parent_p;
if (VIR_ALLOC(parent_p) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
*parent_p = strdup(parent);
if (*parent_p == NULL) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->parent = parent_p;
}
@@ -3886,7 +3998,7 @@ static int
static int
remoteDispatchNodeDeviceNumOfCaps (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_node_device_num_of_caps_args *args,
remote_node_device_num_of_caps_ret *ret)
{
@@ -3895,11 +4007,15 @@ remoteDispatchNodeDeviceNumOfCaps (struc
dev = virNodeDeviceLookupByName(client->conn, args->name);
if (dev == NULL) {
- remoteDispatchError (client, req, "%s", _("node_device not
found"));
- return -2;
+ remoteDispatchFormatError(rerr, "%s", _("node_device not
found"));
+ return -1;
}
ret->num = virNodeDeviceNumOfCaps(dev);
+ if (ret->num < 0) {
+ remoteDispatchConnError(rerr, client->conn);
+ return -1;
+ }
virNodeDeviceFree(dev);
return 0;
@@ -3909,7 +4025,7 @@ static int
static int
remoteDispatchNodeDeviceListCaps (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req,
+ remote_error *rerr,
remote_node_device_list_caps_args *args,
remote_node_device_list_caps_ret *ret)
{
@@ -3918,26 +4034,27 @@ remoteDispatchNodeDeviceListCaps (struct
dev = virNodeDeviceLookupByName(client->conn, args->name);
if (dev == NULL) {
- remoteDispatchError (client, req, "%s", _("node_device not
found"));
- return -2;
+ remoteDispatchFormatError(rerr, "%s", _("node_device not
found"));
+ return -1;
}
if (args->maxnames > REMOTE_NODE_DEVICE_NAME_LIST_MAX) {
- remoteDispatchError (client, req,
- "%s", _("maxnames >
REMOTE_NODE_DEVICE_NAME_LIST_MAX"));
- return -2;
- }
-
- /* Allocate return buffer. */
- if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
- remoteDispatchSendError(client, req, VIR_ERR_NO_MEMORY, NULL);
- return -2;
+ remoteDispatchFormatError(rerr,
+ "%s", _("maxnames >
REMOTE_NODE_DEVICE_NAME_LIST_MAX"));
+ return -1;
+ }
+
+ /* Allocate return buffer. */
+ if (VIR_ALLOC_N(ret->names.names_val, args->maxnames) < 0) {
+ remoteDispatchOOMError(rerr);
+ return -1;
}
ret->names.names_len =
virNodeDeviceListCaps (dev, ret->names.names_val,
args->maxnames);
if (ret->names.names_len == -1) {
+ remoteDispatchConnError(rerr, client->conn);
VIR_FREE(ret->names.names_val);
return -1;
}
@@ -3952,7 +4069,7 @@ static int
static int
remoteDispatchDomainEvent (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client ATTRIBUTE_UNUSED,
- remote_message_header *req ATTRIBUTE_UNUSED,
+ remote_error *rerr ATTRIBUTE_UNUSED,
void *args ATTRIBUTE_UNUSED,
remote_domain_event_ret *ret ATTRIBUTE_UNUSED)
{
@@ -3960,7 +4077,8 @@ remoteDispatchDomainEvent (struct qemud_
* This does not make sense, as this should not be intiated
* from the client side in generated code.
*/
- return -1;
+ remoteDispatchFormatError(rerr, "%s", _("unexpected async event method
call"));
+ return -1;
}
/***************************
@@ -3969,7 +4087,7 @@ static int
static int
remoteDispatchDomainEventsRegister (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req ATTRIBUTE_UNUSED,
+ remote_error *rerr ATTRIBUTE_UNUSED,
void *args ATTRIBUTE_UNUSED,
remote_domain_events_register_ret *ret
ATTRIBUTE_UNUSED)
{
@@ -3987,7 +4105,7 @@ static int
static int
remoteDispatchDomainEventsDeregister (struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
- remote_message_header *req ATTRIBUTE_UNUSED,
+ remote_error *rerr ATTRIBUTE_UNUSED,
void *args ATTRIBUTE_UNUSED,
remote_domain_events_deregister_ret *ret
ATTRIBUTE_UNUSED)
{
@@ -4013,10 +4131,8 @@ remoteDispatchDomainEventSend (struct qe
int len;
remote_domain_event_ret data;
- if(!client) {
- remoteDispatchError (client, NULL, "%s", _("Invalid
Client"));
- return;
- }
+ if (!client)
+ return;
rep.prog = REMOTE_PROGRAM;
rep.vers = REMOTE_PROTOCOL_VERSION;
@@ -4030,7 +4146,7 @@ remoteDispatchDomainEventSend (struct qe
len = 0; /* We'll come back and write this later. */
if (!xdr_int (&xdr, &len)) {
- remoteDispatchError (client, NULL, "%s", _("xdr_int failed
(1)"));
+ /*remoteDispatchError (client, NULL, "%s", _("xdr_int failed
(1)"));*/
xdr_destroy (&xdr);
return;
}
@@ -4046,20 +4162,20 @@ remoteDispatchDomainEventSend (struct qe
data.detail = detail;
if (!xdr_remote_domain_event_ret(&xdr, &data)) {
- remoteDispatchError (client, NULL, "%s", _("serialise return
struct"));
+ /*remoteDispatchError (client, NULL, "%s", _("serialise return
struct"));*/
xdr_destroy (&xdr);
return;
}
len = xdr_getpos (&xdr);
if (xdr_setpos (&xdr, 0) == 0) {
- remoteDispatchError (client, NULL, "%s", _("xdr_setpos
failed"));
+ /*remoteDispatchError (client, NULL, "%s", _("xdr_setpos
failed"));*/
xdr_destroy (&xdr);
return;
}
if (!xdr_int (&xdr, &len)) {
- remoteDispatchError (client, NULL, "%s", _("xdr_int failed
(2)"));
+ /*remoteDispatchError (client, NULL, "%s", _("xdr_int failed
(2)"));*/
xdr_destroy (&xdr);
return;
}
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,120 +2,120 @@
* 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 remoteDispatchDomainEvent (struct qemud_server *server, struct qemud_client
*client, remote_message_header *req, void *args, remote_domain_event_ret *ret);
-static int remoteDispatchDomainEventsDeregister (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, void *args,
remote_domain_events_deregister_ret *ret);
-static int remoteDispatchDomainEventsRegister (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, void *args,
remote_domain_events_register_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 remoteDispatchDomainMigrateFinish2 (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, remote_domain_migrate_finish2_args
*args, remote_domain_migrate_finish2_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 remoteDispatchDomainMigratePrepare2 (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, remote_domain_migrate_prepare2_args
*args, remote_domain_migrate_prepare2_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 remoteDispatchGetUri (struct qemud_server *server, struct qemud_client
*client, remote_message_header *req, void *args, remote_get_uri_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 remoteDispatchNodeDeviceDumpXml (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, remote_node_device_dump_xml_args *args,
remote_node_device_dump_xml_ret *ret);
-static int remoteDispatchNodeDeviceGetParent (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, remote_node_device_get_parent_args
*args, remote_node_device_get_parent_ret *ret);
-static int remoteDispatchNodeDeviceListCaps (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, remote_node_device_list_caps_args *args,
remote_node_device_list_caps_ret *ret);
-static int remoteDispatchNodeDeviceLookupByName (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, remote_node_device_lookup_by_name_args
*args, remote_node_device_lookup_by_name_ret *ret);
-static int remoteDispatchNodeDeviceNumOfCaps (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, remote_node_device_num_of_caps_args
*args, remote_node_device_num_of_caps_ret *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 remoteDispatchNodeListDevices (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, remote_node_list_devices_args *args,
remote_node_list_devices_ret *ret);
-static int remoteDispatchNodeNumOfDevices (struct qemud_server *server, struct
qemud_client *client, remote_message_header *req, remote_node_num_of_devices_args *args,
remote_node_num_of_devices_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 remoteDispatchDomainEvent (struct qemud_server *server, struct qemud_client
*client, remote_error *err, void *args, remote_domain_event_ret *ret);
+static int remoteDispatchDomainEventsDeregister (struct qemud_server *server, struct
qemud_client *client, remote_error *err, void *args, remote_domain_events_deregister_ret
*ret);
+static int remoteDispatchDomainEventsRegister (struct qemud_server *server, struct
qemud_client *client, remote_error *err, void *args, remote_domain_events_register_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 remoteDispatchDomainMigrateFinish2 (struct qemud_server *server, struct
qemud_client *client, remote_error *err, remote_domain_migrate_finish2_args *args,
remote_domain_migrate_finish2_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 remoteDispatchDomainMigratePrepare2 (struct qemud_server *server, struct
qemud_client *client, remote_error *err, remote_domain_migrate_prepare2_args *args,
remote_domain_migrate_prepare2_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 remoteDispatchGetUri (struct qemud_server *server, struct qemud_client
*client, remote_error *err, void *args, remote_get_uri_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 remoteDispatchNodeDeviceDumpXml (struct qemud_server *server, struct
qemud_client *client, remote_error *err, remote_node_device_dump_xml_args *args,
remote_node_device_dump_xml_ret *ret);
+static int remoteDispatchNodeDeviceGetParent (struct qemud_server *server, struct
qemud_client *client, remote_error *err, remote_node_device_get_parent_args *args,
remote_node_device_get_parent_ret *ret);
+static int remoteDispatchNodeDeviceListCaps (struct qemud_server *server, struct
qemud_client *client, remote_error *err, remote_node_device_list_caps_args *args,
remote_node_device_list_caps_ret *ret);
+static int remoteDispatchNodeDeviceLookupByName (struct qemud_server *server, struct
qemud_client *client, remote_error *err, remote_node_device_lookup_by_name_args *args,
remote_node_device_lookup_by_name_ret *ret);
+static int remoteDispatchNodeDeviceNumOfCaps (struct qemud_server *server, struct
qemud_client *client, remote_error *err, remote_node_device_num_of_caps_args *args,
remote_node_device_num_of_caps_ret *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 remoteDispatchNodeListDevices (struct qemud_server *server, struct
qemud_client *client, remote_error *err, remote_node_list_devices_args *args,
remote_node_list_devices_ret *ret);
+static int remoteDispatchNodeNumOfDevices (struct qemud_server *server, struct
qemud_client *client, remote_error *err, remote_node_num_of_devices_args *args,
remote_node_num_of_devices_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
@@ -498,8 +498,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 :|