Merge "Replace libvirt domain name by nova instance name" into release/2019.2.0
diff --git a/README.rst b/README.rst
index 9af0705..d1702ac 100644
--- a/README.rst
+++ b/README.rst
@@ -189,6 +189,18 @@
       controller:
         update_cells: true
 
+Increase number of chunks for online db migrations:
+
+.. note:: This only should be done in offline as large number of
+   rows locked by this process may cause service outage, which
+   may not be expected.
+
+.. code-block:: yaml
+
+    nova:
+      controller:
+        db_migrations:
+          max_count: 5000000
 
 Configuring TLS communications
 ------------------------------
diff --git a/nova/db/online_sync.sls b/nova/db/online_sync.sls
index 828b35c..ae26a41 100644
--- a/nova/db/online_sync.sls
+++ b/nova/db/online_sync.sls
@@ -4,9 +4,14 @@
 {%- if not grains.get('noservices') and controller.version not in ["juno", "kilo", "liberty"] and controller.get('role', 'primary') == 'primary' %}
 {%- set should_run = '/bin/true' %}
 {%- endif %}
+{%- if controller.get('db_migrations', {}).max_count is defined %}
+{%-   set batches = " --max-count %s" % controller.db_migrations.max_count %}
+{%- else %}
+{%-   set batches = "" %}
+{%- endif %}
 
 nova_controller_online_data_migrations:
   cmd.run:
-  - name: nova-manage db online_data_migrations
+  - name: nova-manage db online_data_migrations{{ batches }}
   - onlyif: {{ should_run }}
   - runas: 'nova'
diff --git a/nova/upgrade/pre/init.sls b/nova/upgrade/pre/init.sls
index 0c5834e..4ca128d 100644
--- a/nova/upgrade/pre/init.sls
+++ b/nova/upgrade/pre/init.sls
@@ -24,6 +24,7 @@
 include:
  - nova.db.online_sync
 
+{%- if controller.version not in ["juno", "kilo", "liberty", "mitaka", "newton"] %}
 nova_status:
   cmd.run:
     - name: nova-status upgrade check
@@ -31,6 +32,7 @@
     - onlyif: /bin/false
   {%- endif %}
 {%- endif %}
+{%- endif %}
 
 {%- set os_content = salt['mine.get']('I@keystone:client:os_client_config:enabled:true', 'keystone_os_client_config', 'compound').values()[0] %}
 keystone_os_client_config: