mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 03:12:22 +00:00
nodedev: Don't fail device enumeration if MDEVCTL is missing
After all devices were enumerated, the enumeration thread call nodeDeviceUpdateMediatedDevices() to refresh the state of mediated devices. This means that 'mdevctl' will be executed. But it may be missing on some systems (e.g. mine) in which case we should just skip the update of mdevs instead of failing whole device enumeration. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
parent
54d97f020b
commit
8674faaf32
@ -42,9 +42,12 @@
|
||||
#include "virnetdev.h"
|
||||
#include "virutil.h"
|
||||
#include "vircommand.h"
|
||||
#include "virlog.h"
|
||||
|
||||
#define VIR_FROM_THIS VIR_FROM_NODEDEV
|
||||
|
||||
VIR_LOG_INIT("node_device.node_device_driver");
|
||||
|
||||
virNodeDeviceDriverState *driver;
|
||||
|
||||
virDrvOpenStatus
|
||||
@ -1604,9 +1607,15 @@ nodeDeviceUpdateMediatedDevices(void)
|
||||
{
|
||||
g_autofree virNodeDeviceDef **defs = NULL;
|
||||
g_autofree char *errmsg = NULL;
|
||||
g_autofree char *mdevctl = NULL;
|
||||
virMdevctlForEachData data = { 0, };
|
||||
size_t i;
|
||||
|
||||
if (!(mdevctl = virFindFileInPath(MDEVCTL))) {
|
||||
VIR_DEBUG(MDEVCTL " not found. Skipping update of mediated devices.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((data.ndefs = virMdevctlListDefined(&defs, &errmsg)) < 0) {
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("failed to query mdevs from mdevctl: %s"), errmsg);
|
||||
|
Loading…
x
Reference in New Issue
Block a user