mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
daemon: Get server name from the server itself
Since servers know their name, there is no need to supply such information twice. Also defeats inconsistencies. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
dad3b07814
commit
fd4f278e1a
@ -1400,7 +1400,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!(dmn = virNetDaemonNew()) ||
|
if (!(dmn = virNetDaemonNew()) ||
|
||||||
virNetDaemonAddServer(dmn, "libvirtd", srv) < 0) {
|
virNetDaemonAddServer(dmn, srv) < 0) {
|
||||||
ret = VIR_DAEMON_ERR_INIT;
|
ret = VIR_DAEMON_ERR_INIT;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@ -1474,7 +1474,7 @@ int main(int argc, char **argv) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virNetDaemonAddServer(dmn, "admin", srvAdm) < 0) {
|
if (virNetDaemonAddServer(dmn, srvAdm) < 0) {
|
||||||
ret = VIR_DAEMON_ERR_INIT;
|
ret = VIR_DAEMON_ERR_INIT;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged)
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(lockd->dmn = virNetDaemonNew()) ||
|
if (!(lockd->dmn = virNetDaemonNew()) ||
|
||||||
virNetDaemonAddServer(lockd->dmn, "virtlockd", srv) < 0)
|
virNetDaemonAddServer(lockd->dmn, srv) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(lockd->lockspaces = virHashCreate(VIR_LOCK_DAEMON_NUM_LOCKSPACES,
|
if (!(lockd->lockspaces = virHashCreate(VIR_LOCK_DAEMON_NUM_LOCKSPACES,
|
||||||
|
@ -161,7 +161,7 @@ virLogDaemonNew(virLogDaemonConfigPtr config, bool privileged)
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(logd->dmn = virNetDaemonNew()) ||
|
if (!(logd->dmn = virNetDaemonNew()) ||
|
||||||
virNetDaemonAddServer(logd->dmn, "virtlogd", logd->srv) < 0)
|
virNetDaemonAddServer(logd->dmn, logd->srv) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(logd->handler = virLogHandlerNew(privileged,
|
if (!(logd->handler = virLogHandlerNew(privileged,
|
||||||
|
@ -968,7 +968,7 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl)
|
|||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
if (!(ctrl->daemon = virNetDaemonNew()) ||
|
if (!(ctrl->daemon = virNetDaemonNew()) ||
|
||||||
virNetDaemonAddServer(ctrl->daemon, "LXC", srv) < 0)
|
virNetDaemonAddServer(ctrl->daemon, srv) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
virNetDaemonUpdateServices(ctrl->daemon, true);
|
virNetDaemonUpdateServices(ctrl->daemon, true);
|
||||||
|
@ -158,10 +158,10 @@ virNetDaemonNew(void)
|
|||||||
|
|
||||||
int
|
int
|
||||||
virNetDaemonAddServer(virNetDaemonPtr dmn,
|
virNetDaemonAddServer(virNetDaemonPtr dmn,
|
||||||
const char *serverName,
|
|
||||||
virNetServerPtr srv)
|
virNetServerPtr srv)
|
||||||
{
|
{
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
const char *serverName = virNetServerGetName(srv);
|
||||||
|
|
||||||
virObjectLock(dmn);
|
virObjectLock(dmn);
|
||||||
|
|
||||||
|
@ -38,7 +38,6 @@
|
|||||||
virNetDaemonPtr virNetDaemonNew(void);
|
virNetDaemonPtr virNetDaemonNew(void);
|
||||||
|
|
||||||
int virNetDaemonAddServer(virNetDaemonPtr dmn,
|
int virNetDaemonAddServer(virNetDaemonPtr dmn,
|
||||||
const char *serverName,
|
|
||||||
virNetServerPtr srv);
|
virNetServerPtr srv);
|
||||||
|
|
||||||
virNetServerPtr virNetDaemonAddServerPostExec(virNetDaemonPtr dmn,
|
virNetServerPtr virNetDaemonAddServerPostExec(virNetDaemonPtr dmn,
|
||||||
|
@ -164,7 +164,7 @@ static char *testGenerateJSON(const char *server_name)
|
|||||||
if (!(dmn = virNetDaemonNew()))
|
if (!(dmn = virNetDaemonNew()))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (virNetDaemonAddServer(dmn, server_name, srv) < 0)
|
if (virNetDaemonAddServer(dmn, srv) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (!(json = virNetDaemonPreExecRestart(dmn)))
|
if (!(json = virNetDaemonPreExecRestart(dmn)))
|
||||||
|
Loading…
Reference in New Issue
Block a user