diff options
Diffstat (limited to 'vnfs/qemu/qemu.py')
-rw-r--r-- | vnfs/qemu/qemu.py | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/vnfs/qemu/qemu.py b/vnfs/qemu/qemu.py index 8e3d44de..fb87ed27 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('RESULTS_PATH'), 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('RESULTS_PATH'), rename_gcmd)) cmd_logger.setLevel(logging.DEBUG) cmd_logger.addFilter(self.GuestCommandFilter()) logger.addHandler(cmd_logger) @@ -210,7 +215,7 @@ class IVnfQemu(IVnf): :returns: None """ - thread_id = (r'.* CPU #%d: .* thread_id=(\d+)') + thread_id = (r'.* CPU #%d:.*? thread_id=(\d+)') self._logger.info('Affinitizing guest...') @@ -222,7 +227,13 @@ class IVnfQemu(IVnf): stdin=proc.stdout) proc.wait() - for cpu in range(0, int(S.getValue('GUEST_SMP')[self._number])): + # calculate the number of CPUs in SMP topology specified by GUEST_SMP + # e.g. "sockets=2,cores=3", "4", etc. + cpu_nr = 1 + for i in re.findall(r'\d', S.getValue('GUEST_SMP')[self._number]): + cpu_nr = cpu_nr * int(i) + # pin each GUEST's core to host core based on configured BINDING + for cpu in range(0, cpu_nr): match = None guest_thread_binding = S.getValue('GUEST_THREAD_BINDING')[self._number] if guest_thread_binding is None: @@ -280,7 +291,7 @@ class IVnfQemu(IVnf): elif self._guest_loopback == 'linux_bridge': self._configure_linux_bridge() elif self._guest_loopback != 'clean': - raise RuntimeError('Unsupported guest loopback method "%s" was specified.', + raise RuntimeError('Unsupported guest loopback method "%s" was specified.' % self._guest_loopback) def wait(self, prompt=None, timeout=30): @@ -387,6 +398,8 @@ class IVnfQemu(IVnf): self.execute_and_wait('./testpmd {}'.format(testpmd_params), 60, "Done") self.execute_and_wait('set fwd ' + self._testpmd_fwd_mode, 20, 'testpmd>') + for entry in S.getValue('GUEST_QUEUE_STATS_MAPPING'): + self.execute_and_wait('set stat_qmap ' + entry, 2, 'testpmd>') self.execute_and_wait('start', 20, 'testpmd>') def _configure_l2fwd(self): @@ -492,11 +505,16 @@ class IVnfQemu(IVnf): pci_slots) elif driver == 'igb_uio_from_src': # build and insert igb_uio and rebind interfaces to it - self.execute_and_wait('make RTE_OUTPUT=$RTE_SDK/$RTE_TARGET -C ' - '$RTE_SDK/lib/librte_eal/linuxapp/igb_uio') + # from DPDK 18.05 Linux kernel driver changed location + # also it is not possible to compile driver without + # passing EXTRA_CFLAGS + self.execute_and_wait("make RTE_OUTPUT=$RTE_SDK/{0} \ + EXTRA_CFLAGS=\"-I$RTE_SDK/{1}/include\" \ + -C $RTE_SDK/kernel/linux/igb_uio"\ + .format(S.getValue('RTE_TARGET'), S.getValue('RTE_TARGET'))) self.execute_and_wait('modprobe uio') - self.execute_and_wait('insmod %s/kmod/igb_uio.ko' % - S.getValue('RTE_TARGET')) + self.execute_and_wait('insmod {}/kmod/igb_uio.ko'\ + .format(S.getValue('RTE_TARGET'))) self.execute_and_wait('./*tools/dpdk*bind.py -b igb_uio ' + pci_slots) else: self._logger.error( |