virt plugin: fail init with no libvirt connection
authorFrancesco Romani <fromani@redhat.com>
Mon, 12 Dec 2016 15:07:25 +0000 (16:07 +0100)
committerFrancesco Romani <fromani@redhat.com>
Mon, 12 Dec 2016 15:07:25 +0000 (16:07 +0100)
Even though we handle disconnection and reconnection
in the read() callback, we expect the libvirt connection
to be available most of the time, including the init()
stage.

Thus, let's fail init() if the connection is not available.

Signed-off-by: Francesco Romani <fromani@redhat.com>
src/virt.c

index 242d0d3..93f9aee 100644 (file)
@@ -740,7 +740,8 @@ static int lv_init(void) {
   if (virInitialize() != 0)
     return -1;
 
-  lv_connect();
+  if (lv_connect() != 0)
+    return -1;
 
   DEBUG(PLUGIN_NAME " plugin: starting %i instances", nr_instances);