Merge "Updating reference from github to gerrit - Changing Maintainer to dev@mirantis.com"
diff --git a/_states/cinderv3.py b/_states/cinderv3.py
index 3e2e21c..c954c12 100644
--- a/_states/cinderv3.py
+++ b/_states/cinderv3.py
@@ -85,18 +85,18 @@
:param binary: name of the service have to be run
"""
changes = {}
+ ret = []
services = _cinder_call('service_list', host=name, binary=binary, cloud_name=cloud_name)['services']
- enabled_service = [s for s in services if s['status'] == 'enabled']
+ disabled_service = [s for s in services if s['status'] == 'disabled']
- if len(enabled_service) > 0:
- ret = _succeeded('no_changes', name, binary)
- else:
- changes = _cinder_call('service_update', name, binary, 'enable', cloud_name=cloud_name)
- ret = _succeeded('update', name, binary, changes)
-
- return ret
+ if len(disabled_service):
+ for service in disabled_service:
+ changes = _cinder_call('service_update', service['host'], binary, 'enable', cloud_name=cloud_name)
+ ret.append(changes)
+ return _succeeded('update', name, binary, {'changes':ret})
+ return _succeeded('no_changes', name, binary)
def service_disabled(name, binary, cloud_name, disabled_reason=None):
@@ -105,23 +105,22 @@
:param name: name of a host where service is running
:param binary: name of the service have to be disabled
"""
- changes = {}
kwargs = {}
+ ret = []
- if disabled_reason is not None:
+ if disabled_reason:
kwargs['disabled_reason'] = disabled_reason
services = _cinder_call('service_list', host=name, binary=binary, cloud_name=cloud_name)['services']
- disabled_service = [s for s in services if s['status'] == 'disabled']
+ enabled_services = [s for s in services if s['status'] == 'enabled']
- if len(disabled_service) > 0:
- ret = _succeeded('no_changes', name, binary)
- else:
- changes = _cinder_call('service_update', name, binary, 'disable', cloud_name=cloud_name, **kwargs)
- ret = _succeeded('update', name, binary, changes)
-
- return ret
+ if len(enabled_services):
+ for service in enabled_services:
+ changes = _cinder_call('service_update', service['host'], binary, 'disable', cloud_name=cloud_name, **kwargs)
+ ret.append(changes)
+ return _succeeded('update', name, binary, {'changes':ret})
+ return _succeeded('no_changes', name, binary)
def volume_type_present(name, cloud_name, **kwargs):
diff --git a/cinder/files/backup_backend/_ceph.conf b/cinder/files/backup_backend/_ceph.conf
index ff62cb5..ba8c573 100644
--- a/cinder/files/backup_backend/_ceph.conf
+++ b/cinder/files/backup_backend/_ceph.conf
@@ -1,3 +1,4 @@
+
#backup conf
backup_driver=cinder.backup.drivers.{{ controller.backup.engine }}
backup_ceph_conf={{ controller.backup.get('ceph_conf', '/etc/ceph/ceph.conf') }}
diff --git a/cinder/files/queens/cinder.conf.controller.Debian b/cinder/files/queens/cinder.conf.controller.Debian
index 347bc2f..d72efc1 100644
--- a/cinder/files/queens/cinder.conf.controller.Debian
+++ b/cinder/files/queens/cinder.conf.controller.Debian
@@ -80,6 +80,11 @@
# Ceph configuration file to use. (string value)
#backup_ceph_conf = /etc/ceph/ceph.conf
+{%- if controller.backup.engine != None %}
+{%- set backup_backend_fragment = "cinder/files/backup_backend/_" + controller.backup.engine + ".conf" %}
+{%- include backup_backend_fragment %}
+{%- endif %}
+
# The Ceph user to connect with. Default here is to use the same user as for
# Cinder volumes. If not using cephx this should be set to None. (string value)
@@ -1066,10 +1071,6 @@
[backend_defaults]
-{%- if controller.backup.engine != None %}
-{%- set backup_backend_fragment = "cinder/files/backup_backend/_" + controller.backup.engine + ".conf" %}
-{%- include backup_backend_fragment %}
-{%- endif %}
{%- if controller.nas_secure_file_permissions is defined %}
nas_secure_file_permissions={{ controller.nas_secure_file_permissions }}
{%- endif %}
diff --git a/cinder/upgrade/post/init.sls b/cinder/upgrade/post/init.sls
index ecd861e..e9b886a 100644
--- a/cinder/upgrade/post/init.sls
+++ b/cinder/upgrade/post/init.sls
@@ -1,3 +1,5 @@
+{%- from "cinder/map.jinja" import controller,upgrade with context %}
+
cinder_post:
test.show_notification:
- text: "Running cinder.upgrade.post"
@@ -5,3 +7,21 @@
keystone_os_client_config_absent:
file.absent:
- name: /etc/openstack/clouds.yml
+
+# till Queens release the restart of cinder cervices
+# is needed to switch cinder to new version
+# for furher releases running `cinder-manage db sync --bump-versions` is enough
+{%- if upgrade.old_release != upgrade.new_release %}
+ {% if upgrade.new_release in ['ocata', 'pike'] %}
+include:
+ - cinder.upgrade.service_stopped
+ - cinder.upgrade.service_running
+ {%- elif controller.enabled %}
+cinder_syncdb_version:
+ cmd.run:
+ - name: 'cinder-manage db sync --bump-versions; sleep 5'
+ {%- if grains.get('noservices') or controller.get('role', 'primary') == 'secondary' %}
+ - onlyif: /bin/false
+ {%- endif %}
+ {%- endif %}
+{%- endif %}
diff --git a/cinder/upgrade/upgrade/init.sls b/cinder/upgrade/upgrade/init.sls
index 7dc157a..2a84a9a 100644
--- a/cinder/upgrade/upgrade/init.sls
+++ b/cinder/upgrade/upgrade/init.sls
@@ -3,10 +3,8 @@
- text: "Running cinder.upgrade.upgrade"
include:
- - cinder.upgrade.upgrade.pre
- cinder.upgrade.service_stopped
- cinder.upgrade.pkgs_latest
- cinder.upgrade.render_config
- cinder.db.offline_sync
- cinder.upgrade.service_running
- - cinder.upgrade.upgrade.post
diff --git a/cinder/upgrade/upgrade/post.sls b/cinder/upgrade/upgrade/post.sls
index 940a957..7add350 100644
--- a/cinder/upgrade/upgrade/post.sls
+++ b/cinder/upgrade/upgrade/post.sls
@@ -1,3 +1,28 @@
-cinder_upgrade_uprade_post:
+{%- from "cinder/map.jinja" import controller, volume with context %}
+
+cinder_upgrade_upgrade_post:
test.show_notification:
+ - name: "dump_message_upgrade_cinder_post"
- text: "Running cinder.upgrade.upgrade.post"
+
+{% set host_id = salt['network.get_hostname']() %}
+
+{%- if controller.get('enabled') %}
+
+cinder_controller_service_enabled:
+ cinderv3.service_enabled:
+ - binary: cinder-scheduler
+ - cloud_name: admin_identity
+ - name: {{ host_id }}
+
+{%- endif %}
+
+{%- if volume.get('enabled') %}
+
+cinder_volume_service_enabled:
+ cinderv3.service_enabled:
+ - binary: cinder-volume
+ - cloud_name: admin_identity
+ - name: {{ host_id }}
+
+{%- endif %}
diff --git a/cinder/upgrade/upgrade/pre.sls b/cinder/upgrade/upgrade/pre.sls
index 2892843..9ec451c 100644
--- a/cinder/upgrade/upgrade/pre.sls
+++ b/cinder/upgrade/upgrade/pre.sls
@@ -1,3 +1,30 @@
+{%- from "cinder/map.jinja" import controller, volume with context %}
+
cinder_upgrade_upgrade_pre:
test.show_notification:
+ - name: "dump_message_upgrade_cinder_pre"
- text: "Running cinder.upgrade.upgrade.pre"
+
+{% set host_id = salt['network.get_hostname']() %}
+
+{%- if controller.get('enabled') %}
+
+cinder_controller_service_disabled:
+ cinderv3.service_disabled:
+ - binary: cinder-scheduler
+ - cloud_name: admin_identity
+ - name: {{ host_id }}
+ - disabled_reason: "Disabled for upgrade"
+
+{%- endif %}
+
+{%- if volume.get('enabled') %}
+
+cinder_volume_service_disabled:
+ cinderv3.service_disabled:
+ - binary: cinder-volume
+ - cloud_name: admin_identity
+ - name: {{ host_id }}
+ - disabled_reason: "Disabled for upgrade"
+
+{%- endif %}