|
|
7a3408 |
From ce2001d94e099b4d8e6279f70af6d355283279fb Mon Sep 17 00:00:00 2001
|
|
|
7a3408 |
Message-Id: <ce2001d94e099b4d8e6279f70af6d355283279fb@dist-git>
|
|
|
7a3408 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
Date: Wed, 15 Jul 2015 17:11:55 +0200
|
|
|
7a3408 |
Subject: [PATCH] rpc: Add virNetDaemonHasClients
|
|
|
7a3408 |
|
|
|
7a3408 |
https://bugzilla.redhat.com/show_bug.cgi?id=1240283
|
|
|
7a3408 |
|
|
|
7a3408 |
So callers don't have to iterate over each server.
|
|
|
7a3408 |
|
|
|
7a3408 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
(cherry picked from commit 699faeacb10459fed748d425eb044ef69697e804)
|
|
|
7a3408 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
7a3408 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
7a3408 |
---
|
|
|
7a3408 |
src/libvirt_remote.syms | 1 +
|
|
|
7a3408 |
src/rpc/virnetdaemon.c | 13 +++++++++++++
|
|
|
7a3408 |
src/rpc/virnetdaemon.h | 2 ++
|
|
|
7a3408 |
3 files changed, 16 insertions(+)
|
|
|
7a3408 |
|
|
|
7a3408 |
diff --git a/src/libvirt_remote.syms b/src/libvirt_remote.syms
|
|
|
7a3408 |
index e6ca041..6bfdcfa 100644
|
|
|
7a3408 |
--- a/src/libvirt_remote.syms
|
|
|
7a3408 |
+++ b/src/libvirt_remote.syms
|
|
|
7a3408 |
@@ -65,6 +65,7 @@ virNetDaemonAddSignalHandler;
|
|
|
7a3408 |
virNetDaemonAutoShutdown;
|
|
|
7a3408 |
virNetDaemonClose;
|
|
|
7a3408 |
virNetDaemonGetServer;
|
|
|
7a3408 |
+virNetDaemonHasClients;
|
|
|
7a3408 |
virNetDaemonIsPrivileged;
|
|
|
7a3408 |
virNetDaemonNew;
|
|
|
7a3408 |
virNetDaemonNewPostExecRestart;
|
|
|
7a3408 |
diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c
|
|
|
7a3408 |
index 67dff14..6b13282 100644
|
|
|
7a3408 |
--- a/src/rpc/virnetdaemon.c
|
|
|
7a3408 |
+++ b/src/rpc/virnetdaemon.c
|
|
|
7a3408 |
@@ -747,3 +747,16 @@ virNetDaemonClose(virNetDaemonPtr dmn)
|
|
|
7a3408 |
|
|
|
7a3408 |
virObjectUnlock(dmn);
|
|
|
7a3408 |
}
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+bool
|
|
|
7a3408 |
+virNetDaemonHasClients(virNetDaemonPtr dmn)
|
|
|
7a3408 |
+{
|
|
|
7a3408 |
+ size_t i = 0;
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ for (i = 0; i < dmn->nservers; i++) {
|
|
|
7a3408 |
+ if (virNetServerHasClients(dmn->servers[i]))
|
|
|
7a3408 |
+ return true;
|
|
|
7a3408 |
+ }
|
|
|
7a3408 |
+
|
|
|
7a3408 |
+ return false;
|
|
|
7a3408 |
+}
|
|
|
7a3408 |
diff --git a/src/rpc/virnetdaemon.h b/src/rpc/virnetdaemon.h
|
|
|
7a3408 |
index 9e176d6..bb32053 100644
|
|
|
7a3408 |
--- a/src/rpc/virnetdaemon.h
|
|
|
7a3408 |
+++ b/src/rpc/virnetdaemon.h
|
|
|
7a3408 |
@@ -76,6 +76,8 @@ void virNetDaemonQuit(virNetDaemonPtr dmn);
|
|
|
7a3408 |
|
|
|
7a3408 |
void virNetDaemonClose(virNetDaemonPtr dmn);
|
|
|
7a3408 |
|
|
|
7a3408 |
+bool virNetDaemonHasClients(virNetDaemonPtr dmn);
|
|
|
7a3408 |
+
|
|
|
7a3408 |
virNetServerPtr virNetDaemonGetServer(virNetDaemonPtr dmn,
|
|
|
7a3408 |
int subServerID);
|
|
|
7a3408 |
|
|
|
7a3408 |
--
|
|
|
7a3408 |
2.5.0
|
|
|
7a3408 |
|