summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhijiang Hu <hu.zhijiang@zte.com.cn>2017-04-05 09:15:30 +0000
committerGerrit Code Review <gerrit@opnfv.org>2017-04-05 09:15:30 +0000
commiteb479eb3ec9ec756ac1f1eb194f9831394f6e27c (patch)
tree800fb0d80468577178bd8e073e84b73833e100db
parent032fe270a600cb8917cd9c81730a18cd0fee6e61 (diff)
parent31bbc308ae195221c7f60a39b50c95ffad76ae23 (diff)
Merge "enable ceph backend for deploy cinder"
-rw-r--r--deploy/config/bm_environment/zte-baremetal1/deploy.yml1
-rw-r--r--deploy/config/vm_environment/zte-virtual1/deploy.yml2
-rwxr-xr-xdeploy/get_conf.py3
-rw-r--r--deploy/tempest.py27
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()