]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix generation of systemtap probes for RPC protocols
authorDaniel P. Berrange <berrange@redhat.com>
Wed, 13 Mar 2013 19:19:22 +0000 (19:19 +0000)
committerDaniel P. Berrange <berrange@redhat.com>
Thu, 14 Mar 2013 12:42:22 +0000 (12:42 +0000)
The naming used in the RPC protocols for the LXC monitor and
lock daemon confused the script used to generate systemtap
helper functions. Rename the LXC monitor protocol symbols to
reduce confusion. Adapt the gensystemtap.pl script to cope
with the LXC monitor / lock daemon naming conversions.

This has no functional impact on RPC wire protocol, since
names are only used in the C layer

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
src/Makefile.am
src/lxc/lxc_controller.c
src/lxc/lxc_monitor.c
src/lxc/lxc_monitor.h
src/lxc/lxc_monitor_protocol.x
src/lxc/lxc_process.c
src/rpc/gensystemtap.pl

index a6cc839697be99a46189d673d57a60d45d469549..0c0dfb3892af9ff8d5c6649cfc6b3f5122430de2 100644 (file)
@@ -460,12 +460,12 @@ LXC_MONITOR_PROTOCOL = $(srcdir)/lxc/lxc_monitor_protocol.x
 $(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) \
@@ -1591,7 +1591,9 @@ RPC_PROBE_FILES = $(srcdir)/rpc/virnetprotocol.x \
                  $(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) > $@
index 5e422ad5f63501803fb5555131213e5e357bd93e..becf811297a17eef233f8d47ce6550a31181a9c0 100644 (file)
@@ -713,10 +713,10 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl)
     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);
@@ -1415,25 +1415,25 @@ static int
 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) {
@@ -1451,15 +1451,15 @@ static int
 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;
 }
index e3901f8c54ae98712da586acad2e48a985140a79..6d11edacbfb9dba9a7f58ef0aacd8a680db68544 100644 (file)
@@ -68,15 +68,15 @@ virLXCMonitorHandleEventInit(virNetClientProgramPtr prog,
                              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 },
 };
 
 
@@ -86,7 +86,7 @@ virLXCMonitorHandleEventExit(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
                              void *evdata, void *opaque)
 {
     virLXCMonitorPtr mon = opaque;
-    virLXCProtocolExitEventMsg *msg = evdata;
+    virLXCMonitorExitEventMsg *msg = evdata;
 
     VIR_DEBUG("Event exit %d", msg->status);
     if (mon->cb.exitNotify)
@@ -100,7 +100,7 @@ virLXCMonitorHandleEventInit(virNetClientProgramPtr prog ATTRIBUTE_UNUSED,
                              void *evdata, void *opaque)
 {
     virLXCMonitorPtr mon = opaque;
-    virLXCProtocolInitEventMsg *msg = evdata;
+    virLXCMonitorInitEventMsg *msg = evdata;
 
     VIR_DEBUG("Event init %llu",
               (unsigned long long)msg->initpid);
@@ -162,10 +162,10 @@ virLXCMonitorPtr virLXCMonitorNew(virDomainObjPtr vm,
     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;
 
index cc31a9c2cbe0580953edaee9f2c4e2114336b04d..a0d6f371bacab056d25cd102760b57cb4599a5e4 100644 (file)
@@ -37,7 +37,7 @@ typedef void (*virLXCMonitorCallbackEOFNotify)(virLXCMonitorPtr mon,
                                                virDomainObjPtr vm);
 
 typedef void (*virLXCMonitorCallbackExitNotify)(virLXCMonitorPtr mon,
-                                                virLXCProtocolExitStatus status,
+                                                virLXCMonitorExitStatus status,
                                                 virDomainObjPtr vm);
 
 typedef void (*virLXCMonitorCallbackInitNotify)(virLXCMonitorPtr mon,
index 0f041f6c55ad79e0be5a90a54be7259c49830beb..0926e26f64f16ed3701e941c7c69fec8af7eb2cb 100644 (file)
@@ -4,24 +4,24 @@
  * 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 */
 };
index 942d3753e7360f70f31ddcec9ff9585724d66801..670a032fbafa970ac40da8f2cfc5c472a4fe228f 100644 (file)
@@ -607,19 +607,19 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon,
 }
 
 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;
index a16fa002efacafac7da5e9b706b8a47eda1741c3..246730000ac38bb356ed245f75d0b01764cc8154 100755 (executable)
@@ -57,11 +57,11 @@ while (<>) {
             $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;
         }
     }