aboutsummaryrefslogtreecommitdiffstats
path: root/yardstick/benchmark/contexts/standalone/sriov.py
diff options
context:
space:
mode:
Diffstat (limited to 'yardstick/benchmark/contexts/standalone/sriov.py')
-rw-r--r--yardstick/benchmark/contexts/standalone/sriov.py29
1 files changed, 22 insertions, 7 deletions
diff --git a/yardstick/benchmark/contexts/standalone/sriov.py b/yardstick/benchmark/contexts/standalone/sriov.py
index 3da12a9a8..e037dd85a 100644
--- a/yardstick/benchmark/contexts/standalone/sriov.py
+++ b/yardstick/benchmark/contexts/standalone/sriov.py
@@ -21,6 +21,7 @@ from yardstick import ssh
from yardstick.benchmark import contexts
from yardstick.benchmark.contexts import base
from yardstick.benchmark.contexts.standalone import model
+from yardstick.common import utils
from yardstick.network_services.utils import get_nsb_option
from yardstick.network_services.utils import PciAddress
@@ -222,16 +223,20 @@ class SriovContext(base.Context):
# 1 : modprobe host_driver with num_vfs
self.configure_nics_for_sriov()
+ hp_total_mb = int(self.vm_flavor.get('ram', '4096')) * len(self.servers)
+ utils.setup_hugepages(self.connection, hp_total_mb * 1024)
+
for index, (key, vnf) in enumerate(collections.OrderedDict(
self.servers).items()):
cfg = '/tmp/vm_sriov_%s.xml' % str(index)
- vm_name = "vm_%s" % str(index)
+ vm_name = "vm-%s" % str(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
network_ports = collections.OrderedDict(
@@ -243,17 +248,27 @@ class SriovContext(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,
+ mac)
+
+ # 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
def _get_vf_data(self, value, vfmac, pfif):