mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
libxl: load on FreeBSD
The libxl tries to check if it's running in dom0 by parsing /proc/xen/capabilities and if that fails it doesn't load. There's no procfs interface in Xen on FreeBSD, so this check always fails. In addition to checking procfs, check if /dev/xen/xenstored, that's enough to check if we're running in dom0 in FreeBSD case.
This commit is contained in:
parent
0a33bba1ae
commit
f57842ecfd
@ -74,6 +74,7 @@ VIR_LOG_INIT("libxl.libxl_driver");
|
|||||||
#define LIBXL_CONFIG_FORMAT_SEXPR "xen-sxpr"
|
#define LIBXL_CONFIG_FORMAT_SEXPR "xen-sxpr"
|
||||||
|
|
||||||
#define HYPERVISOR_CAPABILITIES "/proc/xen/capabilities"
|
#define HYPERVISOR_CAPABILITIES "/proc/xen/capabilities"
|
||||||
|
#define HYPERVISOR_XENSTORED "/dev/xen/xenstored"
|
||||||
|
|
||||||
/* Number of Xen scheduler parameters */
|
/* Number of Xen scheduler parameters */
|
||||||
#define XEN_SCHED_CREDIT_NPARAM 2
|
#define XEN_SCHED_CREDIT_NPARAM 2
|
||||||
@ -427,8 +428,6 @@ static bool
|
|||||||
libxlDriverShouldLoad(bool privileged)
|
libxlDriverShouldLoad(bool privileged)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
int status;
|
|
||||||
char *output = NULL;
|
|
||||||
|
|
||||||
/* Don't load if non-root */
|
/* Don't load if non-root */
|
||||||
if (!privileged) {
|
if (!privileged) {
|
||||||
@ -436,24 +435,27 @@ libxlDriverShouldLoad(bool privileged)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!virFileExists(HYPERVISOR_CAPABILITIES)) {
|
if (virFileExists(HYPERVISOR_CAPABILITIES)) {
|
||||||
VIR_INFO("Disabling driver as " HYPERVISOR_CAPABILITIES
|
int status;
|
||||||
" does not exist");
|
char *output = NULL;
|
||||||
return ret;
|
/*
|
||||||
}
|
* Don't load if not running on a Xen control domain (dom0). It is not
|
||||||
/*
|
* sufficient to check for the file to exist as any guest can mount
|
||||||
* Don't load if not running on a Xen control domain (dom0). It is not
|
* xenfs to /proc/xen.
|
||||||
* sufficient to check for the file to exist as any guest can mount
|
*/
|
||||||
* xenfs to /proc/xen.
|
status = virFileReadAll(HYPERVISOR_CAPABILITIES, 10, &output);
|
||||||
*/
|
if (status >= 0)
|
||||||
status = virFileReadAll(HYPERVISOR_CAPABILITIES, 10, &output);
|
status = strncmp(output, "control_d", 9);
|
||||||
if (status >= 0)
|
VIR_FREE(output);
|
||||||
status = strncmp(output, "control_d", 9);
|
if (status) {
|
||||||
VIR_FREE(output);
|
VIR_INFO("No Xen capabilities detected, probably not running "
|
||||||
if (status) {
|
"in a Xen Dom0. Disabling libxenlight driver");
|
||||||
VIR_INFO("No Xen capabilities detected, probably not running "
|
|
||||||
"in a Xen Dom0. Disabling libxenlight driver");
|
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
} else if (!virFileExists(HYPERVISOR_XENSTORED)) {
|
||||||
|
VIR_INFO("Disabling driver as neither " HYPERVISOR_CAPABILITIES
|
||||||
|
" nor " HYPERVISOR_XENSTORED " exist");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user