From b35baf61e48a1d2aff88e7c3e100aa996422d849 Mon Sep 17 00:00:00 2001 From: Alex Yang Date: Sat, 29 Jul 2017 20:29:52 +0800 Subject: Correct the mapping of nodes and roles in virtual deploy JIRA: DAISY-56 Now the roles are assigned to nodes randomly, because the function 'add_hosts_interface' in tempest.py just uses zip to map the host's name to the host. libvirt_utils.py: get mac addresses from VM environment.py: save the mac addresses daisy_server.py: write a new deploy.yml which contains the mac addresses and copy the file to daisy server get_conf.py: get mac addresses from the new deploy.yml tempest.py: assigned roles to nodes when the mac addresses matched controller.xml: increase the RAM to make difference with computer nodes deploy.sh: apply this change to bash script Change-Id: Ia61b60d39d319c5d01e3505727fafc63a0585858 Signed-off-by: Alex Yang --- deploy/tempest.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'deploy/tempest.py') diff --git a/deploy/tempest.py b/deploy/tempest.py index ebd040ba..3c1a6c7d 100644 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -68,7 +68,7 @@ def prepare_install(): print("get config...") conf = cfg.ConfigOpts() parse(conf, sys.argv[1:]) - host_interface_map, hosts_name, network_map, vip, ceph_disk_name = \ + host_interface_map, hosts_name, network_map, vip, ceph_disk_name, mac_address_map = \ get_conf.config(conf['dha'], conf['network']) if conf['cluster'] and conf['cluster'] == 'yes': print("add cluster...") @@ -90,7 +90,7 @@ def prepare_install(): hosts_info = get_hosts() cluster_info = get_cluster() cluster_id = cluster_info.id - add_hosts_interface(cluster_id, hosts_info, hosts_name, + add_hosts_interface(cluster_id, hosts_info, hosts_name, mac_address_map, host_interface_map, vip, isbare) if len(hosts_name) == 1: protocol_type = 'LVM' @@ -183,7 +183,8 @@ def get_cluster(): return cluster_info -def add_hosts_interface(cluster_id, hosts_info, hosts_name, host_interface_map, +def add_hosts_interface(cluster_id, hosts_info, hosts_name, mac_address_map, + host_interface_map, vip, isbare): for host_name, host in zip(hosts_name, hosts_info): host = host.to_dict() @@ -196,6 +197,10 @@ def add_hosts_interface(cluster_id, hosts_info, hosts_name, host_interface_map, if interface_name in host_interface_map: interface['assigned_networks'] = \ host_interface_map[interface_name] + if mac_address_map: + for nodename in mac_address_map: + if interface['mac'] in mac_address_map[nodename]: + host_name = nodename pathlist = os.listdir(iso_path) for filename in pathlist: if filename.endswith('iso'): -- cgit 1.2.3-korg