[PATCH 13/20] util: remove use hardcoded MM_CTL path

Daniel P. Berrangé via Devel posted 20 patches 11 months, 3 weeks ago
[PATCH 13/20] util: remove use hardcoded MM_CTL path
Posted by Daniel P. Berrangé via Devel 11 months, 3 weeks ago
From: Daniel P. Berrangé <berrange@redhat.com>

Allow virCommand to find 'mm-ctl' 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.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 meson.build                 | 2 --
 src/util/virnetdevmidonet.c | 4 ++--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index 9759a3322b..2a7c264114 100644
--- a/meson.build
+++ b/meson.build
@@ -854,8 +854,6 @@ optional_test_programs = [
 ]
 
 optional_programs = [
-  'mdevctl',
-  'mm-ctl',
   'modprobe',
   'ovs-vsctl',
   'rmmod',
diff --git a/src/util/virnetdevmidonet.c b/src/util/virnetdevmidonet.c
index 7a285d2bab..a6f1dd1a8f 100644
--- a/src/util/virnetdevmidonet.c
+++ b/src/util/virnetdevmidonet.c
@@ -43,7 +43,7 @@ virNetDevMidonetBindPort(const char *ifname,
 
     virUUIDFormat(virtualport->interfaceID, virtportuuid);
 
-    cmd = virCommandNew(MM_CTL);
+    cmd = virCommandNew("mm-ctl");
 
     virCommandAddArgList(cmd, "--bind-port", virtportuuid, ifname, NULL);
 
@@ -73,7 +73,7 @@ virNetDevMidonetUnbindPort(const virNetDevVPortProfile *virtualport)
 
     virUUIDFormat(virtualport->interfaceID, virtportuuid);
 
-    cmd = virCommandNew(MM_CTL);
+    cmd = virCommandNew("mm-ctl");
     virCommandAddArgList(cmd, "--unbind-port", virtportuuid, NULL);
 
     if (virCommandRun(cmd, NULL) < 0) {
-- 
2.49.0
Re: [PATCH 13/20] util: remove use hardcoded MM_CTL path
Posted by Peter Krempa via Devel 11 months, 3 weeks ago
On Tue, Apr 29, 2025 at 12:14:13 +0100, Daniel P. Berrangé via Devel wrote:
> From: Daniel P. Berrangé <berrange@redhat.com>
> 
> Allow virCommand to find 'mm-ctl' 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.
> 
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  meson.build                 | 2 --
>  src/util/virnetdevmidonet.c | 4 ++--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index 9759a3322b..2a7c264114 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -854,8 +854,6 @@ optional_test_programs = [
>  ]
>  
>  optional_programs = [
> -  'mdevctl',

12/20

> -  'mm-ctl',
>    'modprobe',
>    'ovs-vsctl',
>    'rmmod',

Reviewed-by: Peter Krempa <pkrempa@redhat.com>