42 ('keystone_authtoken', 'identity_uri'), |
42 ('keystone_authtoken', 'identity_uri'), |
43 ('keystone_authtoken', 'admin_tenant_name'), |
43 ('keystone_authtoken', 'admin_tenant_name'), |
44 ('keystone_authtoken', 'admin_user'), |
44 ('keystone_authtoken', 'admin_user'), |
45 ('keystone_authtoken', 'admin_password'), |
45 ('keystone_authtoken', 'admin_password'), |
46 ('keystone_authtoken', 'signing_dir'), |
46 ('keystone_authtoken', 'signing_dir'), |
47 ('database', 'connection'), |
|
48 ] |
47 ] |
49 |
48 |
50 |
49 |
51 DHCP_AGENT_MAPPINGS = { |
50 DHCP_AGENT_MAPPINGS = { |
52 # Deprecated group/name |
51 # Deprecated group/name |
89 if curr_ver == pkg_ver: |
88 if curr_ver == pkg_ver: |
90 # No need to upgrade |
89 # No need to upgrade |
91 sys.exit(smf_include.SMF_EXIT_OK) |
90 sys.exit(smf_include.SMF_EXIT_OK) |
92 |
91 |
93 # look for any .new files |
92 # look for any .new files |
|
93 db_connection = None |
94 if glob.glob('/etc/neutron/*.new'): |
94 if glob.glob('/etc/neutron/*.new'): |
|
95 # extract sql_connection from evs_plugin.ini |
|
96 db_connection = 'sqlite:////var/lib/neutron/neutron.sqlite' |
|
97 evs_ini = iniparse.RawConfigParser() |
|
98 evs_ini.read('/etc/neutron/plugins/evs/evs_plugin.ini') |
|
99 if evs_ini.has_section('DATABASE'): |
|
100 if evs_ini.has_option('DATABASE', 'sql_connection'): |
|
101 db_connection = evs_ini.get('DATABASE', 'sql_connection') |
|
102 |
95 # the versions are different, so perform an upgrade |
103 # the versions are different, so perform an upgrade |
96 # modify the configuration files |
104 # modify the configuration files |
97 |
105 |
98 # backup all the old configuration files |
106 # backup all the old configuration files |
99 create_backups('/etc/neutron') |
107 create_backups('/etc/neutron') |
111 config = iniparse.RawConfigParser() |
119 config = iniparse.RawConfigParser() |
112 config.read('/etc/neutron/neutron.conf') |
120 config.read('/etc/neutron/neutron.conf') |
113 # In certain cases the database section does not exist and the |
121 # In certain cases the database section does not exist and the |
114 # default database chosen is sqlite. |
122 # default database chosen is sqlite. |
115 if config.has_section('database'): |
123 if config.has_section('database'): |
116 db_connection = config.get('database', 'connection') |
124 if db_connection: |
|
125 config.set('database', 'connection', db_connection) |
|
126 with open('/etc/neutron/neutron.conf', 'wb+') as fh: |
|
127 config.write(fh) |
|
128 if 'sqlite' in db_connection: |
|
129 print "WARNING: Neutron database is on sqlite" |
|
130 print "which is not a supported backend for" |
|
131 print "Solaris Openstack. Please make sure" |
|
132 print "to migrate to MySQL after upgrade to Juno" |
|
133 # Need this else part because this code path is exercised |
|
134 # during fresh install of Juno, when the |
|
135 # [database].connection is set to default mysql |
|
136 else: |
|
137 db_connection = config.get('database', 'connection') |
|
138 |
117 engine = sqlalchemy.create_engine(db_connection) |
139 engine = sqlalchemy.create_engine(db_connection) |
118 |
140 |
119 # migrate EVS to Neutron db |
141 # migrate EVS to Neutron db |
120 if engine.url.username != '%SERVICE_USER%': |
142 if engine.url.username != '%SERVICE_USER%': |
121 check_call(['/usr/lib/neutron/evs-neutron-migration']) |
143 check_call(['/usr/lib/neutron/evs-neutron-migration']) |