[PATCH v2 06/13] rpc: add shutdown facilities to netserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



virNetServerClose and virNetServerShutdownWait are used to start net server
threads shutdown and wait net server threads to actually finish respectively
during net daemon shutdown procedure.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx>
Reviewed-by: Daniel P. Berrangé <berrange@xxxxxxxxxx>
Reviewed-by: Daniel Henrique Barboza <danielhb413@xxxxxxxxx>
---
 src/rpc/virnetserver.c | 8 ++++++++
 src/rpc/virnetserver.h | 1 +
 2 files changed, 9 insertions(+)

diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index e0a2386..79ea9f6 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -942,9 +942,17 @@ void virNetServerClose(virNetServerPtr srv)
     for (i = 0; i < srv->nclients; i++)
         virNetServerClientClose(srv->clients[i]);
 
+    virThreadPoolStop(srv->workers);
+
     virObjectUnlock(srv);
 }
 
+void
+virNetServerShutdownWait(virNetServerPtr srv)
+{
+    virThreadPoolDrain(srv->workers);
+}
+
 static inline size_t
 virNetServerTrackPendingAuthLocked(virNetServerPtr srv)
 {
diff --git a/src/rpc/virnetserver.h b/src/rpc/virnetserver.h
index 1c6a2ef..112a51d 100644
--- a/src/rpc/virnetserver.h
+++ b/src/rpc/virnetserver.h
@@ -56,6 +56,7 @@ virNetServerPtr virNetServerNewPostExecRestart(virJSONValuePtr object,
     ATTRIBUTE_NONNULL(4) ATTRIBUTE_NONNULL(5) ATTRIBUTE_NONNULL(6);
 
 void virNetServerClose(virNetServerPtr srv);
+void virNetServerShutdownWait(virNetServerPtr srv);
 
 virJSONValuePtr virNetServerPreExecRestart(virNetServerPtr srv);
 
-- 
1.8.3.1




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux