diff options
author | Sridhar K. N. Rao <sridhar.rao@spirent.com> | 2019-01-21 12:29:46 +0530 |
---|---|---|
committer | Sridhar K. N. Rao <sridhar.rao@spirent.com> | 2019-01-21 13:23:54 +0530 |
commit | 537fc036819e25826b82e2a01ff211cb04aa3d6f (patch) | |
tree | 166f8ef6d02eb1cf2edbecb40294fc94f8daf932 /vnfs/qemu/qemu.py | |
parent | 1b7ec748efda9aff3324001c7d62756424f78f2e (diff) |
VSPERF: Add Timestamps to Logfiles
This patch adds timestamps to all the logfiles created by VSPERF.
The logfiles covered are:
1. LOG_FILE_VSWITCHD
2. LOG_FILE_OVS
3. LOG_FILE_VPP
4. LOG_FILE_QEMU
5. LOG_FILE_GUEST_CMDS
6. LOG_FILE_TRAFFIC_GEN
7. LOG_FILE_HOST_CMDS
Added fix for pylint errors
This patch also ensures the extension is only .log always.
JIRA: VSPERF-586
Change-Id: I319c075e7d3af06539266f4c759a41f877d4cff2
Signed-off-by: Sridhar K. N. Rao <sridhar.rao@spirent.com>
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) |