[libvirt] [PATCH 6/8] Set thread job for every RPC call

Jiri Denemark jdenemar at redhat.com
Mon Mar 23 13:26:05 UTC 2015


Since all APIs are also RPC calls, we automatically get all APIs covered
with thread jobs.

Signed-off-by: Jiri Denemark <jdenemar at redhat.com>
---
 daemon/remote.c                    | 1 +
 src/locking/lock_daemon_dispatch.c | 1 +
 src/qemu/qemu_domain.c             | 1 +
 src/rpc/gendispatch.pl             | 6 +++++-
 4 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/daemon/remote.c b/daemon/remote.c
index 62a4728..ea7ae94 100644
--- a/daemon/remote.c
+++ b/daemon/remote.c
@@ -51,6 +51,7 @@
 #include "viraccessapicheck.h"
 #include "viraccessapicheckqemu.h"
 #include "virpolkit.h"
+#include "virthreadjob.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/src/locking/lock_daemon_dispatch.c b/src/locking/lock_daemon_dispatch.c
index 168a6af..a7cee9d 100644
--- a/src/locking/lock_daemon_dispatch.c
+++ b/src/locking/lock_daemon_dispatch.c
@@ -29,6 +29,7 @@
 #include "lock_daemon.h"
 #include "lock_protocol.h"
 #include "virerror.h"
+#include "virthreadjob.h"
 
 #define VIR_FROM_THIS VIR_FROM_RPC
 
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 949bf8b..559400c 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -39,6 +39,7 @@
 #include "virtime.h"
 #include "virstoragefile.h"
 #include "virstring.h"
+#include "virthreadjob.h"
 
 #include "storage/storage_driver.h"
 
diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl
index 8b488eb..aa73d0c 100755
--- a/src/rpc/gendispatch.pl
+++ b/src/rpc/gendispatch.pl
@@ -428,8 +428,10 @@ elsif ($mode eq "server") {
         print "    void *args$argann,\n";
         print "    void *ret$retann)\n";
         print "{\n";
+        print "  int rv;\n";
+        print "  virThreadJobSet(\"$name\");\n";
         print "  VIR_DEBUG(\"server=%p client=%p msg=%p rerr=%p args=%p ret=%p\", server, client, msg, rerr, args, ret);\n";
-        print "  return $name(server, client, msg, rerr";
+        print "  rv = $name(server, client, msg, rerr";
         if ($argtype ne "void") {
             print ", args";
         }
@@ -437,6 +439,8 @@ elsif ($mode eq "server") {
             print ", ret";
         }
         print ");\n";
+        print "  virThreadJobClear(rv);\n";
+        print "  return rv;\n";
         print "}\n";
 
         # Finally we print out the dispatcher method body impl
-- 
2.3.3




More information about the libvir-list mailing list