In some cases like running multiple QEMUs, would be nice to have an option to distinguish between them. For this reason I introduce an unique instance ID based on time. Later in cmd, the '@INSTANCE_ID@' could be used for QEMU identification.
Signed-off-by: Zuzana Valekova Spitalova <[email protected]> --- scripts/runqemu | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/runqemu b/scripts/runqemu index 2c126e7f54..2de69dcd7c 100755 --- a/scripts/runqemu +++ b/scripts/runqemu @@ -227,6 +227,7 @@ class BaseConfig(object): self.qmp = None self.guest_agent = False self.guest_agent_sockpath = '/tmp/qga.sock' + self.instance_id = None def acquire_taplock(self, error=True): logger.debug("Acquiring lockfile %s..." % self.taplock) @@ -1111,8 +1112,11 @@ to your build configuration. self.nfs_running = True def setup_cmd(self): + self.instance_id = str(int(time.time())) + cmd = self.get('QB_SETUP_CMD') if cmd != '': + cmd = cmd.replace('@INSTANCE_ID@', self.instance_id) logger.info('Running setup command %s' % str(cmd)) if subprocess.call(cmd, shell=True) != 0: raise RunQemuError('Failed to run %s' % str(cmd)) @@ -1623,6 +1627,8 @@ to your build configuration. if self.bios: self.qemu_opt += " -bios %s" % self.bios + self.qemu_opt = self.qemu_opt.replace("@INSTANCE_ID@", self.instance_id) + cmd = "%s %s" % (self.qemu_opt, kernel_opts) cmds = shlex.split(cmd) logger.info('Running %s\n' % cmd) @@ -1647,6 +1653,7 @@ to your build configuration. def cleanup_cmd(self): cmd = self.get('QB_CLEANUP_CMD') if cmd != '': + cmd = cmd.replace('@INSTANCE_ID@', self.instance_id) logger.info('Running cleanup command %s' % str(cmd)) if subprocess.call(cmd, shell=True) != 0: raise RunQemuError('Failed to run %s' % str(cmd)) -- 2.43.0
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#238224): https://lists.openembedded.org/g/openembedded-core/message/238224 Mute This Topic: https://lists.openembedded.org/mt/119693437/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
