From: Daniel P. Berrangé Date: Mon, 28 Apr 2025 16:22:14 +0000 (+0100) Subject: nodedev: remove use hardcoded MDEVCTL path X-Git-Tag: v11.4.0-rc1~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d15cdacc3af4cacec6bb372d5036d25e04f0cc9b;p=thirdparty%2Flibvirt.git nodedev: remove use hardcoded MDEVCTL path Allow virCommand to find 'mdevctl' in $PATH. This command is only used when running privileged in which case both 'bin' and 'sbin' dirs will be in $PATH, so virFindFileInPath will do the right thing to find it. Reviewed-by: Peter Krempa Signed-off-by: Daniel P. Berrangé --- diff --git a/meson.build b/meson.build index 6d07108a02..a452f0b21e 100644 --- a/meson.build +++ b/meson.build @@ -854,7 +854,6 @@ optional_test_programs = [ ] optional_programs = [ - 'mdevctl', 'mm-ctl', 'modprobe', 'ovs-vsctl', diff --git a/src/node_device/node_device_driver.c b/src/node_device/node_device_driver.c index 123b16a292..2c9e749495 100644 --- a/src/node_device/node_device_driver.c +++ b/src/node_device/node_device_driver.c @@ -744,14 +744,14 @@ nodeDeviceGetMdevctlCommand(virNodeDeviceDef *def, case MDEVCTL_CMD_CREATE: /* now is the time to make sure "create" is replaced with "start" on * mdevctl cmdline */ - cmd = virCommandNewArgList(MDEVCTL, "start", NULL); + cmd = virCommandNewArgList("mdevctl", "start", NULL); break; case MDEVCTL_CMD_STOP: case MDEVCTL_CMD_START: case MDEVCTL_CMD_DEFINE: case MDEVCTL_CMD_UNDEFINE: case MDEVCTL_CMD_MODIFY: - cmd = virCommandNewArgList(MDEVCTL, subcommand, NULL); + cmd = virCommandNewArgList("mdevctl", subcommand, NULL); break; case MDEVCTL_CMD_LAST: default: @@ -901,7 +901,7 @@ nodeDeviceGetMdevctlModifySupportCheck(void) g_autoptr(virCommand) cmd = NULL; const char *subcommand = virMdevctlCommandTypeToString(MDEVCTL_CMD_MODIFY); - cmd = virCommandNewArgList(MDEVCTL, + cmd = virCommandNewArgList("mdevctl", subcommand, "--defined", "--live", @@ -1130,7 +1130,7 @@ nodeDeviceGetMdevctlSetAutostartCommand(virNodeDeviceDef *def, bool autostart, char **errmsg) { - virCommand *cmd = virCommandNewArgList(MDEVCTL, + virCommand *cmd = virCommandNewArgList("mdevctl", "modify", "--uuid", def->caps->data.mdev.uuid, @@ -1176,7 +1176,7 @@ nodeDeviceGetMdevctlListCommand(bool defined, char **output, char **errmsg) { - virCommand *cmd = virCommandNewArgList(MDEVCTL, + virCommand *cmd = virCommandNewArgList("mdevctl", "list", "--dumpjson", NULL); @@ -1894,8 +1894,8 @@ nodeDeviceUpdateMediatedDevices(virNodeDeviceDriverState *node_driver) virMdevctlForEachData data = { 0, }; size_t i; - if (!(mdevctl = virFindFileInPath(MDEVCTL))) { - VIR_DEBUG(MDEVCTL " not found. Skipping update of mediated devices."); + if (!(mdevctl = virFindFileInPath("mdevctl"))) { + VIR_DEBUG("'mdevctl' not found. Skipping update of mediated devices."); return 0; }