[libvirt] [PATCH] remote: daemon: Make sure that JSON symbols are properly loaded at startup

Peter Krempa posted 1 patch 5 years, 8 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/cbcc80d0f67203ee98e106663864c59e74491c43.1533120804.git.pkrempa@redhat.com
Test syntax-check passed
src/libvirt_private.syms   | 4 ++++
src/remote/remote_daemon.c | 4 ++++
2 files changed, 8 insertions(+)
[libvirt] [PATCH] remote: daemon: Make sure that JSON symbols are properly loaded at startup
Posted by Peter Krempa 5 years, 8 months ago
Explicitly call virJSONInitialize at startup of the libvirt daemon so
that we are sure that the symbols in the compat library are properly
loaded. This will prevent any random failure from happening later on
when the daemon would want to use the JSON parser.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
---
 src/libvirt_private.syms   | 4 ++++
 src/remote/remote_daemon.c | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index fc386e1699..70dfcc5e29 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2135,6 +2135,10 @@ virJSONValueObjectStealObject;
 virJSONValueToString;


+# util/virjsoncompat.h
+virJSONInitialize;
+
+
 # util/virkeycode.h
 virKeycodeSetTypeFromString;
 virKeycodeSetTypeToString;
diff --git a/src/remote/remote_daemon.c b/src/remote/remote_daemon.c
index 9f3a5f38ad..8bbc3818bb 100644
--- a/src/remote/remote_daemon.c
+++ b/src/remote/remote_daemon.c
@@ -59,6 +59,7 @@
 #include "virutil.h"
 #include "virgettext.h"
 #include "util/virnetdevopenvswitch.h"
+#include "virjsoncompat.h"

 #include "driver.h"

@@ -1183,6 +1184,9 @@ int main(int argc, char **argv) {
         exit(EXIT_FAILURE);
     }

+    if (virJSONInitialize() < 0)
+        exit(EXIT_FAILURE);
+
     daemonSetupNetDevOpenvswitch(config);

     if (daemonSetupAccessManager(config) < 0) {
-- 
2.16.2

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] remote: daemon: Make sure that JSON symbols are properly loaded at startup
Posted by Daniel P. Berrangé 5 years, 8 months ago
On Wed, Aug 01, 2018 at 12:53:24PM +0200, Peter Krempa wrote:
> Explicitly call virJSONInitialize at startup of the libvirt daemon so
> that we are sure that the symbols in the compat library are properly
> loaded. This will prevent any random failure from happening later on
> when the daemon would want to use the JSON parser.
> 
> Signed-off-by: Peter Krempa <pkrempa@redhat.com>
> ---
>  src/libvirt_private.syms   | 4 ++++
>  src/remote/remote_daemon.c | 4 ++++
>  2 files changed, 8 insertions(+)

For sake of historical record

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

but due to mailing list problems, I acked it via IRC for Peter and we pushed
before release.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

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