mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
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: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
9da0cc9ddb
commit
e72f3e5933
@ -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__ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user