[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 04/21] 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>
---
 daemon/libvirtd.c         | 4 ++--
 src/locking/lock_daemon.c | 2 +-
 src/logging/log_daemon.c  | 2 +-
 src/lxc/lxc_controller.c  | 2 +-
 src/rpc/virnetdaemon.c    | 2 +-
 src/rpc/virnetdaemon.h    | 1 -
 tests/virnetdaemontest.c  | 2 +-
 7 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index beddec1bb852..3d38a46ee7d2 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -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;
     }
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index c89b842f0faf..973e6918c9fe 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -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,
diff --git a/src/logging/log_daemon.c b/src/logging/log_daemon.c
index 866e8a85f4fa..68f0647638b3 100644
--- a/src/logging/log_daemon.c
+++ b/src/logging/log_daemon.c
@@ -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,
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 21cf71fa08a5..b1b55f0e02e1 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -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);
diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c
index 7ae06dd38007..3dc47792a8ba 100644
--- a/src/rpc/virnetdaemon.c
+++ b/src/rpc/virnetdaemon.c
@@ -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);

diff --git a/src/rpc/virnetdaemon.h b/src/rpc/virnetdaemon.h
index 9a3404f544fd..0084dfd6527a 100644
--- a/src/rpc/virnetdaemon.h
+++ b/src/rpc/virnetdaemon.h
@@ -38,7 +38,6 @@
 virNetDaemonPtr virNetDaemonNew(void);

 int virNetDaemonAddServer(virNetDaemonPtr dmn,
-                          const char *serverName,
                           virNetServerPtr srv);

 virNetServerPtr virNetDaemonAddServerPostExec(virNetDaemonPtr dmn,
diff --git a/tests/virnetdaemontest.c b/tests/virnetdaemontest.c
index 443a406b77f2..1608923d09d7 100644
--- a/tests/virnetdaemontest.c
+++ b/tests/virnetdaemontest.c
@@ -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)))
-- 
2.7.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]