Skip to content

Commit

Permalink
Added Storage HA support
Browse files Browse the repository at this point in the history
Closes-Bug: #1366216
Feature: Storage HA support added over existing contrail HA nodes.
Change:
1. cinder backend rbd settngs done for openstack storage nodes.
2. cinder template config set to cinder HA vip.
3. global public_network set to newly added storage node address.
4. new cursh map is loaded using crushtool.
5. cinder rabbit host settings done for openstack storage nodes.
6. skipped compute-restart on openstack storage nodes.
Test: verified storage HA by adding 2 openstack storage nodes on
      storage-master role. HA Cinder volume properly attached to
      VMs.
Change done based on Review comments:
1. removed tabs in storage-ceph-storage.py
2. grep -w added to match exact wip address
3. "storage os" comment changed to "storage openstack"
4. "cfg-hostlist" changed to "config-hosts" as per convention
5. added comments for new parameters
6. setup_storage call done for add_storage_node

Change-Id: I32b2f0e3cccf8c5ea6c05be88ef71199befe6e9d
  • Loading branch information
spuru committed Oct 29, 2014
1 parent f4e6ae7 commit 73cefe7
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 4 deletions.
2 changes: 2 additions & 0 deletions fabfile/tasks/storage/misc.py
Expand Up @@ -3,13 +3,15 @@
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
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)

Expand Down
55 changes: 51 additions & 4 deletions fabfile/tasks/storage/provision.py
Expand Up @@ -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:
Expand All @@ -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]:
Expand All @@ -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]
Expand All @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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']):
Expand 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]]
Expand All @@ -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)

Expand Down
13 changes: 13 additions & 0 deletions fabfile/utils/storage.py
Expand Up @@ -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

0 comments on commit 73cefe7

Please sign in to comment.