[oe-commits] [openembedded-core] 07/08: runqemu: handle tap device creation failure properly

git at git.openembedded.org git at git.openembedded.org
Thu Dec 12 13:15:56 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 90063059392876443005bdf978f0e8ecf7ef29a6
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Mon Dec 9 23:59:09 2019 +1300

    runqemu: handle tap device creation failure properly
    
    If we fail to run the command to generate the tap devices then we should
    show a reasonable message and then exit, without showing a traceback.
    "return 1" at this point in the code does nothing because the caller
    doesn't check the return, so just use sys.exit().
    
    Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/runqemu | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/scripts/runqemu b/scripts/runqemu
index f061917..ef454d6 100755
--- a/scripts/runqemu
+++ b/scripts/runqemu
@@ -1121,7 +1121,11 @@ class BaseConfig(object):
             uid = os.getuid()
             logger.info("Setting up tap interface under sudo")
             cmd = ('sudo', self.qemuifup, str(uid), str(gid), self.bindir_native)
-            tap = subprocess.check_output(cmd).decode('utf-8').strip()
+            try:
+                tap = subprocess.check_output(cmd).decode('utf-8').strip()
+            except subprocess.CalledProcessError as e:
+                logger.error('Setting up tap device failed:\n%s\nRun runqemu-gen-tapdevs to manually create one.' % str(e))
+                sys.exit(1)
             lockfile = os.path.join(lockdir, tap)
             self.taplock = lockfile + '.lock'
             self.acquire_taplock()
@@ -1130,7 +1134,7 @@ class BaseConfig(object):
 
         if not tap:
             logger.error("Failed to setup tap device. Run runqemu-gen-tapdevs to manually create.")
-            return 1
+            sys.exit(1)
         self.tap = tap
         tapnum = int(tap[3:])
         gateway = tapnum * 2 + 1

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list