1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03: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:
Martin Kletzander 2016-03-01 15:40:31 +01:00
parent dad3b07814
commit fd4f278e1a
7 changed files with 7 additions and 8 deletions

View File

@ -1400,7 +1400,7 @@ int main(int argc, char **argv) {
}
if (!(dmn = virNetDaemonNew()) ||
virNetDaemonAddServer(dmn, "libvirtd", srv) < 0) {
virNetDaemonAddServer(dmn, srv) < 0) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}
@ -1474,7 +1474,7 @@ int main(int argc, char **argv) {
goto cleanup;
}
if (virNetDaemonAddServer(dmn, "admin", srvAdm) < 0) {
if (virNetDaemonAddServer(dmn, srvAdm) < 0) {
ret = VIR_DAEMON_ERR_INIT;
goto cleanup;
}

View File

@ -171,7 +171,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged)
goto error;
if (!(lockd->dmn = virNetDaemonNew()) ||
virNetDaemonAddServer(lockd->dmn, "virtlockd", srv) < 0)
virNetDaemonAddServer(lockd->dmn, srv) < 0)
goto error;
if (!(lockd->lockspaces = virHashCreate(VIR_LOCK_DAEMON_NUM_LOCKSPACES,

View File

@ -161,7 +161,7 @@ virLogDaemonNew(virLogDaemonConfigPtr config, bool privileged)
goto error;
if (!(logd->dmn = virNetDaemonNew()) ||
virNetDaemonAddServer(logd->dmn, "virtlogd", logd->srv) < 0)
virNetDaemonAddServer(logd->dmn, logd->srv) < 0)
goto error;
if (!(logd->handler = virLogHandlerNew(privileged,

View File

@ -968,7 +968,7 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl)
goto error;
if (!(ctrl->daemon = virNetDaemonNew()) ||
virNetDaemonAddServer(ctrl->daemon, "LXC", srv) < 0)
virNetDaemonAddServer(ctrl->daemon, srv) < 0)
goto error;
virNetDaemonUpdateServices(ctrl->daemon, true);

View File

@ -158,10 +158,10 @@ virNetDaemonNew(void)
int
virNetDaemonAddServer(virNetDaemonPtr dmn,
const char *serverName,
virNetServerPtr srv)
{
int ret = -1;
const char *serverName = virNetServerGetName(srv);
virObjectLock(dmn);

View File

@ -38,7 +38,6 @@
virNetDaemonPtr virNetDaemonNew(void);
int virNetDaemonAddServer(virNetDaemonPtr dmn,
const char *serverName,
virNetServerPtr srv);
virNetServerPtr virNetDaemonAddServerPostExec(virNetDaemonPtr dmn,

View File

@ -164,7 +164,7 @@ static char *testGenerateJSON(const char *server_name)
if (!(dmn = virNetDaemonNew()))
goto cleanup;
if (virNetDaemonAddServer(dmn, server_name, srv) < 0)
if (virNetDaemonAddServer(dmn, srv) < 0)
goto cleanup;
if (!(json = virNetDaemonPreExecRestart(dmn)))