Skip to content

Commit

Permalink
Fix nova/libvirt uid for live migration
Browse files Browse the repository at this point in the history
Closes-bug: #1335344
Issue: With different nova/libvirt uid/gid, the livemigration from
    one node to another will not work with permission issues.
Fix: Change the nova/libvirt uid/gid to same across all the compute
    and openstack nodes. This requires 'nova_uid_fix = True' to be
    added to the testbed.py

Change-Id: I1a4263e1e396c711ac0d84fc73161603739535d6
  • Loading branch information
Jeya ganesh babu J committed Apr 14, 2015
1 parent f45d1b3 commit dfdd48f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 5 deletions.
27 changes: 25 additions & 2 deletions fabfile/tasks/storage/provision.py
Expand Up @@ -183,6 +183,9 @@ def setup_nfs_live_migration(mode):
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(env.hostnames['all'], env.roledefs['all']):
if entry == sthostentry:
Expand All @@ -192,11 +195,29 @@ def setup_nfs_live_migration(mode):
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]
for entry in env.roledefs['openstack']:
for sthostname, sthostentry in zip(env.hostnames['all'],
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):
Expand All @@ -212,8 +233,10 @@ def setup_nfs_live_migration(mode):
# 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)
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_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())
# 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(), ' '.join(storage_os_host_list), ' '.join(storage_os_pass_list), get_nova_uid_fix_opt())
print cmd
sudo(cmd)
#end setup_nfs_live_migration_services
Expand Down
10 changes: 7 additions & 3 deletions fabfile/testbeds/testbed_multibox_example.py
Expand Up @@ -197,16 +197,20 @@
# host4 : { 'disks' : ['/dev/sdc', '/dev/sdd'], 'journal' : ['/dev/sde', '/dev/sdf'] },
# host5 : { 'disks' : ['/dev/sdc:/dev/sde', '/dev/sdd:/dev/sde'], 'ssd-disks' : ['/dev/sdf', '/dev/sdg'] },
# host6 : { 'disks' : ['/dev/sdc', '/dev/sdd'], 'local-disks' : ['/dev/sde'], 'local-ssd-disks' : ['/dev/sdf'] },
# host7 : { 'nfs' : ['10.10.10.10:/nfs', '11.11.11.11:/nfs']},
#}

#live migration config
#Base Openstack live migration configuration.
#live_migration = True
#Fix uid/gid for nova/libvirt-qemu so the ids are same across all nodes.
#nova_uid_fix = True

#Enable this for External NFS server
#Following are NFS based live migration configuration
#Enable this for External NFS server based live migration
#ext_nfs_livem = True
#ext_nfs_livem_mount = '11.1.0.1:/nfsvol'

#Enable this for Ceph based NFS VM server
#Enable this for Ceph based NFS VM server based live migration
#ceph_nfs_livem = True
#ceph_nfs_livem_subnet = '192.168.10.253/24'
#ceph_nfs_livem_image = '/ubuntu/livemnfs.qcow2'
Expand Down
9 changes: 9 additions & 0 deletions fabfile/utils/migration.py
Expand Up @@ -27,6 +27,9 @@ def get_ceph_nfs_migration_host():
def get_ext_nfs_migration_mount():
return getattr(testbed, 'ext_nfs_livem_mount', None)

def get_nova_uid_fix_enabled():
return getattr(testbed, 'nova_uid_fix', None)

def get_nfs_live_migration_opts():
nfs_live_migration_opts = "disabled"
if get_ext_nfs_migration_enable():
Expand All @@ -40,3 +43,9 @@ def get_live_migration_opts():
if get_live_migration_enable():
live_migration_opts = "enabled"
return live_migration_opts

def get_nova_uid_fix_opt():
nova_uid_fix_opt = "disabled"
if get_nova_uid_fix_enabled():
nova_uid_fix_opt = "enabled"
return nova_uid_fix_opt

0 comments on commit dfdd48f

Please sign in to comment.