mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Qemu remote protocol.
Since we are adding a new "per-hypervisor" protocol, we make it so that the qemu remote protocol uses a new PROTOCOL and PROGRAM number. This allows us to easily distinguish it from the normal REMOTE protocol. This necessitates changing the proc in remote_message_header from a "remote_procedure" to an "unsigned", which should be the same size (and thus preserve the on-wire protocol). Changes since v1: - Fixed up a couple of script problems in remote_generate_stubs.pl - Switch an int flag to a bool in dispatch.c Changes since v2: - None Changes since v3: - Change unsigned proc to signed proc, to conform to spec Signed-off-by: Chris Lalancette <clalance@redhat.com>
This commit is contained in:
@@ -57,6 +57,7 @@
|
||||
#include "memory.h"
|
||||
#include "util.h"
|
||||
#include "stream.h"
|
||||
#include "libvirt/libvirt-qemu.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_REMOTE
|
||||
#define REMOTE_DEBUG(fmt, ...) DEBUG(fmt, __VA_ARGS__)
|
||||
@@ -81,11 +82,16 @@ static void make_nonnull_domain_snapshot (remote_nonnull_domain_snapshot *snapsh
|
||||
|
||||
|
||||
#include "remote_dispatch_prototypes.h"
|
||||
#include "qemu_dispatch_prototypes.h"
|
||||
|
||||
static const dispatch_data const dispatch_table[] = {
|
||||
#include "remote_dispatch_table.h"
|
||||
};
|
||||
|
||||
static const dispatch_data const qemu_dispatch_table[] = {
|
||||
#include "qemu_dispatch_table.h"
|
||||
};
|
||||
|
||||
const dispatch_data const *remoteGetDispatchData(int proc)
|
||||
{
|
||||
if (proc >= ARRAY_CARDINALITY(dispatch_table) ||
|
||||
@@ -96,6 +102,16 @@ const dispatch_data const *remoteGetDispatchData(int proc)
|
||||
return &(dispatch_table[proc]);
|
||||
}
|
||||
|
||||
const dispatch_data const *qemuGetDispatchData(int proc)
|
||||
{
|
||||
if (proc >= ARRAY_CARDINALITY(qemu_dispatch_table) ||
|
||||
qemu_dispatch_table[proc].fn == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return &(qemu_dispatch_table[proc]);
|
||||
}
|
||||
|
||||
/* Prototypes */
|
||||
static void
|
||||
remoteDispatchDomainEventSend (struct qemud_client *client,
|
||||
@@ -6564,6 +6580,35 @@ remoteDispatchDomainGetBlockInfo (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
qemuDispatchMonitorCommand (struct qemud_server *server ATTRIBUTE_UNUSED,
|
||||
struct qemud_client *client ATTRIBUTE_UNUSED,
|
||||
virConnectPtr conn,
|
||||
remote_message_header *hdr ATTRIBUTE_UNUSED,
|
||||
remote_error *rerr,
|
||||
qemu_monitor_command_args *args,
|
||||
qemu_monitor_command_ret *ret)
|
||||
{
|
||||
virDomainPtr domain;
|
||||
|
||||
domain = get_nonnull_domain(conn, args->domain);
|
||||
if (domain == NULL) {
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (virDomainQemuMonitorCommand(domain, args->cmd, &ret->result,
|
||||
args->flags) == -1) {
|
||||
virDomainFree(domain);
|
||||
remoteDispatchConnError(rerr, conn);
|
||||
return -1;
|
||||
}
|
||||
|
||||
virDomainFree(domain);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/*----- Helpers. -----*/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user