From 39bcfa45da62a3126ad2a2290aaaa0670e8c5cb0 Mon Sep 17 00:00:00 2001 From: Stepan Andrushko Date: Wed, 27 Jun 2018 21:43:18 +0300 Subject: Provide access to VM in Standalone context Add possibility to access VM with SampleVNF image, which is spawned on baremetal server using password or key pairs (provided or generated). Changes provided for OVS-DPDK and SRIOV cases. JIRA: YARDSTICK-1260 Change-Id: I89cf17dc83f02abe23d206b24b9d0ec1298d3231 Signed-off-by: Stepan Andrushko --- .../benchmark/contexts/standalone/ovs_dpdk.py | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'yardstick/benchmark/contexts/standalone/ovs_dpdk.py') diff --git a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py index 88ad598c3..5891f798e 100644 --- a/yardstick/benchmark/contexts/standalone/ovs_dpdk.py +++ b/yardstick/benchmark/contexts/standalone/ovs_dpdk.py @@ -394,13 +394,14 @@ class OvsDpdkContext(base.Context): for index, (key, vnf) in enumerate(collections.OrderedDict( self.servers).items()): cfg = '/tmp/vm_ovs_%d.xml' % index - vm_name = "vm_%d" % index + vm_name = "vm-%d" % index + cdrom_img = "/var/lib/libvirt/images/cdrom-%d.img" % index # 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) + self.connection, self.vm_flavor, vm_name, index, cdrom_img) # 2: Cleanup already available VMs for vfs in [vfs for vfs_name, vfs in vnf["network_ports"].items() @@ -411,16 +412,24 @@ class OvsDpdkContext(base.Context): model.Libvirt.write_file(cfg, xml_str) self.connection.put(cfg, cfg) + node = self.vnf_node.generate_vnf_instance(self.vm_flavor, + self.networks, + self.host_mgmt.get('ip'), + key, vnf, mac) + # Generate public/private keys if password or private key file is not provided + node = model.StandaloneContextHelper.check_update_key(self.connection, + node, + vm_name, + self.name, + cdrom_img) + + # store vnf node details + nodes.append(node) + # NOTE: launch through libvirt LOG.info("virsh create ...") model.Libvirt.virsh_create_vm(self.connection, cfg) self.vm_names.append(vm_name) - # build vnf node details - nodes.append(self.vnf_node.generate_vnf_instance(self.vm_flavor, - self.networks, - self.host_mgmt.get('ip'), - key, vnf, mac)) - return nodes -- cgit 1.2.3-korg