mirror of
https://git.yoctoproject.org/poky
synced 2026-04-26 00:32:12 +02:00
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(). (From OE-Core rev: 47e40fdd7dd58bde4e017e2375c16450fcb14eca) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
4955fe19ab
commit
c64c5e0eda
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user