$(srcdir)/lxc/lxc_monitor_dispatch.h: $(srcdir)/rpc/gendispatch.pl \
$(LXC_MONITOR_PROTOCOL)
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl \
- -k virLXCProtocol VIR_LXC_MONITOR_PROTOCOL $(LXC_MONITOR_PROTOCOL) > $@
+ -k virLXCMonitor VIR_LXC_MONITOR $(LXC_MONITOR_PROTOCOL) > $@
$(srcdir)/lxc/lxc_controller_dispatch.h: $(srcdir)/rpc/gendispatch.pl \
$(REMOTE_PROTOCOL)
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gendispatch.pl \
- -b virLXCProtocol VIR_LXC_MONITOR_PROTOCOL $(LXC_MONITOR_PROTOCOL) > $@
+ -b virLXCMonitor VIR_LXC_MONITOR $(LXC_MONITOR_PROTOCOL) > $@
EXTRA_DIST += \
$(LXC_MONITOR_PROTOCOL) \
$(srcdir)/rpc/virkeepaliveprotocol.x \
$(srcdir)/remote/remote_protocol.x \
$(srcdir)/remote/lxc_protocol.x \
- $(srcdir)/remote/qemu_protocol.x
+ $(srcdir)/remote/qemu_protocol.x \
+ $(srcdir)/lxc/lxc_monitor_protocol.x \
+ $(srcdir)/locking/lock_protocol.x
libvirt_functions.stp: $(RPC_PROBE_FILES) $(srcdir)/rpc/gensystemtap.pl
$(AM_V_GEN)$(PERL) -w $(srcdir)/rpc/gensystemtap.pl $(RPC_PROBE_FILES) > $@
virObjectUnref(svc);
svc = NULL;
- if (!(ctrl->prog = virNetServerProgramNew(VIR_LXC_PROTOCOL_PROGRAM,
- VIR_LXC_PROTOCOL_PROGRAM_VERSION,
- virLXCProtocolProcs,
- virLXCProtocolNProcs)))
+ if (!(ctrl->prog = virNetServerProgramNew(VIR_LXC_MONITOR_PROGRAM,
+ VIR_LXC_MONITOR_PROGRAM_VERSION,
+ virLXCMonitorProcs,
+ virLXCMonitorNProcs)))
goto error;
virNetServerUpdateServices(ctrl->server, true);
virLXCControllerEventSendExit(virLXCControllerPtr ctrl,
int exitstatus)
{
- virLXCProtocolExitEventMsg msg;
+ virLXCMonitorExitEventMsg msg;
VIR_DEBUG("Exit status %d (client=%p)", exitstatus, ctrl->client);
memset(&msg, 0, sizeof(msg));
switch (exitstatus) {
case 0:
- msg.status = VIR_LXC_PROTOCOL_EXIT_STATUS_SHUTDOWN;
+ msg.status = VIR_LXC_MONITOR_EXIT_STATUS_SHUTDOWN;
break;
case 1:
- msg.status = VIR_LXC_PROTOCOL_EXIT_STATUS_REBOOT;
+ msg.status = VIR_LXC_MONITOR_EXIT_STATUS_REBOOT;
break;
default:
- msg.status = VIR_LXC_PROTOCOL_EXIT_STATUS_ERROR;
+ msg.status = VIR_LXC_MONITOR_EXIT_STATUS_ERROR;
break;
}
virLXCControllerEventSend(ctrl,
- VIR_LXC_PROTOCOL_PROC_EXIT_EVENT,
- (xdrproc_t)xdr_virLXCProtocolExitEventMsg,
+ VIR_LXC_MONITOR_PROC_EXIT_EVENT,
+ (xdrproc_t)xdr_virLXCMonitorExitEventMsg,
(void*)&msg);
if (ctrl->client) {
virLXCControllerEventSendInit(virLXCControllerPtr ctrl,
pid_t initpid)
{
- virLXCProtocolInitEventMsg msg;
+ virLXCMonitorInitEventMsg msg;
VIR_DEBUG("Init pid %llu", (unsigned long long)initpid);
memset(&msg, 0, sizeof(msg));
msg.initpid = initpid;
virLXCControllerEventSend(ctrl,
- VIR_LXC_PROTOCOL_PROC_INIT_EVENT,
- (xdrproc_t)xdr_virLXCProtocolInitEventMsg,
+ VIR_LXC_MONITOR_PROC_INIT_EVENT,
+ (xdrproc_t)xdr_virLXCMonitorInitEventMsg,
(void*)&msg);
return 0;
}
virNetClientPtr client,
void *evdata, void *opaque);
-static virNetClientProgramEvent virLXCProtocolEvents[] = {
- { VIR_LXC_PROTOCOL_PROC_EXIT_EVENT,
+static virNetClientProgramEvent virLXCMonitorEvents[] = {
+ { VIR_LXC_MONITOR_PROC_EXIT_EVENT,
virLXCMonitorHandleEventExit,
- sizeof(virLXCProtocolExitEventMsg),
- (xdrproc_t)xdr_virLXCProtocolExitEventMsg },
- { VIR_LXC_PROTOCOL_PROC_INIT_EVENT,
+ sizeof(virLXCMonitorExitEventMsg),
+ (xdrproc_t)xdr_virLXCMonitorExitEventMsg },
+ { VIR_LXC_MONITOR_PROC_INIT_EVENT,
virLXCMonitorHandleEventInit,
- sizeof(virLXCProtocolInitEventMsg),
- (xdrproc_t)xdr_virLXCProtocolInitEventMsg },
+ sizeof(virLXCMonitorInitEventMsg),
+ (xdrproc_t)xdr_virLXCMonitorInitEventMsg },
};
void *evdata, void *opaque)
{
virLXCMonitorPtr mon = opaque;
- virLXCProtocolExitEventMsg *msg = evdata;
+ virLXCMonitorExitEventMsg *msg = evdata;
VIR_DEBUG("Event exit %d", msg->status);
if (mon->cb.exitNotify)
void *evdata, void *opaque)
{
virLXCMonitorPtr mon = opaque;
- virLXCProtocolInitEventMsg *msg = evdata;
+ virLXCMonitorInitEventMsg *msg = evdata;
VIR_DEBUG("Event init %llu",
(unsigned long long)msg->initpid);
if (virNetClientRegisterAsyncIO(mon->client) < 0)
goto error;
- if (!(mon->program = virNetClientProgramNew(VIR_LXC_PROTOCOL_PROGRAM,
- VIR_LXC_PROTOCOL_PROGRAM_VERSION,
- virLXCProtocolEvents,
- ARRAY_CARDINALITY(virLXCProtocolEvents),
+ if (!(mon->program = virNetClientProgramNew(VIR_LXC_MONITOR_PROGRAM,
+ VIR_LXC_MONITOR_PROGRAM_VERSION,
+ virLXCMonitorEvents,
+ ARRAY_CARDINALITY(virLXCMonitorEvents),
mon)))
goto error;
virDomainObjPtr vm);
typedef void (*virLXCMonitorCallbackExitNotify)(virLXCMonitorPtr mon,
- virLXCProtocolExitStatus status,
+ virLXCMonitorExitStatus status,
virDomainObjPtr vm);
typedef void (*virLXCMonitorCallbackInitNotify)(virLXCMonitorPtr mon,
* the libvirt_lxc helper program.
*/
-enum virLXCProtocolExitStatus {
- VIR_LXC_PROTOCOL_EXIT_STATUS_ERROR,
- VIR_LXC_PROTOCOL_EXIT_STATUS_SHUTDOWN,
- VIR_LXC_PROTOCOL_EXIT_STATUS_REBOOT
+enum virLXCMonitorExitStatus {
+ VIR_LXC_MONITOR_EXIT_STATUS_ERROR,
+ VIR_LXC_MONITOR_EXIT_STATUS_SHUTDOWN,
+ VIR_LXC_MONITOR_EXIT_STATUS_REBOOT
};
-struct virLXCProtocolExitEventMsg {
- enum virLXCProtocolExitStatus status;
+struct virLXCMonitorExitEventMsg {
+ enum virLXCMonitorExitStatus status;
};
-struct virLXCProtocolInitEventMsg {
+struct virLXCMonitorInitEventMsg {
unsigned hyper initpid;
};
-const VIR_LXC_PROTOCOL_PROGRAM = 0x12341234;
-const VIR_LXC_PROTOCOL_PROGRAM_VERSION = 1;
+const VIR_LXC_MONITOR_PROGRAM = 0x12341234;
+const VIR_LXC_MONITOR_PROGRAM_VERSION = 1;
-enum virLXCProtocolProcedure {
- VIR_LXC_PROTOCOL_PROC_EXIT_EVENT = 1, /* skipgen skipgen */
- VIR_LXC_PROTOCOL_PROC_INIT_EVENT = 2 /* skipgen skipgen */
+enum virLXCMonitorProcedure {
+ VIR_LXC_MONITOR_PROC_EXIT_EVENT = 1, /* skipgen skipgen */
+ VIR_LXC_MONITOR_PROC_INIT_EVENT = 2 /* skipgen skipgen */
};
}
static void virLXCProcessMonitorExitNotify(virLXCMonitorPtr mon ATTRIBUTE_UNUSED,
- virLXCProtocolExitStatus status,
+ virLXCMonitorExitStatus status,
virDomainObjPtr vm)
{
virLXCDomainObjPrivatePtr priv = vm->privateData;
switch (status) {
- case VIR_LXC_PROTOCOL_EXIT_STATUS_SHUTDOWN:
+ case VIR_LXC_MONITOR_EXIT_STATUS_SHUTDOWN:
priv->stopReason = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN;
break;
- case VIR_LXC_PROTOCOL_EXIT_STATUS_ERROR:
+ case VIR_LXC_MONITOR_EXIT_STATUS_ERROR:
priv->stopReason = VIR_DOMAIN_EVENT_STOPPED_FAILED;
break;
- case VIR_LXC_PROTOCOL_EXIT_STATUS_REBOOT:
+ case VIR_LXC_MONITOR_EXIT_STATUS_REBOOT:
priv->stopReason = VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN;
priv->wantReboot = true;
break;
$auth{$2} = lc $1;
}
} else {
- if (/(\w+)_PROGRAM\s*=\s*0x([a-fA-F0-9]+)\s*;/) {
+ if (/(?:VIR_)?(\w+?)(?:_PROTOCOL)?_PROGRAM\s*=\s*0x([a-fA-F0-9]+)\s*;/) {
$funcs{lc $1} = { id => hex($2), version => undef, progs => [] };
- } elsif (/(\w+)_PROTOCOL_VERSION\s*=\s*(\d+)\s*;/) {
+ } elsif (/(?:VIR_)?(\w+?)(?:_PROTOCOL)?_(?:PROGRAM|PROTOCOL)_VERSION\s*=\s*(\d+)\s*;/) {
$funcs{lc $1}->{version} = $2;
- } elsif (/(\w+)_PROC_(.*?)\s+=\s+(\d+)/) {
+ } elsif (/(?:VIR_)?(\w+?)(?:_PROTOCOL)?_PROC_(.*?)\s+=\s+(\d+)/) {
$funcs{lc $1}->{progs}->[$3] = lc $2;
}
}