Re: [PATCH v2 4/9] rpc: Introduce new elements 'id' and 'name' to virnetserver structure

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

 



On Fri, Aug 21, 2015 at 08:04:05PM +0200, Erik Skultety wrote:
By adding these elements, we'll be able to represent the servers on
client side. This is merely because when listing clients or managing
clients, it would be convenient to know which server they're connected
to. Also reflect this change in virnetdaemontest as well.
---
daemon/libvirtd.c         |  2 ++
src/locking/lock_daemon.c |  2 +-
src/lxc/lxc_controller.c  |  2 +-
src/rpc/virnetdaemon.c    |  1 +
src/rpc/virnetserver.c    | 18 +++++++++++++++++-
src/rpc/virnetserver.h    |  1 +
tests/virnetdaemontest.c  |  2 +-
7 files changed, 24 insertions(+), 4 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 250094b..de4953d 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1390,6 +1390,7 @@ int main(int argc, char **argv) {
                                config->keepalive_interval,
                                config->keepalive_count,
                                config->mdns_adv ? config->mdns_name : NULL,
+                                "libvirtd",
                                remoteClientInitHook,
                                NULL,
                                remoteClientFreeFunc,
@@ -1464,6 +1465,7 @@ int main(int argc, char **argv) {
                                   config->admin_keepalive_interval,
                                   config->admin_keepalive_count,
                                   NULL,
+                                   "admin",
                                   remoteAdmClientInitHook,
                                   NULL,
                                   remoteAdmClientFreeFunc,
diff --git a/src/locking/lock_daemon.c b/src/locking/lock_daemon.c
index ae3a507..8c07fd6 100644
--- a/src/locking/lock_daemon.c
+++ b/src/locking/lock_daemon.c
@@ -150,7 +150,7 @@ virLockDaemonNew(virLockDaemonConfigPtr config, bool privileged)

    if (!(srv = virNetServerNew(1, 1, 0, config->max_clients,
                                config->max_clients, -1, 0,
-                                NULL,
+                                NULL, "virtlockd",
                                virLockDaemonClientNew,
                                virLockDaemonClientPreExecRestart,
                                virLockDaemonClientFree,
diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c
index 48a3597..0984be0 100644
--- a/src/lxc/lxc_controller.c
+++ b/src/lxc/lxc_controller.c
@@ -926,7 +926,7 @@ static int virLXCControllerSetupServer(virLXCControllerPtr ctrl)

    if (!(srv = virNetServerNew(0, 0, 0, 1,
                                0, -1, 0,
-                                NULL,
+                                NULL, "LXC",
                                virLXCControllerClientPrivateNew,
                                NULL,
                                virLXCControllerClientPrivateFree,
diff --git a/src/rpc/virnetdaemon.c b/src/rpc/virnetdaemon.c
index 910f266..bdfcfb7 100644
--- a/src/rpc/virnetdaemon.c
+++ b/src/rpc/virnetdaemon.c
@@ -69,6 +69,7 @@ struct _virNetDaemon {
    int sigwrite;
    int sigwatch;

+    unsigned int nextSrvId;
    size_t nservers;
    virNetServerPtr *servers;
    virJSONValuePtr srvObject;
diff --git a/src/rpc/virnetserver.c b/src/rpc/virnetserver.c
index 80b5588..ffc1b0d 100644
--- a/src/rpc/virnetserver.c
+++ b/src/rpc/virnetserver.c
@@ -36,6 +36,7 @@

VIR_LOG_INIT("rpc.netserver");

+static unsigned int nextServerId;


I don't like that the number is being tracked on two places.  Since
the number is now just sequentially increased (and who knows whether
there'll be anything else than 2 servers), we can keep it in one place
and we have two options how to do that:

1) Track it in virNetDaemon and pass it to the server being created
   (that way we can have non-consecutive IDs),

2) Track it in the Server and return the number upon creation (that
   way we don't need to pass it to the creation function)

Attachment: signature.asc
Description: PGP signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]