提交 e72f3e59 编写于 作者: D Daniel P. Berrange 提交者: Daniel P. Berrangé

rpc: add method for checking if a named server exists

It is not possible to blindly call virNetDaemonGetServer()
because in a post-exec restart scenario, some servers may
not exist and this method will pollute the error logs.
Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
上级 9da0cc9d
......@@ -69,6 +69,7 @@ virNetDaemonClose;
virNetDaemonGetServer;
virNetDaemonGetServers;
virNetDaemonHasClients;
virNetDaemonHasServer;
virNetDaemonIsPrivileged;
virNetDaemonNew;
virNetDaemonNewPostExecRestart;
......
......@@ -195,6 +195,19 @@ virNetDaemonGetServer(virNetDaemonPtr dmn,
return srv;
}
bool
virNetDaemonHasServer(virNetDaemonPtr dmn,
const char *serverName)
{
void *ent;
virObjectLock(dmn);
ent = virHashLookup(dmn->servers, serverName);
virObjectUnlock(dmn);
return ent != NULL;
}
struct collectData {
virNetServerPtr **servers;
......
......@@ -83,5 +83,7 @@ bool virNetDaemonHasClients(virNetDaemonPtr dmn);
virNetServerPtr virNetDaemonGetServer(virNetDaemonPtr dmn,
const char *serverName);
ssize_t virNetDaemonGetServers(virNetDaemonPtr dmn, virNetServerPtr **servers);
bool virNetDaemonHasServer(virNetDaemonPtr dmn,
const char *serverName);
#endif /* __VIR_NET_DAEMON_H__ */
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册