diff options
author | zhouya <zhou.ya@zte.com.cn> | 2017-03-27 20:06:37 +0800 |
---|---|---|
committer | zhouya <zhou.ya@zte.com.cn> | 2017-03-31 10:53:21 +0800 |
commit | 31bbc308ae195221c7f60a39b50c95ffad76ae23 (patch) | |
tree | 646e77d06a910a4f1107527eeffeef03114b4df1 /deploy | |
parent | d17daf1af5056040e5399af814ebd850a70a4a75 (diff) |
enable ceph backend for deploy cinder
Change-Id: I71255872e6bcf485f8ab72c105db931d96233d03
Signed-off-by: zhouya <zhou.ya@zte.com.cn>
Diffstat (limited to 'deploy')
-rw-r--r-- | deploy/config/bm_environment/zte-baremetal1/deploy.yml | 1 | ||||
-rw-r--r-- | deploy/config/vm_environment/zte-virtual1/deploy.yml | 2 | ||||
-rwxr-xr-x | deploy/get_conf.py | 3 | ||||
-rw-r--r-- | deploy/tempest.py | 27 |
4 files changed, 30 insertions, 3 deletions
diff --git a/deploy/config/bm_environment/zte-baremetal1/deploy.yml b/deploy/config/bm_environment/zte-baremetal1/deploy.yml index eafff5fd..58516e88 100644 --- a/deploy/config/bm_environment/zte-baremetal1/deploy.yml +++ b/deploy/config/bm_environment/zte-baremetal1/deploy.yml @@ -21,3 +21,4 @@ disks: daisy_passwd: 'r00tme'
daisy_ip: '10.20.7.3'
daisy_gateway: '10.20.7.1'
+ceph_disk_name: '/dev/sdb'
diff --git a/deploy/config/vm_environment/zte-virtual1/deploy.yml b/deploy/config/vm_environment/zte-virtual1/deploy.yml index 1bf254f5..12fa1690 100644 --- a/deploy/config/vm_environment/zte-virtual1/deploy.yml +++ b/deploy/config/vm_environment/zte-virtual1/deploy.yml @@ -10,4 +10,4 @@ disks: daisy_passwd: 'r00tme'
daisy_ip: '10.20.11.2'
daisy_gateway: '10.20.11.1'
-deploy_env: 'virtual'
\ No newline at end of file +ceph_disk_name: '/dev/sdb'
diff --git a/deploy/get_conf.py b/deploy/get_conf.py index a2d7bf6a..37da2beb 100755 --- a/deploy/get_conf.py +++ b/deploy/get_conf.py @@ -91,7 +91,8 @@ def dha_config_parse(s, dha_file): def config(dha_file, network_file): data = init(dha_file) + ceph_disk_name = data.get('ceph_disk_name') hosts_name = dha_config_parse(data, dha_file) data = init(network_file) network_map, vip, interface_map = network_config_parse(data, network_file) - return interface_map, hosts_name, network_map, vip + return interface_map, hosts_name, network_map, vip, ceph_disk_name diff --git a/deploy/tempest.py b/deploy/tempest.py index 263e62e0..efa3673c 100644 --- a/deploy/tempest.py +++ b/deploy/tempest.py @@ -66,7 +66,7 @@ def prepare_install(): print("get config...") conf = cfg.ConfigOpts() parse(conf, sys.argv[1:]) - host_interface_map, hosts_name, network_map, vip = \ + host_interface_map, hosts_name, network_map, vip, ceph_disk_name = \ get_conf.config(conf['dha'], conf['network']) if conf['cluster'] and conf['cluster'] == 'yes': print("add cluster...") @@ -88,6 +88,14 @@ def prepare_install(): cluster_id = cluster_info.id add_hosts_interface(cluster_id, hosts_info, hosts_name, host_interface_map, vip) + if len(hosts_name) == 1: + protocol_type = 'LVM' + elif len(hosts_name) > 2: + protocol_type = 'CEPH' + else: + print('hosts_num is %s' % len(hosts_name)) + protocol_type = None + enable_cinder_backend(cluster_id, ceph_disk_name, protocol_type) if 'isbare' in conf and conf['isbare'] == 0: install_os_for_vm_step1(cluster_id) else: @@ -217,5 +225,22 @@ def add_host_role(cluster_id, host_id, host_exp_name, host_real_name, vip): client.roles.update(computer_role_id, **role_computer_update_meta) +def enable_cinder_backend(cluster_id, disk_name, protocol_type): + role_meta = {'filters': {'cluster_id': cluster_id}} + role_list_generator = client.roles.list(**role_meta) + role_list = [role for role in role_list_generator] + lb_role_id = [role.id for role in role_list if + role.name == "CONTROLLER_LB"][0] + service_disk_meta = {'service': 'cinder', + 'disk_location': 'local', + 'partition': disk_name, + 'protocol_type': protocol_type, + 'role_id': lb_role_id} + try: + client.disk_array.service_disk_add(**service_disk_meta) + except Exception as e: + print e + + if __name__ == "__main__": prepare_install() |