From cdbb08859533a4c3e698735ab2ee98d2532aa1c8 Mon Sep 17 00:00:00 2001 From: ahothan Date: Tue, 28 May 2019 16:13:43 -0700 Subject: NFVBENCH-136 Add support for multiqueue for PVP/PVVP chains Change-Id: Ia6bc2b1f97ecdf1d94206f9cda46e62910eb6546 Signed-off-by: ahothan --- nfvbench/cfg.default.yaml | 26 +++++++++++++++++++++----- nfvbench/chaining.py | 7 ++++++- nfvbench/compute.py | 18 ++++++++++++++++++ nfvbench/nfvbench.py | 8 ++++++++ nfvbench/nfvbenchvm/nfvbenchvm.conf | 1 + 5 files changed, 54 insertions(+), 6 deletions(-) (limited to 'nfvbench') diff --git a/nfvbench/cfg.default.yaml b/nfvbench/cfg.default.yaml index eb5fa11..b2b9f49 100755 --- a/nfvbench/cfg.default.yaml +++ b/nfvbench/cfg.default.yaml @@ -51,9 +51,9 @@ vm_image_file: # Otherwise, a new flavor will be created with attributes listed below. flavor_type: 'nfvbench.medium' -# Custom flavor attributes +# Custom flavor attributes for the test VM flavor: - # Number of vCPUs for the flavor + # Number of vCPUs for the flavor, must be at least 2! vcpus: 2 # Memory for the flavor in MB ram: 4096 @@ -68,6 +68,21 @@ flavor: "hw:cpu_policy": dedicated "hw:mem_page_size": large +# Enable multiqueue for all test VM interfaces (PVP and PVVP only). +# When enabled, the test VM image will get added the property to enable +# multiqueue (hw_vif_multiqueue_enabled='true'). +# The number of queues per interace will be set to the number of vCPUs configured for +# the VM. +# By default there is only 1 queue per interface +# The max allowed queue per interface is 8. +# The valid range for this parameter is [1..min(8, vcpu_count)] +# When multiqueue is used the recommended setting is to set it to same value as the +# number of vCPU used - up to a max of 8 queues. +# Setting to a lower value than vCPU should also work. For example if using 4 vCPU and +# vif_multiqueue_size is set to 2, openstack will create 4 queues per interface but the +# test VM will only use the first 2 queues. +vif_multiqueue_size: 1 + # Name of the availability zone to use for the test VMs # Must be one of the zones listed by 'nova availability-zone-list' # availability_zone: 'nova' @@ -398,9 +413,10 @@ idle_interfaces_per_vm: 0 # If service_chain_shared_net is true, the options below will be ignored # and no idle interfaces will be added. idle_networks: - # Prefix for all idle networks + # Prefix for all idle networks, the final name will append the chain ID and idle index + # e.g. "nfvbench-idle-net.0.4" chain 0 idle index 4 name: 'nfvbench-idle-net' - # Prefix for all idle subnetworks + # Subnet name to use for all idle subnetworks subnet: 'nfvbench-idle-subnet' # CIDR to use for all idle networks (value should not matter) cidr: '192.169.1.0/24' @@ -408,7 +424,7 @@ idle_networks: network_type: 'vlan' # segmentation ID to use for the network attached to the idle virtual interfaces # vlan: leave empty to let neutron pick the segmentation ID - # vxlan: must specify the VNI value to be used (cannot be empty) + # vxlan: must specify the starting VNI value to be used (cannot be empty) # Note that NFVbench will use as many consecutive segmentation IDs as needed. # For example, for 4 PVP chains and 8 idle # interfaces per VM, NFVbench will use 32 consecutive values of segmentation ID diff --git a/nfvbench/chaining.py b/nfvbench/chaining.py index 60f3832..898e9ea 100644 --- a/nfvbench/chaining.py +++ b/nfvbench/chaining.py @@ -421,7 +421,8 @@ class ChainVnf(object): 'vnf_gateway1_cidr': g1cidr, 'vnf_gateway2_cidr': g2cidr, 'tg_mac1': remote_mac_pair[0], - 'tg_mac2': remote_mac_pair[1] + 'tg_mac2': remote_mac_pair[1], + 'vif_mq_size': config.vif_multiqueue_size } return content.format(**vm_config) @@ -1088,6 +1089,10 @@ class ChainManager(object): LOG.info('Image %s successfully uploaded.', self.image_name) self.image_instance = self.comp.find_image(self.image_name) + # image multiqueue property must be set according to the vif_multiqueue_size + # config value (defaults to 1 or disabled) + self.comp.image_set_multiqueue(self.image_instance, self.config.vif_multiqueue_size > 1) + def _ensure_instances_active(self): instances = [] for chain in self.chains: diff --git a/nfvbench/compute.py b/nfvbench/compute.py index 556ade4..84e3774 100644 --- a/nfvbench/compute.py +++ b/nfvbench/compute.py @@ -95,6 +95,24 @@ class Compute(object): return True + def image_multiqueue_enabled(self, img): + """Check if multiqueue property is enabled on given image.""" + try: + return img['hw_vif_multiqueue_enabled'] == 'true' + except KeyError: + return False + + def image_set_multiqueue(self, img, enabled): + """Set multiqueue property as enabled or disabled on given image.""" + cur_mqe = self.image_multiqueue_enabled(img) + LOG.info('Image %s hw_vif_multiqueue_enabled property is "%s"', + img.name, str(cur_mqe).lower()) + if cur_mqe != enabled: + mqe = str(enabled).lower() + self.glance_client.images.update(img.id, hw_vif_multiqueue_enabled=mqe) + img['hw_vif_multiqueue_enabled'] = mqe + LOG.info('Image %s hw_vif_multiqueue_enabled property changed to "%s"', img.name, mqe) + # Create a server instance with name vmname # and check that it gets into the ACTIVE state def create_server(self, vmname, image, flavor, key_name, diff --git a/nfvbench/nfvbench.py b/nfvbench/nfvbench.py index e585154..b2163ba 100644 --- a/nfvbench/nfvbench.py +++ b/nfvbench/nfvbench.py @@ -203,6 +203,9 @@ class NFVBench(object): if config.openrc_file: config.openrc_file = os.path.expanduser(config.openrc_file) + if config.flavor.vcpus < 2: + raise Exception("Flavor vcpus must be >= 2") + config.ndr_run = (not config.no_traffic and 'ndr' in config.rate.strip().lower().split('_')) @@ -224,6 +227,11 @@ class NFVBench(object): raise Exception('Please provide existing path for storing results in JSON file. ' 'Path used: {path}'.format(path=config.std_json_path)) + # Check that multiqueue is between 1 and 8 (8 is the max allowed by libvirt/qemu) + if config.vif_multiqueue_size < 1 or config.vif_multiqueue_size > 8: + raise Exception('vif_multiqueue_size (%d) must be in [1..8]' % + config.vif_multiqueue_size) + # VxLAN sanity checks if config.vxlan: if config.vlan_tagging: diff --git a/nfvbench/nfvbenchvm/nfvbenchvm.conf b/nfvbench/nfvbenchvm/nfvbenchvm.conf index 3bc6ace..a8e2551 100644 --- a/nfvbench/nfvbenchvm/nfvbenchvm.conf +++ b/nfvbench/nfvbenchvm/nfvbenchvm.conf @@ -9,3 +9,4 @@ TG_NET1={tg_net1} TG_NET2={tg_net2} TG_GATEWAY1_IP={tg_gateway1_ip} TG_GATEWAY2_IP={tg_gateway2_ip} +VIF_MQ_SIZE={vif_mq_size} -- cgit 1.2.3-korg