def get_storage_chassis_config(): storage_info = getattr(testbed, 'storage_node_config', None) storage_chassis_node_list=[] if storage_info: for entry in storage_info.keys(): storage_host = get_control_host_string(entry) added_chassis = 0 for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: if 'chassis' in storage_info[entry].keys(): for chassis_entry in storage_info[entry]['chassis']: if added_chassis != 0: print 'More than one chassis id configured for host %s' %(sthostname) sys.exit(0) added_chassis = 1 data_ip_info = getattr(testbed, 'storage_data', None) if data_ip_info == None: hstname = sthostname else: hstname = '%s-storage' %(sthostname) storage_chassis_node = hstname + ':' + chassis_entry storage_chassis_node_list.append(storage_chassis_node) if storage_chassis_node_list == []: storage_chassis_node_list.append('none') return (storage_chassis_node_list)
def get_storage_nfs_disk_config(): storage_info = getattr(testbed, 'storage_node_config', None) storage_nfs_disk_node_list=[] if storage_info: for entry in storage_info.keys(): storage_host = get_control_host_string(entry) for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: if 'nfs' in storage_info[entry].keys(): for nfs_disk_entry in storage_info[entry]['nfs']: storage_nfs_disk_node = nfs_disk_entry storage_nfs_disk_node_list.append(storage_nfs_disk_node) if storage_nfs_disk_node_list == []: storage_nfs_disk_node_list.append('none') return (storage_nfs_disk_node_list)
def get_storage_mon_hosts(): storage_mon_info = getattr(testbed, 'storage_compute_mon_list', None) storage_mon_list = [] if storage_mon_info: for entry in storage_mon_info: storage_host = get_control_host_string(entry) for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: data_ip_info = getattr(testbed, 'storage_data', None) if data_ip_info == None: hstname = sthostname else: hstname = '%s-storage' %(sthostname) storage_mon_list.append(hstname) if storage_mon_list == []: storage_mon_list.append('none') return (storage_mon_list)
def get_storage_local_disk_config(): storage_info = getattr(testbed, 'storage_node_config', None) storage_local_disk_node_list=[] if storage_info: for entry in storage_info.keys(): storage_host = get_control_host_string(entry) for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: if 'local-disks' in storage_info[entry].keys(): for local_disk_entry in storage_info[entry]['local-disks']: data_ip_info = getattr(testbed, 'storage_data', None) if data_ip_info == None: hstname = sthostname else: hstname = '%s-storage' %(sthostname) storage_local_disk_node = hstname + ':' + local_disk_entry storage_local_disk_node_list.append(storage_local_disk_node) if storage_local_disk_node_list == []: storage_local_disk_node_list.append('none') return (storage_local_disk_node_list)
def get_ceph_nfs_migration_host(): entry = getattr(testbed, 'ceph_nfs_livem_host', None) for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: return sthostname
def create_storage_setup_cmd(mode): global storage_master global storage_master_password storage_host_entries=[] storage_pass_list=[] storage_host_list=[] storage_hostnames=[] orig_hostnames=[] collector_pass_list=[] collector_host_list=[] cfg_host_list=[] storage_os_pass_list=[] storage_os_host_list=[] storage_compute_hostnames=[] openstack_ip = '' storage_network = False index = 0 data_ip_info = getattr(testbed, 'storage_data', None) if data_ip_info != None: storage_network = True for entry in env.roledefs['storage-master']: for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: if storage_network == True: storage_hostnames.append('%s-storage' %(sthostname)) else: storage_hostnames.append(sthostname) orig_hostnames.append(sthostname) storage_host_password=get_env_passwords(entry) storage_pass_list.append(storage_host_password) storage_data_ip=get_storage_data_ip(entry)[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(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: if storage_network == True: storage_compute_hostnames.append('%s-storage' %(sthostname)) else: storage_compute_hostnames.append(sthostname) if entry == sthostentry and \ entry != env.roledefs['storage-master'][0]: if storage_network == True: storage_hostnames.append('%s-storage' %(sthostname)) else: storage_hostnames.append(sthostname) orig_hostnames.append(sthostname) storage_host_password=get_env_passwords(entry) storage_pass_list.append(storage_host_password) storage_data_ip=get_storage_data_ip(entry)[0] storage_host_list.append(storage_data_ip) for entry in env.roledefs['collector']: for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: collector_pass_list.append(get_env_passwords(entry)) 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(get_all_hostnames(), 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_storage_data_ip(storage_master)[0] openstack_ip = get_data_ip(storage_master)[0] cfm = env.roledefs['cfgm'][0] cfm_ip = get_data_ip(cfm)[0] storage_master_password=get_env_passwords(env.roledefs['storage-master'][0]) # Argument details # storage-setup-mode - setup/unconfigure/reconfigure - First time # setup/Remove all configuration/Do a reconfigure # storage-master - Storage master IP # storage-hostnames - hostnames of all the nodes (storage master + # storage compute) # storage-host-tokens - password for all the nodes (storage master + # storage compute) # storage-disk-config - Disk list for Ceph combined pool or HDD pool # storage-chassis-config - Chassis information list in the form # of 'host1:id0 host2:id0 host3:id1' # storage-ssd-disk-config - Disk list for Ceph SSD pool # storage-journal-config - OSD journal disk list # storage-local-disk-config - Disk list for local LVM pool # 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 # live-migration - Enable/Disable live migration # collector-hosts - hosts of all collector nodes # collector-host-tokens - password for all collector nodes # 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 # storage-mon-hosts - storage hosts with monitors # cfg-vip -- cfg internal vip address # storage-compute-hostnames - hostnames of all storage compute nodes # storage-replica-size - Replica size for Ceph storage # openstack-ip - IP address of the first openstack node # orig-hostnames - Original hostnames # service-dbpass - DB password for cinder(and all service) db user # WARNING: If anything is added in the arguments, make sure it # doesn't break add_storage_node task. cmds = ["PASSWORD=%s" % storage_master_password, "setup-vnc-storage", "--storage-setup-mode %s" % mode, "--storage-master %s" % storage_master_ip, "--storage-hostnames %s" % ' '.join(storage_hostnames), "--storage-hosts %s" % ' '.join(storage_host_list), "--storage-host-tokens %s" % ' '.join(storage_pass_list), "--storage-disk-config %s" % ' '.join(get_storage_disk_config()), "--storage-ssd-disk-config %s" % ' '.join(get_storage_ssd_disk_config()), "--storage-journal-config %s" % ' '.join(get_storage_journal_config()), "--storage-local-disk-config %s" % ' '.join(get_storage_local_disk_config()), "--storage-local-ssd-disk-config %s" % ' '.join(get_storage_local_ssd_disk_config()), "--storage-nfs-disk-config %s" % ' '.join(get_storage_nfs_disk_config()), "--storage-directory-config %s" % ' '.join(get_storage_directory_config()), "--storage-chassis-config %s" % ' '.join(get_storage_chassis_config()), "--live-migration %s" % get_live_migration_opts(), "--collector-hosts %s" % ' '.join(collector_host_list), "--collector-host-tokens %s" % ' '.join(collector_pass_list), "--cfg-host %s" % cfm_ip, "--cinder-vip %s" % get_cinder_ha_vip(), "--config-hosts %s" % ' '.join(cfg_host_list), "--storage-os-hosts %s" % ' '.join(storage_os_host_list), "--storage-os-host-tokens %s" % ' '.join(storage_os_pass_list), "--storage-mon-hosts %s" % ' '.join(get_storage_mon_hosts()), "--cfg-vip %s" % get_cfg_ha_vip(), "--storage-compute-hostnames %s" % ' '.join(storage_compute_hostnames), "--storage-replica-size %s" % get_storage_replica_size(), "--openstack-ip %s" % openstack_ip, "--orig-hostnames %s" % ' '.join(orig_hostnames), "--service-dbpass %s" % get_service_dbpass(), "--region-name %s" % get_region_name(), "--ssd-cache-tier %s" % get_storage_cache_tier()] cmd = ' '.join(cmds) return cmd
def setup_nfs_live_migration(mode): """Provisions nfs vm for live migration and live migration related configuration.""" host_string = env.host_string if host_string == env.roledefs['storage-master'][0]: storage_host_entries=[] storage_pass_list=[] storage_host_list=[] storage_hostnames=[] storage_os_pass_list=[] storage_os_host_list=[] index = 0 for entry in env.roledefs['compute']: for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: #Add only for qemu-kvm hypervisor hypervisor = get_hypervisor(entry) if hypervisor != 'libvirt' and hypervisor != 'qemu' and \ hypervisor != 'kvm' and hypervisor != 'qemu-kvm': continue storage_hostnames.append(sthostname) storage_host_password=get_env_passwords(entry) storage_pass_list.append(storage_host_password) storage_host = get_control_host_string(entry) storage_data_ip=get_data_ip(storage_host)[0] storage_host_list.append(storage_data_ip) storage_master=env.roledefs['openstack'][0] storage_master_ip=get_data_ip(storage_master)[0] storage_master_password=get_env_passwords(env.roledefs['openstack'][0]) cfm = env.roledefs['cfgm'][0] cfm_ip = get_data_ip(cfm)[0] # if mode is 'setup_lm', just setup openstack nova live-migration # configuration alone. Ignore all NFS live-migration settings from # testbed.py. if mode == 'setup_lm': mode = 'setup' no_nfs = 1 else: no_nfs = 0 for entry in env.roledefs['openstack']: for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: storage_host_password=get_env_passwords(entry) storage_host = get_control_host_string(entry) storage_data_ip=get_data_ip(storage_host)[0] if index != 0: storage_os_pass_list.append(storage_host_password) storage_os_host_list.append(storage_data_ip) index = index + 1 if storage_os_host_list == []: storage_os_host_list.append('none') if storage_os_pass_list == []: storage_os_pass_list.append('none') if storage_master_ip != cfm_ip: with settings(host_string = storage_master, password = storage_master_password): if no_nfs == 0 and get_ext_nfs_migration_enable() != True: sudo('mkdir -p %s' %(os.path.dirname(get_ceph_nfs_migration_image()))) put(get_ceph_nfs_migration_image(), os.path.dirname(get_ceph_nfs_migration_image()), use_sudo=True) with settings(host_string = storage_master, password = storage_master_password): with cd(INSTALLER_DIR): # Argument details # storage-setup-mode - setup/unconfigure/reconfigure - First time nfs livemigration configurations/Unconfigure/Reconfigure # storage-master - Storage master IP # storage-hostnames - hostnames of all the nodes (storage master + storage compute) # storage-host-tokens - password for all the nodes (storage master + storage compute) # live-migration - Enable/Disable live migration # nfs-live-migration - NFS Livemigration configuration (Image path, subnet, host) # storage-os-hosts - storage openstack hosts (except storage-master) # storage-os-host-tokens - storage openstack hosts passwd list cmd= "PASSWORD=%s setup-vnc-livemigration --storage-setup-mode %s --storage-master %s --storage-master-token %s --storage-hostnames %s --storage-hosts %s --storage-host-tokens %s --storage-disk-config %s --storage-directory-config %s --live-migration %s --nfs-live-migration %s --storage-os-hosts %s --storage-os-host-tokens %s --fix-nova-uid %s" \ %(storage_master_password, mode, storage_master_ip, storage_master_password, ' '.join(storage_hostnames), ' '.join(storage_host_list), ' '.join(storage_pass_list), ' '.join(get_storage_disk_config()), ' '.join(get_storage_directory_config()), get_live_migration_opts(), get_nfs_live_migration_opts(no_nfs), ' '.join(storage_os_host_list), ' '.join(storage_os_pass_list), get_nova_uid_fix_opt()) print cmd sudo(cmd)
def create_storage_setup_cmd(mode): global storage_master global storage_master_password storage_host_entries=[] storage_pass_list=[] storage_host_list=[] storage_hostnames=[] orig_hostnames=[] collector_pass_list=[] collector_host_list=[] cfg_host_list=[] storage_os_pass_list=[] storage_os_host_list=[] storage_compute_hostnames=[] openstack_ip = '' storage_network = False index = 0 data_ip_info = getattr(testbed, 'storage_data', None) if data_ip_info != None: storage_network = True for entry in env.roledefs['storage-master']: for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: if storage_network == True: storage_hostnames.append('%s-storage' %(sthostname)) else: storage_hostnames.append(sthostname) orig_hostnames.append(sthostname) storage_host_password=get_env_passwords(entry) storage_pass_list.append(storage_host_password) storage_data_ip=get_storage_data_ip(entry)[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(get_all_hostnames(), env.roledefs['all']): for exist_name in orig_hostnames: if sthostname == exist_name: break if exist_name == sthostname: continue if entry == sthostentry: if storage_network == True: storage_compute_hostnames.append('%s-storage' %(sthostname)) else: storage_compute_hostnames.append(sthostname) if entry == sthostentry and \ entry != env.roledefs['storage-master'][0]: if storage_network == True: storage_hostnames.append('%s-storage' %(sthostname)) else: storage_hostnames.append(sthostname) orig_hostnames.append(sthostname) storage_host_password=get_env_passwords(entry) storage_pass_list.append(storage_host_password) storage_data_ip=get_storage_data_ip(entry)[0] storage_host_list.append(storage_data_ip) for entry in env.roledefs['collector']: for sthostname, sthostentry in zip(get_all_hostnames(), env.roledefs['all']): if entry == sthostentry: collector_pass_list.append(get_env_passwords(entry)) 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(get_all_hostnames(), 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_storage_data_ip(storage_master)[0] openstack_ip = get_data_ip(storage_master)[0] cfm = env.roledefs['cfgm'][0] cfm_ip = get_data_ip(cfm)[0] storage_master_password=get_env_passwords(env.roledefs['storage-master'][0]) # Argument details # storage-setup-mode - setup/unconfigure/reconfigure - First time # setup/Remove all configuration/Do a reconfigure # storage-master - Storage master IP # storage-hostnames - hostnames of all the nodes (storage master + # storage compute) # storage-host-tokens - password for all the nodes (storage master + # storage compute) # storage-disk-config - Disk list for Ceph combined pool or HDD pool # storage-chassis-config - Chassis information list in the form # of 'host1:id0 host2:id0 host3:id1' # storage-ssd-disk-config - Disk list for Ceph SSD pool # storage-journal-config - OSD journal disk list # storage-local-disk-config - Disk list for local LVM pool # 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 # live-migration - Enable/Disable live migration # collector-hosts - hosts of all collector nodes # collector-host-tokens - password for all collector nodes # 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 # storage-mon-hosts - storage hosts with monitors # cfg-vip -- cfg internal vip address # storage-compute-hostnames - hostnames of all storage compute nodes # storage-replica-size - Replica size for Ceph storage # openstack-ip - IP address of the first openstack node # orig-hostnames - Original hostnames # service-dbpass - DB password for cinder(and all service) db user # region-name - Region name for keystone services # ssd-cache-tier - Enable/Disable SSD cache tier # object-storage - Enable/Disable Ceph Object storage # object-storage-pool - pool to use for object storage. # WARNING: If anything is added in the arguments, make sure it # doesn't break add_storage_node task. cmds = ["PASSWORD=%s" % storage_master_password, "setup-vnc-storage", "--storage-setup-mode %s" % mode, "--storage-master %s" % storage_master_ip, "--storage-hostnames %s" % ' '.join(storage_hostnames), "--storage-hosts %s" % ' '.join(storage_host_list), "--storage-host-tokens %s" % ' '.join(storage_pass_list), "--storage-disk-config %s" % ' '.join(get_storage_disk_config()), "--storage-ssd-disk-config %s" % ' '.join(get_storage_ssd_disk_config()), "--storage-journal-config %s" % ' '.join(get_storage_journal_config()), "--storage-local-disk-config %s" % ' '.join(get_storage_local_disk_config()), "--storage-local-ssd-disk-config %s" % ' '.join(get_storage_local_ssd_disk_config()), "--storage-nfs-disk-config %s" % ' '.join(get_storage_nfs_disk_config()), "--storage-directory-config %s" % ' '.join(get_storage_directory_config()), "--storage-chassis-config %s" % ' '.join(get_storage_chassis_config()), "--live-migration %s" % get_live_migration_opts(), "--collector-hosts %s" % ' '.join(collector_host_list), "--collector-host-tokens %s" % ' '.join(collector_pass_list), "--cfg-host %s" % cfm_ip, "--cinder-vip %s" % get_cinder_ha_vip(), "--config-hosts %s" % ' '.join(cfg_host_list), "--storage-os-hosts %s" % ' '.join(storage_os_host_list), "--storage-os-host-tokens %s" % ' '.join(storage_os_pass_list), "--storage-mon-hosts %s" % ' '.join(get_storage_mon_hosts()), "--cfg-vip %s" % get_cfg_ha_vip(), "--storage-compute-hostnames %s" % ' '.join(storage_compute_hostnames), "--storage-replica-size %s" % get_storage_replica_size(), "--openstack-ip %s" % openstack_ip, "--orig-hostnames %s" % ' '.join(orig_hostnames), "--service-dbpass %s" % get_service_dbpass(), "--region-name %s" % get_region_name(), "--ssd-cache-tier %s" % get_storage_cache_tier(), "--object-storage %s" % get_object_storage(), "--object-storage-pool %s" % get_object_storage_pool()] cmd = ' '.join(cmds) return cmd