diff --git a/fabfile/tasks/storage/misc.py b/fabfile/tasks/storage/misc.py index 768fed4bf..70ec4e391 100644 --- a/fabfile/tasks/storage/misc.py +++ b/fabfile/tasks/storage/misc.py @@ -3,6 +3,7 @@ from fabfile.config import * from fabfile.utils.fabos import * from fabfile.tasks.storage.install import install_storage_compute_node +from fabfile.tasks.storage.install import create_storage_repo_node #from fabfile.tasks.storage.provision import setup_storage_node @task @@ -10,6 +11,7 @@ def add_storage_node(*args): """Adds one/more new storage node to the existing cluster.""" for host_string in args: with settings(host_string=host_string): + execute("create_storage_repo_node", env.host_string) execute("install_storage_compute_node", env.host_string) execute("setup_add_storage_compute_node", env.host_string) diff --git a/fabfile/tasks/storage/provision.py b/fabfile/tasks/storage/provision.py index 09488db5a..2185dad83 100644 --- a/fabfile/tasks/storage/provision.py +++ b/fabfile/tasks/storage/provision.py @@ -54,6 +54,10 @@ def setup_master_storage(mode): storage_hostnames=[] collector_pass_list=[] collector_host_list=[] + cfg_host_list=[] + storage_os_pass_list=[] + storage_os_host_list=[] + index = 0 for entry in env.roledefs['storage-master']: for sthostname, sthostentry in zip(env.hostnames['all'], env.roledefs['all']): if entry == sthostentry: @@ -63,6 +67,10 @@ def setup_master_storage(mode): storage_host = get_control_host_string(entry) storage_data_ip=get_data_ip(storage_host)[0] storage_host_list.append(storage_data_ip) + if index != 0: + storage_os_pass_list.append(storage_host_password) + storage_os_host_list.append(storage_data_ip) + index = index + 1 for entry in env.roledefs['storage-compute']: for sthostname, sthostentry in zip(env.hostnames['all'], env.roledefs['all']): if entry == sthostentry and entry != env.roledefs['storage-master'][0]: @@ -79,6 +87,24 @@ def setup_master_storage(mode): collector_host = get_control_host_string(entry) collector_data_ip=get_data_ip(collector_host)[0] collector_host_list.append(collector_data_ip) + index = 0 + for entry in env.roledefs['cfgm']: + for sthostname, sthostentry in zip(env.hostnames['all'], env.roledefs['all']): + if entry == sthostentry: + if index != 0: + cfg_host = get_control_host_string(entry) + cfg_data_ip=get_data_ip(cfg_host)[0] + cfg_host_list.append(cfg_data_ip) + index = index + 1 + + if cfg_host_list == []: + cfg_host_list.append('none') + + if storage_os_host_list == []: + storage_os_host_list.append('none') + + if storage_os_pass_list == []: + storage_os_pass_list.append('none') storage_master=env.roledefs['storage-master'][0] storage_master_ip=get_data_ip(storage_master)[0] @@ -102,8 +128,13 @@ def setup_master_storage(mode): # live-migration - Enable/Disable live migration # collector-hosts - hosts of all collector nodes # collector-host-tokens - password for all collector nodes - cmd= "PASSWORD=%s python setup-vnc-storage.py --storage-setup-mode %s --storage-master %s --storage-hostnames %s --storage-hosts %s --storage-host-tokens %s --storage-disk-config %s --storage-ssd-disk-config %s --storage-journal-config %s --storage-local-disk-config %s --storage-local-ssd-disk-config %s --storage-nfs-disk-config %s --storage-directory-config %s --live-migration %s --collector-hosts %s --collector-host-tokens %s --cfg-host %s" \ - %(storage_master_password, mode, storage_master_ip, ' '.join(storage_hostnames), ' '.join(storage_host_list), ' '.join(storage_pass_list), ' '.join(get_storage_disk_config()), ' '.join(get_storage_ssd_disk_config()), ' '.join(get_storage_journal_config()), ' '.join(get_storage_local_disk_config()), ' '.join(get_storage_local_ssd_disk_config()), ' '.join(get_storage_nfs_disk_config()), ' '.join(get_storage_directory_config()), get_live_migration_opts(), ' '.join(collector_host_list), ' '.join(collector_pass_list), cfm_ip) + # cfg-host - first config node address (similar to storage-master) + # cinder-vip - cinder internal vip address + # config-hosts - config node address list (except cfg-host) + # storage-os-hosts - storage openstack hosts (except storage-master) + # storage-os-host-tokens - storage openstack hosts passwd list + cmd= "PASSWORD=%s python setup-vnc-storage.py --storage-setup-mode %s --storage-master %s --storage-hostnames %s --storage-hosts %s --storage-host-tokens %s --storage-disk-config %s --storage-ssd-disk-config %s --storage-journal-config %s --storage-local-disk-config %s --storage-local-ssd-disk-config %s --storage-nfs-disk-config %s --storage-directory-config %s --live-migration %s --collector-hosts %s --collector-host-tokens %s --cfg-host %s --cinder-vip %s --config-hosts %s --storage-os-hosts %s --storage-os-host-tokens %s" \ + %(storage_master_password, mode, storage_master_ip, ' '.join(storage_hostnames), ' '.join(storage_host_list), ' '.join(storage_pass_list), ' '.join(get_storage_disk_config()), ' '.join(get_storage_ssd_disk_config()), ' '.join(get_storage_journal_config()), ' '.join(get_storage_local_disk_config()), ' '.join(get_storage_local_ssd_disk_config()), ' '.join(get_storage_nfs_disk_config()), ' '.join(get_storage_directory_config()), get_live_migration_opts(), ' '.join(collector_host_list), ' '.join(collector_pass_list), cfm_ip, get_cinder_ha_vip(), ' '.join(cfg_host_list), ' '.join(storage_os_host_list), ' '.join(storage_os_pass_list)) print cmd run(cmd) #end setup_storage_master @@ -172,6 +203,9 @@ def setup_add_storage_compute_node(*args): storage_pass_list=[] storage_host_list=[] storage_hostnames=[] + storage_os_pass_list=[] + storage_os_host_list=[] + index = 0 for entry in env.roledefs['storage-master']: for sthostname, sthostentry in zip(env.hostnames['all'], env.roledefs['all']): if entry == sthostentry: @@ -181,6 +215,10 @@ def setup_add_storage_compute_node(*args): storage_host = get_control_host_string(entry) storage_data_ip=get_data_ip(storage_host)[0] storage_host_list.append(storage_data_ip) + if index != 0: + storage_os_pass_list.append(storage_host_password) + storage_os_host_list.append(storage_data_ip) + index = index + 1 new_host_entry = args[0] for entry in env.roledefs['storage-compute']: for sthostname, sthostentry in zip(env.hostnames['all'], env.roledefs['all']): @@ -193,6 +231,12 @@ def setup_add_storage_compute_node(*args): storage_host_list.append(storage_data_ip) if new_host_entry == entry: new_storage_hostnames = sthostname + if storage_os_host_list == []: + storage_os_host_list.append('none') + + if storage_os_pass_list == []: + storage_os_pass_list.append('none') + storage_master=env.roledefs['storage-master'][0] storage_master_ip=get_data_ip(storage_master)[0] storage_master_password=env.passwords[env.roledefs['storage-master'][0]] @@ -210,8 +254,11 @@ def setup_add_storage_compute_node(*args): # storage-local-ssd-disk-config - Disk list for local LVM SSD pool # storage-local-nfs-disk-config - NFS storage list # storage-directory-config - Directory list for Ceph - cmd= "PASSWORD=%s python setup-vnc-storage.py --storage-setup-mode addnode --add-storage-node %s --storage-master %s --storage-hostnames %s --storage-hosts %s --storage-host-tokens %s --storage-disk-config %s --storage-ssd-disk-config %s --storage-journal-config %s --storage-local-disk-config %s --storage-local-ssd-disk-config %s --storage-nfs-disk-config %s --storage-directory-config %s --live-migration %s" \ - %(storage_master_password, new_storage_hostnames, storage_master_ip, ' '.join(storage_hostnames), ' '.join(storage_host_list), ' '.join(storage_pass_list), ' '.join(get_storage_disk_config()), ' '.join(get_storage_ssd_disk_config()), ' '.join(get_storage_journal_config()), ' '.join(get_storage_local_disk_config()), ' '.join(get_storage_local_ssd_disk_config()), ' '.join(get_storage_nfs_disk_config()), ' '.join(get_storage_directory_config()), get_live_migration_opts()) + # cinder-vip - cinder internal vip address + # storage-os-hosts - storage openstack hosts (except storage-master) + # storage-os-host-tokens - storage openstack hosts passwd list + cmd= "PASSWORD=%s python setup-vnc-storage.py --storage-setup-mode addnode --add-storage-node %s --storage-master %s --storage-hostnames %s --storage-hosts %s --storage-host-tokens %s --storage-disk-config %s --storage-ssd-disk-config %s --storage-journal-config %s --storage-local-disk-config %s --storage-local-ssd-disk-config %s --storage-nfs-disk-config %s --storage-directory-config %s --live-migration %s --cinder-vip %s --storage-os-hosts %s --storage-os-host-tokens %s" \ + %(storage_master_password, new_storage_hostnames, storage_master_ip, ' '.join(storage_hostnames), ' '.join(storage_host_list), ' '.join(storage_pass_list), ' '.join(get_storage_disk_config()), ' '.join(get_storage_ssd_disk_config()), ' '.join(get_storage_journal_config()), ' '.join(get_storage_local_disk_config()), ' '.join(get_storage_local_ssd_disk_config()), ' '.join(get_storage_nfs_disk_config()), ' '.join(get_storage_directory_config()), get_live_migration_opts(), get_cinder_ha_vip(), ' '.join(storage_os_host_list), ' '.join(storage_os_pass_list)) print cmd run(cmd) diff --git a/fabfile/utils/storage.py b/fabfile/utils/storage.py index 135218720..03eda4b2e 100644 --- a/fabfile/utils/storage.py +++ b/fabfile/utils/storage.py @@ -125,3 +125,16 @@ def get_storage_directory_config(): return (storage_directory_node_list) #end get_storage_directory_config +def get_from_testbed_dict( dictionary, key,default_value): + try: + val = env[dictionary][key] + except KeyError: + val = default_value + return val + +def get_cinder_ha_vip(): + ha_vip = get_from_testbed_dict('ha', 'internal_vip', None) + if ha_vip: + return ha_vip + return 'none' +#end get_cinder_ha_vip