summaryrefslogtreecommitdiffstats
path: root/func/create_zones.py
diff options
context:
space:
mode:
authorMofassir Arif <mofassir@gmail.com>2015-12-09 04:50:55 -0800
committerMofassir Arif <Mofassir_arif@dellteam.com>2015-12-16 01:45:38 -0800
commite51df601fe4a1bd22274e3da62659b1ed7b2c49b (patch)
tree66abbe6ea11fec7e027fab4481ae1cd9e44f054f /func/create_zones.py
parentae9f53f8f00342627f6d0124e53a285438c1ca4e (diff)
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 <mofassir@gmail.com>
Diffstat (limited to 'func/create_zones.py')
-rw-r--r--func/create_zones.py25
1 files changed, 16 insertions, 9 deletions
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])