Add 'manage_service_maintenance'. Don't manage services scheduling while upgrading.

For some special cases, don't manage services scheduling both enable and
disable before and after upgrade procedure.

Change-Id: I2499e5240cfc8b1ddcf91948fa052590c6a161d1
Related-Prod: PROD-30156
diff --git a/README.rst b/README.rst
index 0f6117d..b1fa824 100644
--- a/README.rst
+++ b/README.rst
@@ -1424,3 +1424,20 @@
 |                               | operations, verify do not have dead network          |
 |                               | agents/compute services)                             |
 +-------------------------------+------------------------------------------------------+
+
+
+Don't manage services scheduling while upgrade
+----------------------------------------------
+For some special cases, don't manage services scheduling both enable and disable
+before and after upgrade procedure.
+
+If 'manage_service_maintenance: true' or not present - default behavior, disable services
+before upgrade and enable it after upgrade.
+If 'manage_service_maintenance: false' - don't disable and don't enable upgraded services
+scheduling before and after upgrade.
+
+.. code-block:: yaml
+
+    nova:
+      upgrade:
+        manage_service_maintenance: false
diff --git a/nova/upgrade/upgrade/post.sls b/nova/upgrade/upgrade/post.sls
index e532c1d..7d4bceb 100644
--- a/nova/upgrade/upgrade/post.sls
+++ b/nova/upgrade/upgrade/post.sls
@@ -1,4 +1,4 @@
-{%- from "nova/map.jinja" import controller, compute, compute_driver_mapping with context %}
+{%- from "nova/map.jinja" import controller, compute, compute_driver_mapping, upgrade with context %}
 
 nova_upgrade_post:
   test.show_notification:
@@ -7,6 +7,7 @@
 
 {%- if compute.get('enabled') %}
 {% set host_id = salt['network.get_hostname']() %}
+  {%- if upgrade.get('manage_service_maintenance', true) %}
 
 novav21_service_enabled:
   novav21.service_enabled:
@@ -14,4 +15,5 @@
   - cloud_name: admin_identity
   - name: {{ host_id }}
 
+  {% endif %}
 {% endif %}
diff --git a/nova/upgrade/upgrade/pre.sls b/nova/upgrade/upgrade/pre.sls
index e9b48ea..cc2b79a 100644
--- a/nova/upgrade/upgrade/pre.sls
+++ b/nova/upgrade/upgrade/pre.sls
@@ -1,4 +1,4 @@
-{%- from "nova/map.jinja" import controller, compute, compute_driver_mapping with context %}
+{%- from "nova/map.jinja" import controller, compute, compute_driver_mapping, upgrade with context %}
 
 nova_upgrade_pre:
   test.show_notification:
@@ -7,6 +7,7 @@
 
 {%- if compute.get('enabled') %}
 {% set host_id = salt['network.get_hostname']() %}
+  {%- if upgrade.get('manage_service_maintenance', true) %}
 
 novav21_service_disabled:
   novav21.service_disabled:
@@ -15,4 +16,5 @@
   - cloud_name: admin_identity
   - name: {{ host_id }}
 
+  {% endif %}
 {% endif %}