virt-admin: Call virInitialize to fix startup crash

Message ID d4c87566221d6f4ed9cabded6d6cbdd69147f4b7.1467051839.git.crobinso@redhat.com
State New
Headers show

Commit Message

Cole Robinson June 27, 2016, 6:28 p.m.
Similar to what virsh and virt-login-shell do

https://bugzilla.redhat.com/show_bug.cgi?id=1350315
---
I can't actually reproduce the bug, the backtrace is similar to
97973ebb7 which added the same fix for virt-login-shell, and
that commit also mentions the randomness of reproducing...

 tools/virt-admin.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.7.4

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

Comments

Cole Robinson June 29, 2016, 12:22 p.m. | #1
On 06/29/2016 03:34 AM, Erik Skultety wrote:
> On 27/06/16 20:28, Cole Robinson wrote:

>> Similar to what virsh and virt-login-shell do

>>

>> https://bugzilla.redhat.com/show_bug.cgi?id=1350315

>> ---

>> I can't actually reproduce the bug, the backtrace is similar to

>> 97973ebb7 which added the same fix for virt-login-shell, and

>> that commit also mentions the randomness of reproducing...

>>

>>  tools/virt-admin.c | 5 +++++

>>  1 file changed, 5 insertions(+)

>>

>> diff --git a/tools/virt-admin.c b/tools/virt-admin.c

>> index 4acac65..7bff5c3 100644

>> --- a/tools/virt-admin.c

>> +++ b/tools/virt-admin.c

>> @@ -1371,6 +1371,11 @@ main(int argc, char **argv)

>>          return EXIT_FAILURE;

>>      }

>>  

>> +    if (virInitialize() < 0) {

>> +        vshError(ctl, "%s", _("Failed to initialize libvirt"));

>> +        return EXIT_FAILURE;

>> +    }

>> +

>>      virFileActivateDirOverride(argv[0]);

>>  

>>      if (!vshInit(ctl, cmdGroups, NULL))

>>

> 

> So, based on Luyao's feedback on the modified patch I attached to

> https://bugzilla.redhat.com/show_bug.cgi?id=1350315, ACK if you replace

> virInitialize call with virAdmInitialize (do not forget to export the

> symbol through public syms :)...). I keep wondering though, why none of


I'll just give my ACK to your patch instead :) Please push that

> us (you, me, and Martin) was able to reproduce it even once.

> 


Yeah there's definitely some weirdness... see the commit message for the
similar virt-login-shell change, which one day just randomly started breaking

- Cole

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

Patch hide | download patch | download mbox

diff --git a/tools/virt-admin.c b/tools/virt-admin.c
index 4acac65..7bff5c3 100644
--- a/tools/virt-admin.c
+++ b/tools/virt-admin.c
@@ -1371,6 +1371,11 @@  main(int argc, char **argv)
         return EXIT_FAILURE;
     }
 
+    if (virInitialize() < 0) {
+        vshError(ctl, "%s", _("Failed to initialize libvirt"));
+        return EXIT_FAILURE;
+    }
+
     virFileActivateDirOverride(argv[0]);
 
     if (!vshInit(ctl, cmdGroups, NULL))