Remote driver client and server for virDomainOpenConsole

This provides an implementation of the virDomainOpenConsole
API for the remote driver client and server.

* daemon/remote.c: Server side impl
* src/remote/remote_driver.c: Client impl
* src/remote/remote_protocol.x: Wire definition
This commit is contained in:
Daniel P. Berrange
2010-07-23 13:57:14 +01:00
parent 88a9b382c6
commit 73d8b03cda
9 changed files with 165 additions and 20 deletions

View File

@@ -6907,6 +6907,58 @@ qemuDispatchMonitorCommand (struct qemud_server *server ATTRIBUTE_UNUSED,
}
static int
remoteDispatchDomainOpenConsole(struct qemud_server *server ATTRIBUTE_UNUSED,
struct qemud_client *client,
virConnectPtr conn,
remote_message_header *hdr,
remote_error *rerr,
remote_domain_open_console_args *args,
void *ret ATTRIBUTE_UNUSED)
{
int r;
struct qemud_client_stream *stream;
virDomainPtr dom;
CHECK_CONN (client);
dom = get_nonnull_domain (conn, args->domain);
if (dom == NULL) {
remoteDispatchConnError(rerr, conn);
return -1;
}
stream = remoteCreateClientStream(conn, hdr);
if (!stream) {
virDomainFree(dom);
remoteDispatchOOMError(rerr);
return -1;
}
r = virDomainOpenConsole(dom,
args->devname ? *args->devname : NULL,
stream->st,
args->flags);
if (r == -1) {
virDomainFree(dom);
remoteFreeClientStream(client, stream);
remoteDispatchConnError(rerr, conn);
return -1;
}
if (remoteAddClientStream(client, stream, 1) < 0) {
virDomainFree(dom);
remoteDispatchConnError(rerr, conn);
virStreamAbort(stream->st);
remoteFreeClientStream(client, stream);
return -1;
}
virDomainFree(dom);
return 0;
}
/*----- Helpers. -----*/
/* get_nonnull_domain and get_nonnull_network turn an on-wire