@@ -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))
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 <zuzana.valekova-spitalova@siemens.com> --- scripts/runqemu | 7 +++++++ 1 file changed, 7 insertions(+)