[queens] Smooth out OVN backend

* add missing ovn control options file
* install networking_ovn package before db_sync
* set sync mode of ovn northbound OVSDB with neutron DB
* enable distributed floating IP support if DVR is turned on

Change-Id: I1ece368e8d763fa7c96b1853646e90d5c1fb11e0
diff --git a/README.rst b/README.rst
index 9cbd45a..dd03ed1 100644
--- a/README.rst
+++ b/README.rst
@@ -829,6 +829,9 @@
             ovn:
               driver: ovn
           tenant_network_types: "geneve,flat"
+          ovn:
+            ovn_l3_scheduler: leastloaded # valid options: chance, leastloaded
+            neutron_sync_mode: repair # valid options: log, off, repair
         ovn_ctl_opts:
           db-nb-create-insecure-remote: 'yes'
           db-sb-create-insecure-remote: 'yes'
diff --git a/neutron/files/ocata/ovn_central_options b/neutron/files/ocata/ovn_central_options
deleted file mode 100644
index e59db5f..0000000
--- a/neutron/files/ocata/ovn_central_options
+++ /dev/null
@@ -1,10 +0,0 @@
-{%- from "neutron/map.jinja" import server with context %}
-# This is a POSIX shell fragment                -*- sh -*-
-
-# OVN_CTL_OPTS: Extra options to pass to ovn-ctl.  This is, for example,
-# a suitable place to specify --ovn-northd-wrapper=valgrind.
-{%- set ovn_ctl_opts = [] %}
-{%- for opt, value in server.get('ovn_ctl_opts', {}).iteritems() %}
-{%- do ovn_ctl_opts.append("--%s=%s"|format(opt, value)) %}
-{%- endfor %}
-OVN_CTL_OPTS='{{ ovn_ctl_opts|join(' ') }}'
diff --git a/neutron/files/pike/ovn_central_options b/neutron/files/ovn_central_options
similarity index 100%
rename from neutron/files/pike/ovn_central_options
rename to neutron/files/ovn_central_options
diff --git a/neutron/files/queens/ml2_conf.ini b/neutron/files/queens/ml2_conf.ini
index 836192b..fe465ba 100644
--- a/neutron/files/queens/ml2_conf.ini
+++ b/neutron/files/queens/ml2_conf.ini
@@ -221,10 +221,13 @@
 #enable_ipset = true
 
 {%- if server.backend.engine == "ovn" %}
+{%- set _ovn = server.backend.ovn|default({}) %}
 [ovn]
 ovn_nb_connection = tcp:{{ server.controller_vip }}:6641
 ovn_sb_connection = tcp:{{ server.controller_vip }}:6642
-ovn_l3_scheduler = leastloaded
+ovn_l3_scheduler = {{ _ovn.ovn_l3_scheduler|default('leastloaded') }}
+neutron_sync_mode = {{ _ovn.neutron_sync_mode|default('repair') }}
+enable_distributed_floating_ip = {{ server.dvr|default('false') }}
 {%- endif %}
 
 {%- if opendaylight_enabled %}
diff --git a/neutron/server.sls b/neutron/server.sls
index 21171bb..4486be3 100644
--- a/neutron/server.sls
+++ b/neutron/server.sls
@@ -229,6 +229,8 @@
 ovn_packages:
   pkg.installed:
   - names: {{ server.pkgs_ovn }}
+  - require_in:
+    - cmd: neutron_db_manage
 
 {%- if not grains.get('noservices', False) %}
 
@@ -259,7 +261,7 @@
 {%- if grains.os_family == 'Debian' %}
 /etc/default/ovn-central:
   file.managed:
-  - source: salt://neutron/files/{{ server.version }}/ovn_central_options
+  - source: salt://neutron/files/ovn_central_options
   - template: jinja
   - require:
     - pkg: ovn_packages
diff --git a/tests/pillar/control_ovn.sls b/tests/pillar/control_ovn.sls
index a173679..9d4794b 100644
--- a/tests/pillar/control_ovn.sls
+++ b/tests/pillar/control_ovn.sls
@@ -12,6 +12,9 @@
         ovn:
           driver: ovn
       tenant_network_types: "geneve,flat"
+      ovn:
+        ovn_l3_scheduler: chance
+        neutron_sync_mode: off
     controller_vip: 172.16.10.101
     dvr: false
     l3_ha: false