diff mbox series

[9/9] runqemu: configurable tap names

Message ID 20230622170946.10082-10-adrian.freihofer@siemens.com
State Accepted, archived
Commit 6795dddb4074274279b7ff7b9639d15786f06a40
Headers show
Series fixes for runqemu-gen-tapdevs | expand

Commit Message

Adrian Freihofer June 22, 2023, 5:01 p.m. UTC
Support the new environment variable OE_TAP_NAME.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 scripts/runqemu | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Alejandro Enedino Hernandez Samaniego June 24, 2023, 7:56 p.m. UTC | #1
Hello,

I hate to be the bearer of bad news, but I just discovered an issue on my
CI regarding this patch (or this patch series), this happens when trying to
run testimage (with no pre-existing tap devices):

runqemu - INFO - Setting up tap interface under sudo
Traceback (most recent call last):
File "/home/vsts/poky/scripts/runqemu", line 1723, in main
config.setup_network()
File "/home/vsts/poky/scripts/runqemu", line 1242, in setup_network
self.setup_tap()
File "/home/vsts/poky/scripts/runqemu", line 1205, in setup_tap
tapnum = int(tap[len(oe_tap_name):])
ValueError: invalid literal for int() with base 10: 'ning: uid parameter is
ignored. It is no longer needed.\ntap0'
runqemu - INFO - Cleaning up
runqemu - INFO - Host uptime: 768.79

Not quite sure if these are two different issues or one is a consequence of
the other though:

/home/vsts/poky/scripts/runqemu-ifdown: line 59: (Warning: uid parameter is
ignored. It is no longer needed. 0 * 2) + 1 : missing `)' (error token is
": uid parameter is ignored. It is no longer needed. 0 * 2) + 1 ")
/home/vsts/poky/scripts/runqemu-ifdown: line 60: (Warning: uid parameter is
ignored. It is no longer needed. 0 * 2) + 2 : missing `)' (error token is
": uid parameter is ignored. It is no longer needed. 0 * 2) + 2 ")
iptables v1.8.7 (nf_tables): host/network `192.168.7.' not found

Alejandro



On Thu, 22 Jun 2023 at 11:11, Adrian Freihofer <adrian.freihofer@gmail.com>
wrote:

> Support the new environment variable OE_TAP_NAME.
>
> Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
> ---
>  scripts/runqemu | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/runqemu b/scripts/runqemu
> index bd1f8366b63..e1aa5a925c8 100755
> --- a/scripts/runqemu
> +++ b/scripts/runqemu
> @@ -1159,7 +1159,11 @@ to your build configuration.
>          logger.debug('Running %s...' % str(cmd))
>          ip_link = subprocess.check_output(cmd).decode('utf-8')
>          # Matches line like: 6: tap0: <foo>
> -        possibles = re.findall('^[0-9]+: +(tap[0-9]+): <.*', ip_link,
> re.M)
> +        oe_tap_name = 'tap'
> +        if 'OE_TAP_NAME' in os.environ:
> +            oe_tap_name = os.environ['OE_TAP_NAME']
> +        tap_re = '^[0-9]+: +(' + oe_tap_name + '[0-9]+): <.*'
> +        possibles = re.findall(tap_re, ip_link, re.M)
>          tap = ""
>          for p in possibles:
>              lockfile = os.path.join(lockdir, p)
> @@ -1198,7 +1202,7 @@ to your build configuration.
>              logger.error("Failed to setup tap device. Run
> runqemu-gen-tapdevs to manually create.")
>              sys.exit(1)
>          self.tap = tap
> -        tapnum = int(tap[3:])
> +        tapnum = int(tap[len(oe_tap_name):])
>          gateway = tapnum * 2 + 1
>          client = gateway + 1
>          if self.fstype == 'nfs':
> --
> 2.41.0
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#183286):
> https://lists.openembedded.org/g/openembedded-core/message/183286
> Mute This Topic: https://lists.openembedded.org/mt/99702224/3619605
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [
> alejandro@enedino.org]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
diff mbox series

Patch

diff --git a/scripts/runqemu b/scripts/runqemu
index bd1f8366b63..e1aa5a925c8 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1159,7 +1159,11 @@  to your build configuration.
         logger.debug('Running %s...' % str(cmd))
         ip_link = subprocess.check_output(cmd).decode('utf-8')
         # Matches line like: 6: tap0: <foo>
-        possibles = re.findall('^[0-9]+: +(tap[0-9]+): <.*', ip_link, re.M)
+        oe_tap_name = 'tap'
+        if 'OE_TAP_NAME' in os.environ:
+            oe_tap_name = os.environ['OE_TAP_NAME']
+        tap_re = '^[0-9]+: +(' + oe_tap_name + '[0-9]+): <.*'
+        possibles = re.findall(tap_re, ip_link, re.M)
         tap = ""
         for p in possibles:
             lockfile = os.path.join(lockdir, p)
@@ -1198,7 +1202,7 @@  to your build configuration.
             logger.error("Failed to setup tap device. Run runqemu-gen-tapdevs to manually create.")
             sys.exit(1)
         self.tap = tap
-        tapnum = int(tap[3:])
+        tapnum = int(tap[len(oe_tap_name):])
         gateway = tapnum * 2 + 1
         client = gateway + 1
         if self.fstype == 'nfs':