Allow to update db port during cell update
PROD-36548
Change-Id: I85aae15fac9d8a207734af7b049552f5bce3039a
diff --git a/_states/novang.py b/_states/novang.py
index 88cffcb..2d321ad 100644
--- a/_states/novang.py
+++ b/_states/novang.py
@@ -57,7 +57,7 @@
return ret
-def update_cell(name='cell1', transport_url='none:///', db_engine='mysql', db_name='nova_upgrade', db_user='nova', db_password=None, db_address='0.0.0.0'):
+def update_cell(name='cell1', transport_url='none:///', db_engine='mysql', db_name='nova_upgrade', db_user='nova', db_password=None, db_address='0.0.0.0', db_port='3306'):
'''
Ensures that the nova cell is setup correctly
'''
@@ -72,7 +72,21 @@
db_options = '?charset=utf8'
if cell_uuid:
try:
- __salt__['cmd.shell']('nova-manage cell_v2 update_cell --cell_uuid ' + cell_uuid + ' --transport-url ' + transport_url + ' --database_connection ' + '"' + db_engine + '+pymysql://' + db_user + ':' + db_password + '@' + db_address + '/' + db_name + db_options + '"')
+ __salt__['cmd.shell'](
+ 'nova-manage cell_v2 update_cell '
+ '--cell_uuid {cell_uuid} '
+ '--transport-url {transport_url} '
+ '--database_connection "{db_engine}+pymysql://{db_user}:{db_password}@{db_address}:{db_port}/{db_name}{db_options}"'.format(
+ cell_uuid=cell_uuid,
+ transport_url=transport_url,
+ db_engine=db_engine,
+ db_user=db_user,
+ db_password=db_password,
+ db_address=db_address,
+ db_port=db_port,
+ db_name=db_name,
+ db_options=db_options
+ ))
ret['result'] = True
ret['comment'] = 'Cell {0} updated'.format(name)
ret['changes'][name] = 'Cell {0} successfuly updated'.format(name)
diff --git a/nova/controller.sls b/nova/controller.sls
index 73ff759..e189bd9 100644
--- a/nova/controller.sls
+++ b/nova/controller.sls
@@ -380,6 +380,7 @@
- db_password: {{ controller.database.password }}
- db_user: {{ controller.database.user }}
- db_address: {{ controller.database.host }}
+ - db_port: {{ controller.database.port }}
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}
@@ -403,6 +404,7 @@
- db_password: {{ controller.database.password }}
- db_user: {{ controller.database.user }}
- db_address: {{ controller.database.host }}
+ - db_port: {{ controller.database.port }}
{%- if grains.get('noservices') %}
- onlyif: /bin/false
{%- endif %}