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

[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
>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


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