[libvirt] [PATCH] vbox: don't fail on missing vbox

Hi, virsh fails with: 10:47:37.104: debug : do_open:922 : no name, allowing driver auto-select 10:47:37.104: debug : do_open:930 : trying driver 0 (Test) ... 10:47:37.104: debug : do_open:936 : driver 0 Test returned DECLINED 10:47:37.104: debug : do_open:930 : trying driver 1 (OPENVZ) ... 10:47:37.105: debug : do_open:936 : driver 1 OPENVZ returned DECLINED 10:47:37.105: debug : do_open:930 : trying driver 2 (VBOX) ... 10:47:37.106: debug : do_open:936 : driver 2 VBOX returned ERROR 10:47:37.106: debug : virUnrefConnect:210 : unref connection 0x10032b10 1 10:47:37.106: debug : virReleaseConnect:171 : release connection 0x10032b10 error: failed to connect to the hypervisor if one has built with vbox support but vbox is not installed. Attached patch calls VBoxCGlueInit() early so we can return 'declined' instead of 'error'. O.k. to apply? -- Guido

On Thu, May 07, 2009 at 10:50:54AM +0200, Guido G?nther wrote:
Hi, virsh fails with:
10:47:37.104: debug : do_open:922 : no name, allowing driver auto-select 10:47:37.104: debug : do_open:930 : trying driver 0 (Test) ... 10:47:37.104: debug : do_open:936 : driver 0 Test returned DECLINED 10:47:37.104: debug : do_open:930 : trying driver 1 (OPENVZ) ... 10:47:37.105: debug : do_open:936 : driver 1 OPENVZ returned DECLINED 10:47:37.105: debug : do_open:930 : trying driver 2 (VBOX) ... 10:47:37.106: debug : do_open:936 : driver 2 VBOX returned ERROR 10:47:37.106: debug : virUnrefConnect:210 : unref connection 0x10032b10 1 10:47:37.106: debug : virReleaseConnect:171 : release connection 0x10032b10 error: failed to connect to the hypervisor
if one has built with vbox support but vbox is not installed. Attached patch calls VBoxCGlueInit() early so we can return 'declined' instead of 'error'. O.k. to apply?
Doh, we'd already fixed this once befor e- I guess the recent initialization rewrite re-introduced the problem. ACK to this. Daniel
From 109079559c6600fc701f83aecc0dda691cf9f304 Mon Sep 17 00:00:00 2001 From: =?utf-8?q?Guido=20G=C3=BCnther?= <agx@sigxcpu.org> Date: Thu, 7 May 2009 10:30:33 +0200 Subject: [PATCH 1/2] don't return VIR_DRV_OPEN_ERROR if we can't find the vbox driver
--- src/vbox/vbox_tmpl.c | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 7297172..3ff25b1 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -217,11 +217,6 @@ no_memory:
static int vboxInitialize(virConnectPtr conn, vboxGlobalData *data) {
- if (VBoxCGlueInit() != 0) { - vboxError(conn, VIR_ERR_INTERNAL_ERROR, "Can't Initialize VirtualBox, VBoxCGlueInit failed."); - goto cleanup; - } - /* This is for when glue init failed and we're serving as dummy driver. */ if (g_pfnGetFunctions == NULL) goto cleanup; @@ -308,6 +303,11 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn, vboxGlobalData *data; uid_t uid = getuid();
+ if (VBoxCGlueInit() != 0) { + VIR_DEBUG0("Can't Initialize VirtualBox, VBoxCGlueInit failed."); + return VIR_DRV_OPEN_DECLINED; + } + if (conn->uri == NULL) { conn->uri = xmlParseURI(uid ? "vbox:///session" : "vbox:///system"); if (conn->uri == NULL) { -- 1.6.2.4
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
-- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Hi, virsh fails with:
10:47:37.104: debug : do_open:922 : no name, allowing driver auto-select 10:47:37.104: debug : do_open:930 : trying driver 0 (Test) ... 10:47:37.104: debug : do_open:936 : driver 0 Test returned DECLINED 10:47:37.104: debug : do_open:930 : trying driver 1 (OPENVZ) ... 10:47:37.105: debug : do_open:936 : driver 1 OPENVZ returned DECLINED 10:47:37.105: debug : do_open:930 : trying driver 2 (VBOX) ... 10:47:37.106: debug : do_open:936 : driver 2 VBOX returned ERROR 10:47:37.106: debug : virUnrefConnect:210 : unref connection 0x10032b10 1 10:47:37.106: debug : virReleaseConnect:171 : release connection 0x10032b10 error: failed to connect to the hypervisor
if one has built with vbox support but vbox is not installed. Attached patch calls VBoxCGlueInit() early so we can return 'declined' instead of 'error'. O.k. to apply?
On Thursday 07 May 2009 10:50:54 Guido Günther wrote: the above patch leads to memory leaks as vboxUninitialize() needs to be called if VBoxCGlueInit() is called, so modifying it as below solves both the problems. (declined is right here cause the only error condition is while conn->uri == NULL is already being handled, and thus the following patch) Regards, Pritesh

On Thu, May 07, 2009 at 11:19:01AM +0200, Pritesh Kothari wrote:
Hi, virsh fails with:
10:47:37.104: debug : do_open:922 : no name, allowing driver auto-select 10:47:37.104: debug : do_open:930 : trying driver 0 (Test) ... 10:47:37.104: debug : do_open:936 : driver 0 Test returned DECLINED 10:47:37.104: debug : do_open:930 : trying driver 1 (OPENVZ) ... 10:47:37.105: debug : do_open:936 : driver 1 OPENVZ returned DECLINED 10:47:37.105: debug : do_open:930 : trying driver 2 (VBOX) ... 10:47:37.106: debug : do_open:936 : driver 2 VBOX returned ERROR 10:47:37.106: debug : virUnrefConnect:210 : unref connection 0x10032b10 1 10:47:37.106: debug : virReleaseConnect:171 : release connection 0x10032b10 error: failed to connect to the hypervisor
if one has built with vbox support but vbox is not installed. Attached patch calls VBoxCGlueInit() early so we can return 'declined' instead of 'error'. O.k. to apply?
On Thursday 07 May 2009 10:50:54 Guido Günther wrote: the above patch leads to memory leaks as vboxUninitialize() needs to be called if VBoxCGlueInit() is called, so modifying it as below solves both the problems. (declined is right here cause the only error condition is while conn->uri == NULL is already being handled, and thus the following patch)
Ok, thanks for checking this. ACK to this patch instead of Guido's. Daniel
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 7297172..2416b30 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -350,7 +350,7 @@ static virDrvOpenStatus vboxOpen(virConnectPtr conn, return VIR_DRV_OPEN_SUCCESS; cleanup: vboxUninitialize(data); - return VIR_DRV_OPEN_ERROR; + return VIR_DRV_OPEN_DECLINED; }
static int vboxClose(virConnectPtr conn) {
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
-- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, May 07, 2009 at 10:25:34AM +0100, Daniel P. Berrange wrote:
On Thu, May 07, 2009 at 11:19:01AM +0200, Pritesh Kothari wrote:
Hi, virsh fails with:
10:47:37.104: debug : do_open:922 : no name, allowing driver auto-select 10:47:37.104: debug : do_open:930 : trying driver 0 (Test) ... 10:47:37.104: debug : do_open:936 : driver 0 Test returned DECLINED 10:47:37.104: debug : do_open:930 : trying driver 1 (OPENVZ) ... 10:47:37.105: debug : do_open:936 : driver 1 OPENVZ returned DECLINED 10:47:37.105: debug : do_open:930 : trying driver 2 (VBOX) ... 10:47:37.106: debug : do_open:936 : driver 2 VBOX returned ERROR 10:47:37.106: debug : virUnrefConnect:210 : unref connection 0x10032b10 1 10:47:37.106: debug : virReleaseConnect:171 : release connection 0x10032b10 error: failed to connect to the hypervisor
if one has built with vbox support but vbox is not installed. Attached patch calls VBoxCGlueInit() early so we can return 'declined' instead of 'error'. O.k. to apply?
On Thursday 07 May 2009 10:50:54 Guido Günther wrote: the above patch leads to memory leaks as vboxUninitialize() needs to be called if VBoxCGlueInit() is called, so modifying it as below solves both the problems. (declined is right here cause the only error condition is while conn->uri == NULL is already being handled, and thus the following patch)
Ok, thanks for checking this. ACK to this patch instead of Guido's. Applied now. -- Guido
participants (3)
-
Daniel P. Berrange
-
Guido Günther
-
Pritesh Kothari