From 4071fb7391ec97b3d4b04d2229d5d22a5619130d Mon Sep 17 00:00:00 2001 From: Jeya ganesh babu J Date: Wed, 13 Jan 2016 17:10:09 -0800 Subject: [PATCH] Storage provision fix Closes-Bug: #1533915 Closed-Bug: #1533998 Issue when provisioning storage+compute nodes, nova/cinder services are not configured properly. Fixed issue in unconfigure when removing the glace-api entry, used the correct key. Fixed keystone authentication setting username to cinderv2 incase of openstack version > kilo. Fixed issue in horizon in not displaying volumes in kilo. Change-Id: Iec0bae8c33a3aa4b79ee84fc4d285130c6c434ce --- .../storage/storagefs/setup.py | 47 ++++++++++++++++--- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/contrail_provisioning/storage/storagefs/setup.py b/contrail_provisioning/storage/storagefs/setup.py index 3323fe04..8137a2d8 100755 --- a/contrail_provisioning/storage/storagefs/setup.py +++ b/contrail_provisioning/storage/storagefs/setup.py @@ -938,8 +938,8 @@ def do_storage_unconfigure(self): %(GLANCE_API_CONF, glance_store)) local('sudo openstack-config --del %s %s %s' %(GLANCE_API_CONF, glance_store, glance_known_store)) - local('sudo openstack-config --del %s %s show_image_direct_url' - %(GLANCE_API_CONF, glance_store)) + local('sudo openstack-config --del %s DEFAULT show_image_direct_url' + %(GLANCE_API_CONF)) local('sudo openstack-config --del %s %s rbd_store_user' %(GLANCE_API_CONF, glance_store)) local('sudo openstack-config --set %s DEFAULT workers 1' @@ -960,9 +960,9 @@ def do_storage_unconfigure(self): run('sudo openstack-config --del %s %s %s' %(GLANCE_API_CONF, glance_store, glance_known_store)) - run('sudo openstack-config --del %s %s \ + run('sudo openstack-config --del %s DEFAULT \ show_image_direct_url' - %(GLANCE_API_CONF, glance_store)) + %(GLANCE_API_CONF)) run('sudo openstack-config --del %s %s \ rbd_store_user' %(GLANCE_API_CONF, glance_store)) @@ -2271,6 +2271,9 @@ def do_configure_cinder(self): true' %(CINDER_CONFIG_FILE)) run('sudo openstack-config --set %s DEFAULT auth_strategy \ keystone' %(CINDER_CONFIG_FILE)) + run('sudo openstack-config --set %s keystone_authtoken \ + admin_user cinderv2' + %(CINDER_CONFIG_FILE)) if self._args.cinder_vip != 'none': run('sudo openstack-config --set %s keystone_authtoken \ auth_uri http://%s:5000/v2.0' @@ -2295,6 +2298,9 @@ def do_configure_cinder(self): true' %(CINDER_CONFIG_FILE)) local('sudo openstack-config --set %s DEFAULT auth_strategy \ keystone' %(CINDER_CONFIG_FILE)) + local('sudo openstack-config --set %s keystone_authtoken \ + admin_user cinderv2' + %(CINDER_CONFIG_FILE)) if self._args.cinder_vip != 'none': local('sudo openstack-config --set %s keystone_authtoken \ auth_uri http://%s:5000/v2.0' @@ -3237,6 +3243,34 @@ def do_keystone_config(self): self._args.openstack_ip, self._args.openstack_ip, self._args.openstack_ip), shell='/bin/bash') + v1_config = local('source /etc/contrail/openstackrc && \ + keystone service-list | grep -w volume | wc -l', + capture=True, shell='/bin/bash') + if v1_config == '0': + local('source /etc/contrail/openstackrc && \ + keystone service-create --type volume --name cinder \ + --description volume', shell='/bin/bash') + v1_service = local('source /etc/contrail/openstackrc && \ + keystone service-list | grep -w volume | awk \'{print $2}\'', + capture=True, shell='/bin/bash') + if self._args.cinder_vip != 'none': + local('source /etc/contrail/openstackrc && \ + keystone endpoint-create --service-id %s \ + --publicurl http://%s:8776/v1/%%\(tenant_id\)s \ + --internalurl http://%s:8776/v1/%%\(tenant_id\)s \ + --adminurl http://%s:8776/v1/%%\(tenant_id\)s \ + --region RegionOne' %(v1_service, + self._args.cinder_vip, self._args.cinder_vip, + self._args.cinder_vip), shell='/bin/bash') + else: + local('source /etc/contrail/openstackrc && \ + keystone endpoint-create --service-id %s \ + --publicurl http://%s:8776/v1/%%\(tenant_id\)s \ + --internalurl http://%s:8776/v1/%%\(tenant_id\)s \ + --adminurl http://%s:8776/v1/%%\(tenant_id\)s \ + --region RegionOne' %(v1_service, + self._args.openstack_ip, self._args.openstack_ip, + self._args.openstack_ip), shell='/bin/bash') #end do_keystone_config() def find_cinder_version(self): @@ -3273,9 +3307,10 @@ def do_storage_setup(self): # Check keystone configuration self.do_keystone_config() + # Find Storage only nodes + self.find_storage_only_nodes() + if configure_with_ceph: - # Find Storage only nodes - self.find_storage_only_nodes() # Create the required ceph monitors self.do_monitor_create()