diff mbox series

[v3] mpls01.sh: Add --allow-unsupported for modprobe

Message ID 20240903081916.27033-1-wegao@suse.com
State Changes Requested
Headers show
Series [v3] mpls01.sh: Add --allow-unsupported for modprobe | expand

Commit Message

Wei Gao Sept. 3, 2024, 8:19 a.m. UTC
In sle-micro we encounter following error when do modprobe:
root# modprobe mpls_router
modprobe: ERROR: module 'mpls_router' is unsupported
modprobe: ERROR: Use --allow-unsupported or set allow_unsupported_modules 1 in
modprobe: ERROR: /etc/modprobe.d/10-unsupported-modules.conf
modprobe: ERROR: could not insert 'mpls_router': Operation not permitted

Signed-off-by: Wei Gao <wegao@suse.com>
Reviewed-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/network/mpls/mpls01.sh | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Petr Vorel Sept. 3, 2024, 9:49 a.m. UTC | #1
Hi Wei,

> In sle-micro we encounter following error when do modprobe:
> root# modprobe mpls_router
> modprobe: ERROR: module 'mpls_router' is unsupported
> modprobe: ERROR: Use --allow-unsupported or set allow_unsupported_modules 1 in
> modprobe: ERROR: /etc/modprobe.d/10-unsupported-modules.conf
> modprobe: ERROR: could not insert 'mpls_router': Operation not permitted

This is needed in other mpls tests (mpls0[2-4].sh, it needs to be in mpls_lib.sh
to be reused.

Kind regards,
Petr

> Signed-off-by: Wei Gao <wegao@suse.com>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/mpls/mpls01.sh | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)

> diff --git a/testcases/network/mpls/mpls01.sh b/testcases/network/mpls/mpls01.sh
> index 196b5b2f9..892b5bd85 100755
> --- a/testcases/network/mpls/mpls01.sh
> +++ b/testcases/network/mpls/mpls01.sh
> @@ -21,7 +21,11 @@ cleanup()

>  setup()
>  {
> -	ROD modprobe mpls_router
> +	if grep -q 'sl-micro' /etc/os-release; then
> +		ROD modprobe --allow-unsupported mpls_router
> +	else
> +		ROD modprobe mpls_router
> +	fi
>  }

>  test1()
Cyril Hrubis Sept. 3, 2024, 10:16 a.m. UTC | #2
Hi!
> Signed-off-by: Wei Gao <wegao@suse.com>
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> ---
>  testcases/network/mpls/mpls01.sh | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/testcases/network/mpls/mpls01.sh b/testcases/network/mpls/mpls01.sh
> index 196b5b2f9..892b5bd85 100755
> --- a/testcases/network/mpls/mpls01.sh
> +++ b/testcases/network/mpls/mpls01.sh
> @@ -21,7 +21,11 @@ cleanup()
>  
>  setup()
>  {
> -	ROD modprobe mpls_router
> +	if grep -q 'sl-micro' /etc/os-release; then

I do not like how specific is this check. The --allow-unsupported should
be at best no-op for SLE and openSUSE, right? So I would go for the
check of ID=suse rather than specifying just single variant.

> +		ROD modprobe --allow-unsupported mpls_router
> +	else
> +		ROD modprobe mpls_router
> +	fi
>  }
>  
>  test1()
> -- 
> 2.35.3
> 
> 
> -- 
> Mailing list info: https://lists.linux.it/listinfo/ltp
Petr Vorel Sept. 3, 2024, 11:26 a.m. UTC | #3
Hi Cyril,

> Hi!
> > Signed-off-by: Wei Gao <wegao@suse.com>
> > Reviewed-by: Petr Vorel <pvorel@suse.cz>
> > ---
> >  testcases/network/mpls/mpls01.sh | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)

> > diff --git a/testcases/network/mpls/mpls01.sh b/testcases/network/mpls/mpls01.sh
> > index 196b5b2f9..892b5bd85 100755
> > --- a/testcases/network/mpls/mpls01.sh
> > +++ b/testcases/network/mpls/mpls01.sh
> > @@ -21,7 +21,11 @@ cleanup()

> >  setup()
> >  {
> > -	ROD modprobe mpls_router
> > +	if grep -q 'sl-micro' /etc/os-release; then

> I do not like how specific is this check. The --allow-unsupported should
> be at best no-op for SLE and openSUSE, right?

Yes. I would personally avoid it (not needed so far), but sure it can work.

> So I would go for the
> check of ID=suse rather than specifying just single variant.

$ grep ^ID /etc/os-release # SLE Micro
ID="sl-micro"
ID_LIKE="suse"

$ grep ID_ /etc/os-release # Tumbleweed
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"

$ grep ^ID /etc/os-release # SLES 15-SP6
ID="sles"
ID_LIKE="suse"

$ grep ^ID /etc/os-release # SLES 12-SP5 (still supported)
ID="sles"

If we dare to ignore SLE12-SP5 (and older), we could use:
=> grep -q -w ID_LIKE.*suse /etc/os-release
(Using -w to mitigate "suse" as part of longer word.)

There is another problem: mpls_setup() also tries to load modules

modprobe -a mpls_router mpls_iptunnel mpls_gso failed
on both lhost and rhost via:

tst_net_run -s "modprobe -a $TST_NEEDS_DRIVERS"

which is run on all mpls tests. And even mpls01.sh gets fixed,
the other 3 remaining tests fails due missing --allow-unsupported for other mpls
modules.

I guess we can expect both sides are the same distros, thus we could do
evaluation only on lhost. And, we could for simplicity run modprobe also on both
sides in mpls01.sh, thus putting it into function. This code could be in new
function and called in mpls_setup + in mpls01.sh:

	local module
	local args

	grep -q 'sl-micro' /etc/os-release && args='--allow-unsupported'

	if [ "$TST_NEEDS_DRIVERS" ]; then
		tst_net_run -s "modprobe $args -a $TST_NEEDS_DRIVERS"
	fi

Wei, feel free to add it into new version. I can fix your grep in your version
and send a follow up patch. Whatever you prefer.

Kind regards,
Petr

> > +		ROD modprobe --allow-unsupported mpls_router
> > +	else
> > +		ROD modprobe mpls_router
> > +	fi
> >  }

> >  test1()
> > -- 
> > 2.35.3


> > -- 
> > Mailing list info: https://lists.linux.it/listinfo/ltp
diff mbox series

Patch

diff --git a/testcases/network/mpls/mpls01.sh b/testcases/network/mpls/mpls01.sh
index 196b5b2f9..892b5bd85 100755
--- a/testcases/network/mpls/mpls01.sh
+++ b/testcases/network/mpls/mpls01.sh
@@ -21,7 +21,11 @@  cleanup()
 
 setup()
 {
-	ROD modprobe mpls_router
+	if grep -q 'sl-micro' /etc/os-release; then
+		ROD modprobe --allow-unsupported mpls_router
+	else
+		ROD modprobe mpls_router
+	fi
 }
 
 test1()