Re: [PATCH v2 5/9] virnetdaemon: Add post exec restart support for multiple servers

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

 



On Fri, Aug 21, 2015 at 08:04:06PM +0200, Erik Skultety wrote:
Since the daemon can manage and add (at fresh start) multiple servers,
we also should be able to add them from a JSON state file in case of a
daemon restart. This patch introduces virNetDaemonAddServersPostExec
method which harvests the data about servers from a JSON file supporting
both old format with a single server and a new one storing an array of
servers. The method makes use of the original virNetDaemonAddServerPostExec,
declaring the latter as static.
Patch also updates virnetdaemontest accordingly.
---
daemon/libvirtd.c                                  |   8 +-
src/libvirt_remote.syms                            |   3 +-
src/locking/lock_daemon.c                          |  16 +--
src/rpc/virnetdaemon.c                             |  96 +++++++++++-----
src/rpc/virnetdaemon.h                             |  28 ++++-
src/rpc/virnetserver.c                             |   4 +
src/rpc/virnetserver.h                             |   1 +
.../input-data-admin-nomdns-names.json             | 128 +++++++++++++++++++++
.../output-data-admin-nomdns-names.json            | 128 +++++++++++++++++++++
.../output-data-admin-nomdns-nonames.json          |   2 +
.../virnetdaemondata/output-data-anon-clients.json |   1 +
.../output-data-initial-nomdns.json                |   1 +
tests/virnetdaemondata/output-data-initial.json    |   1 +
tests/virnetdaemontest.c                           |  52 +++------
14 files changed, 390 insertions(+), 79 deletions(-)
create mode 100644 tests/virnetdaemondata/input-data-admin-nomdns-names.json
create mode 100644 tests/virnetdaemondata/output-data-admin-nomdns-names.json

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index de4953d..5920a96 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1159,6 +1159,8 @@ int main(int argc, char **argv) {
    bool implicit_conf = false;
    char *run_dir = NULL;
    mode_t old_umask;
+    const char *server_names[] = { "libvirtd", "admin" };
+    virNetDaemonFallbackData fbData = { .fb_server_names = server_names };


This is unnecessarily compliccated approach compared to just passing
the number on each ServerPostExec().  And it's also unsafe since you
don't have the number of the names kept anywhere neither it ends with
NULL pointer.  I had one more problem with it but I cannot recall that
right now.

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]