]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
nodedev: remove use hardcoded MDEVCTL path
authorDaniel P. Berrangé <berrange@redhat.com>
Mon, 28 Apr 2025 16:22:14 +0000 (17:22 +0100)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 2 May 2025 08:31:27 +0000 (09:31 +0100)
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 <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
meson.build
src/node_device/node_device_driver.c

index 6d07108a02c0a5f052836274afc3434325ba2228..a452f0b21e198492dc05311d424771b7ab30aa20 100644 (file)
@@ -854,7 +854,6 @@ optional_test_programs = [
 ]
 
 optional_programs = [
-  'mdevctl',
   'mm-ctl',
   'modprobe',
   'ovs-vsctl',
index 123b16a292495bb5b9e9b4d274a5559fd66bb1da..2c9e74949575b3740e97841948b3f5d3f4435379 100644 (file)
@@ -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;
     }