summaryrefslogtreecommitdiffstats
path: root/vnfs/qemu/qemu_dpdk_vhost_user.py
diff options
context:
space:
mode:
authorMartin Klozik <martinx.klozik@intel.com>2016-08-16 14:59:05 +0100
committerMartin Klozik <martinx.klozik@intel.com>2016-09-01 14:52:49 +0100
commitc9cd093f2f441adc9dd33627255326008e021a67 (patch)
treedcf81dde95fbc91e65f8670841ffdbfb65a6c4a6 /vnfs/qemu/qemu_dpdk_vhost_user.py
parentb2289e1f6abab2d807eb55d9ec868039dc2384e2 (diff)
multi VM: Multi VMs in serial or parallel
Support for deployment scenarios with any number of VMs in both serial and parallel configuration. Detailed content of the patch: * VswitchControllerPXP class for multi VM support * pvvpxx and pvpvxx deployments for xx VMs in serial respective parallel configuration * special GUEST_ options expansion to requested number of VMs; * support of GUEST_ options specific macros #VMINDEX, #MAC(), #IP() and #EVAL() * all GUEST specific options are turned to lists to be VM specific * support for VM with 1 NIC * support for VM with multiple NIC pairs; traffic is routed in serial or parallel between NIC paris based on deployment scenario * support for PVVP and PVPV scenarios using VMs with different numbers of NICs JIRA: VSPERF-361 Change-Id: I05bedbdfa9a81ea0166d9b03d83ae49d6cb8b19b Signed-off-by: Martin Klozik <martinx.klozik@intel.com> Reviewed-by: Maryam Tahhan <maryam.tahhan@intel.com> Reviewed-by: Al Morton <acmorton@att.com> Reviewed-by: Christian Trautman <ctrautma@redhat.com> Reviewed-by: Bill Michalowski <bmichalo@redhat.com> Reviewed-by: Antonio Fischetti <antonio.fischetti@intel.com>
Diffstat (limited to 'vnfs/qemu/qemu_dpdk_vhost_user.py')
-rw-r--r--vnfs/qemu/qemu_dpdk_vhost_user.py65
1 files changed, 28 insertions, 37 deletions
diff --git a/vnfs/qemu/qemu_dpdk_vhost_user.py b/vnfs/qemu/qemu_dpdk_vhost_user.py
index 49131423..fc46aba1 100644
--- a/vnfs/qemu/qemu_dpdk_vhost_user.py
+++ b/vnfs/qemu/qemu_dpdk_vhost_user.py
@@ -31,45 +31,36 @@ class QemuDpdkVhostUser(IVnfQemu):
super(QemuDpdkVhostUser, self).__init__()
self._logger = logging.getLogger(__name__)
- # calculate indexes of guest devices (e.g. charx, dpdkvhostuserx)
- i = self._number * 2
- if1 = str(i)
- if2 = str(i + 1)
- net1 = 'net' + str(i + 1)
- net2 = 'net' + str(i + 2)
-
# multi-queue values
- if int(S.getValue('GUEST_NIC_QUEUES')):
- queue_str = ',queues={}'.format(S.getValue('GUEST_NIC_QUEUES'))
+ if int(S.getValue('GUEST_NIC_QUEUES')[self._number]):
+ queue_str = ',queues={}'.format(S.getValue('GUEST_NIC_QUEUES')[self._number])
mq_vector_str = ',mq=on,vectors={}'.format(
- int(S.getValue('GUEST_NIC_QUEUES')) * 2 + 2)
+ int(S.getValue('GUEST_NIC_QUEUES')[self._number]) * 2 + 2)
else:
queue_str, mq_vector_str = '', ''
- self._cmd += ['-chardev',
- 'socket,id=char' + if1 +
- ',path=' + S.getValue('OVS_VAR_DIR') +
- 'dpdkvhostuser' + if1,
- '-chardev',
- 'socket,id=char' + if2 +
- ',path=' + S.getValue('OVS_VAR_DIR') +
- 'dpdkvhostuser' + if2,
- '-netdev',
- 'type=vhost-user,id=' + net1 +
- ',chardev=char' + if1 + ',vhostforce' + queue_str,
- '-device',
- 'virtio-net-pci,mac=' +
- S.getValue('GUEST_NET1_MAC')[self._number] +
- ',netdev=' + net1 + ',csum=off,gso=off,' +
- 'guest_tso4=off,guest_tso6=off,guest_ecn=off' +
- mq_vector_str,
- '-netdev',
- 'type=vhost-user,id=' + net2 +
- ',chardev=char' + if2 + ',vhostforce' + queue_str,
- '-device',
- 'virtio-net-pci,mac=' +
- S.getValue('GUEST_NET2_MAC')[self._number] +
- ',netdev=' + net2 + ',csum=off,gso=off,' +
- 'guest_tso4=off,guest_tso6=off,guest_ecn=off' +
- mq_vector_str,
- ]
+ # calculate index of first interface, i.e. check how many
+ # interfaces has been created for previous VMs, where 1st NIC
+ # of 1st VM has index 0
+ start_index = sum(S.getValue('GUEST_NICS_NR')[:self._number])
+
+ # setup requested number of interfaces
+ for nic in range(len(self._nics)):
+ index = start_index + nic
+ ifi = str(index)
+ net = 'net' + str(index + 1)
+
+ self._cmd += ['-chardev',
+ 'socket,id=char' + ifi +
+ ',path=' + S.getValue('OVS_VAR_DIR') +
+ 'dpdkvhostuser' + ifi,
+ '-netdev',
+ 'type=vhost-user,id=' + net +
+ ',chardev=char' + ifi + ',vhostforce' + queue_str,
+ '-device',
+ 'virtio-net-pci,mac=' +
+ self._nics[nic]['mac'] +
+ ',netdev=' + net + ',csum=off,gso=off,' +
+ 'guest_tso4=off,guest_tso6=off,guest_ecn=off' +
+ mq_vector_str,
+ ]