From d15cdacc3af4cacec6bb372d5036d25e04f0cc9b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Mon, 28 Apr 2025 17:22:14 +0100 Subject: [PATCH] nodedev: remove use hardcoded MDEVCTL path MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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é --- meson.build | 1 - src/node_device/node_device_driver.c | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) 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; } -- 2.47.3