diff options
author | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-01-15 14:25:46 +0000 |
---|---|---|
committer | Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com> | 2018-03-21 09:12:49 +0000 |
commit | 49af409b0c43ec3d3f0479c21cef172e29e1cdfd (patch) | |
tree | c78d6c24a881ad4d672bf8f2b96fa0e2a3ec8426 /yardstick/benchmark/contexts/standalone/ovs_dpdk.py | |
parent | 88e2120ee8905bb66eb56e37d8910c0e63faebf6 (diff) |
Improve NSB Standalone XML generation
Delayed the generation of the XML file until the last step. The
following functions will return a XML string insted:
- Libvirt.build_vm_xml
- SriovContext._enable_interfaces
- OvsDpdkContext._enable_interfaces
The XML file will be written just before copying the file to the
compute hosting the VMs.
JIRA: YARDSTICK-939
Change-Id: Icc80f4741903bbe335db4ebccab395b72fa87e82
Signed-off-by: Rodolfo Alonso Hernandez <rodolfo.alonso.hernandez@intel.com>
Diffstat (limited to 'yardstick/benchmark/contexts/standalone/ovs_dpdk.py')
-rw-r--r-- | yardstick/benchmark/contexts/standalone/ovs_dpdk.py | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py index ee0eb9e0d..30b685eec 100644 --- a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py +++ b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py @@ -359,7 +359,7 @@ class OvsDpdkContext(Context): self.networks = portlist LOG.info("Ports %s", self.networks) - def _enable_interfaces(self, index, vfs, cfg): + def _enable_interfaces(self, index, vfs, xml_str): vpath = self.ovs_properties.get("vpath", "/usr/local") vf = self.networks[vfs[0]] port_num = vf.get('port_num', 0) @@ -368,8 +368,8 @@ class OvsDpdkContext(Context): slot = index + port_num + 10 vf['vpci'] = \ "{}:{}:{:02x}.{}".format(vpci.domain, vpci.bus, slot, vpci.function) - model.Libvirt.add_ovs_interface( - vpath, port_num, vf['vpci'], vf['mac'], str(cfg)) + return model.Libvirt.add_ovs_interface( + vpath, port_num, vf['vpci'], vf['mac'], xml_str) def setup_ovs_dpdk_context(self): nodes = [] @@ -384,17 +384,16 @@ class OvsDpdkContext(Context): # 1. Check and delete VM if already exists model.Libvirt.check_if_vm_exists_and_delete(vm_name, self.connection) + xml_str, mac = model.Libvirt.build_vm_xml( + self.connection, self.vm_flavor, vm_name, index) - _, mac = model.Libvirt.build_vm_xml( - self.connection, self.vm_flavor, cfg, vm_name, index) # 2: Cleanup already available VMs - for vkey, vfs in collections.OrderedDict( - vnf["network_ports"]).items(): - if vkey == "mgmt": - continue - self._enable_interfaces(index, vfs, cfg) + for vfs in [vfs for vfs_name, vfs in vnf["network_ports"].items() + if vfs_name != 'mgmt']: + xml_str = self._enable_interfaces(index, vfs, xml_str) # copy xml to target... + model.Libvirt.write_file(cfg, xml_str) self.connection.put(cfg, cfg) # NOTE: launch through libvirt |