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:
Michal Privoznik 2021-04-13 11:50:11 +02:00
parent 54d97f020b
commit 8674faaf32

View File

@ -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);