diff options
author | Sridhar Rao <sridhar.rao@spirent.com> | 2019-02-16 04:22:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@opnfv.org> | 2019-02-16 04:22:45 +0000 |
commit | 85cdafd157ce9e5a5fd7e4233608b06058de175a (patch) | |
tree | 606ea4acc1231c5ce32de52c317e6f6387f62dfc /vnfs/qemu/qemu.py | |
parent | 0adf32a7273da5867c3000f4b24c8de6331055be (diff) | |
parent | 537fc036819e25826b82e2a01ff211cb04aa3d6f (diff) |
Merge "VSPERF: Add Timestamps to Logfiles"
Diffstat (limited to 'vnfs/qemu/qemu.py')
-rw-r--r-- | vnfs/qemu/qemu.py | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py index d3e1b343..2ccf3aa0 100644 --- a/vnfs/qemu/qemu.py +++ b/vnfs/qemu/qemu.py @@ -46,12 +46,14 @@ class IVnfQemu(IVnf): Initialisation function. """ super(IVnfQemu, self).__init__() - + name, ext = os.path.splitext(S.getValue('LOG_FILE_QEMU')) + name = name + str(self._number) + rename_qemu = "{name}_{uid}{ex}".format(name=name, + uid=S.getValue('LOG_TIMESTAMP'), + ex=ext) self._expect = S.getValue('GUEST_PROMPT_LOGIN')[self._number] self._logger = logging.getLogger(__name__) - self._logfile = os.path.join( - S.getValue('LOG_DIR'), - S.getValue('LOG_FILE_QEMU')) + str(self._number) + self._logfile = os.path.join(S.getValue('LOG_DIR'), rename_qemu) self._timeout = S.getValue('GUEST_TIMEOUT')[self._number] self._monitor = '%s/vm%dmonitor' % ('/tmp', self._number) # read GUEST NICs configuration and use only defined NR of NICS @@ -115,10 +117,13 @@ class IVnfQemu(IVnf): self.GuestCommandFilter.prefix = self._log_prefix logger = logging.getLogger() + name, ext = os.path.splitext(S.getValue('LOG_FILE_GUEST_CMDS')) + name = name + str(self._number) + rename_gcmd = "{name}_{uid}{ex}".format(name=name, + uid=S.getValue('LOG_TIMESTAMP'), + ex=ext) cmd_logger = logging.FileHandler( - filename=os.path.join(S.getValue('LOG_DIR'), - S.getValue('LOG_FILE_GUEST_CMDS')) + - str(self._number)) + filename=os.path.join(S.getValue('LOG_DIR'), rename_gcmd)) cmd_logger.setLevel(logging.DEBUG) cmd_logger.addFilter(self.GuestCommandFilter()) logger.addHandler(cmd_logger) |