From e51df601fe4a1bd22274e3da62659b1ed7b2c49b Mon Sep 17 00:00:00 2001 From: Mofassir Arif Date: Wed, 9 Dec 2015 04:50:55 -0800 Subject: Networking Testcase: Iperf Implemented The ansible playbooks as well as the config files for the iperf throughput testing have been implemented. Some changes have been made to the driver function for the benchmarks. ansible now gets passed a json file. Change-Id: Ibf4c0210ab9f6cbf9896ca69bf2fb6bda8a9925d Signed-off-by: Mofassir Arif --- func/create_zones.py | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'func/create_zones.py') diff --git a/func/create_zones.py b/func/create_zones.py index 92ce43fe..86cfc23b 100644 --- a/func/create_zones.py +++ b/func/create_zones.py @@ -13,6 +13,7 @@ from keystoneclient.auth.identity import v2 from keystoneclient import session from novaclient import client import os +import re from collections import defaultdict @@ -82,6 +83,11 @@ class create_zones: nova.aggregates.remove_host(id, host) nova.aggregates.delete(id) + def get_compute_num(self, computeName): + + num = re.findall(r'\d+',computeName) + return (int(num[0])-1) + def create_agg(self, D): nova = self._get_nova_client() hyper_list = nova.hypervisors.list() @@ -100,18 +106,19 @@ class create_zones: zone_machine[k].append(' ') for x in range(len(zone_machine)): - if not self.check_aggregate(nova, hostnA[x]): - agg_idA = nova.aggregates.create(hostnA[x], D[x]) - nova.aggregates.add_host(aggregate=agg_idA, host=hostnA[x]) + compute_index = self.get_compute_num(D[x]) + if not self.check_aggregate(nova, hostnA[compute_index]): + agg_idA = nova.aggregates.create(hostnA[compute_index], D[x]) + nova.aggregates.add_host(aggregate=agg_idA, host=hostnA[compute_index]) else: - id1 = self.get_aggregate_id(nova, hostnA[x]) - self.del_agg(nova, id1, hostnA[x]) - agg_idA = nova.aggregates.create(hostnA[x], D[x]) - id1 = self.get_aggregate_id(nova, hostnA[x]) + id1 = self.get_aggregate_id(nova, hostnA[compute_index]) + self.del_agg(nova, id1, hostnA[compute_index]) + agg_idA = nova.aggregates.create(hostnA[compute_index], D[x]) + id1 = self.get_aggregate_id(nova, hostnA[compute_index]) if not self.check_host_added_to_aggregate( - nova, id1, hostnA[x]): + nova, id1, hostnA[compute_index]): - nova.aggregates.add_host(aggregate=id1, host=hostnA[x]) + nova.aggregates.add_host(aggregate=id1, host=hostnA[compute_index]) -- cgit 1.2.3-korg