mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-11 15:27:47 +00:00
Fix libxl driver startup
When you happen to have a libvirtd binary compiled with the libxenlight driver (say you have installed xen-4.1 libraries) but not running a xen enabled system, then libvirtd fails to start. The cause is that libxlStartup() returns -1 when failing to initialize the library, and this propagates to virStateInitialize() which consider this a failure. We should only exit libxlStartup with an error code if something like an allocation error occurs, not if the driver failed to initialize. * src/libxl/libxl_driver.c: fix libxlStartup() to not return -1 when failing to initialize the libxenlight library
This commit is contained in:
parent
1e8f20799c
commit
03ede2f69d
@ -548,7 +548,7 @@ libxlStartup(int privileged) {
|
||||
const libxl_version_info *ver_info;
|
||||
char *log_file = NULL;
|
||||
virCommandPtr cmd;
|
||||
int status;
|
||||
int status, ret = 0;
|
||||
|
||||
/* Disable libxl driver if non-root */
|
||||
if (!privileged) {
|
||||
@ -659,19 +659,19 @@ libxlStartup(int privileged) {
|
||||
(xentoollog_logger *)xtl_createlogger_stdiostream(libxl_driver->logger_file, XTL_DEBUG, 0);
|
||||
if (!libxl_driver->logger) {
|
||||
VIR_ERROR0(_("cannot create logger for libxenlight"));
|
||||
goto error;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (libxl_ctx_init(&libxl_driver->ctx,
|
||||
LIBXL_VERSION,
|
||||
libxl_driver->logger)) {
|
||||
VIR_ERROR0(_("cannot initialize libxenlight context"));
|
||||
goto error;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if ((ver_info = libxl_get_version_info(&libxl_driver->ctx)) == NULL) {
|
||||
VIR_ERROR0(_("cannot version information from libxenlight"));
|
||||
goto error;
|
||||
goto fail;
|
||||
}
|
||||
libxl_driver->version = (ver_info->xen_version_major * 1000000) +
|
||||
(ver_info->xen_version_minor * 1000);
|
||||
@ -712,11 +712,13 @@ libxlStartup(int privileged) {
|
||||
out_of_memory:
|
||||
virReportOOMError();
|
||||
error:
|
||||
ret = -1;
|
||||
fail:
|
||||
VIR_FREE(log_file);
|
||||
if (libxl_driver)
|
||||
libxlDriverUnlock(libxl_driver);
|
||||
libxlShutdown();
|
||||
return -1;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
|
Loading…
Reference in New Issue
Block a user