+ def _affinitize_vhost_net(self):
+ """
+ Affinitize the vhost net threads for Vanilla OVS and guest nic queues.
+
+ :return: None
+ """
+ self._logger.info('Affinitizing VHOST Net threads.')
+ args1 = ['pgrep', 'vhost-']
+ process1 = subprocess.Popen(args1, stdout=subprocess.PIPE,
+ shell=False)
+ out = process1.communicate()[0]
+ processes = out.decode(locale.getdefaultlocale()[1]).split('\n')
+ if processes[-1] == '':
+ processes.pop() # pgrep may return an extra line with no data
+ self._logger.info('Found %s vhost net threads...', len(processes))
+
+ cpumap = S.getValue('VSWITCH_VHOST_CPU_MAP')
+ mapcount = 0
+ for proc in processes:
+ self._affinitize_pid(cpumap[mapcount], proc)
+ mapcount += 1
+ if mapcount + 1 > len(cpumap):
+ # Not enough cpus were given in the mapping to cover all the
+ # threads on a 1 to 1 ratio with cpus so reset the list counter
+ # to 0.
+ mapcount = 0
+