name: infra/openvswitch/openvswitch-vswitchd
enabled: {{ enable_neutron | bool and neutron_plugin_agent == 'openvswitch' }}
container:
  image: "{{ openvswitch_vswitchd_image }}:{{ openvswitch_vswitchd_tag }}"
  privileged: true
  parameters:
    - key: volume
      value: "kolla_logs_{{ deployment_id }}_{{ timestamp }}:/var/log/kolla"
  volumes:
    - containerPath: "/run"
      hostPath: "/run"
      mode: RW
    - containerPath: "/lib/modules"
      hostPath: "/lib/modules"
      mode: RO
service:
  daemon:
    dependencies:
     - path: openvswitch-vswitchd/bootstrap
     - path: openvswitch-vswitchd/setup_ovs_bridge
    command: /usr/sbin/ovs-vswitchd unix:/run/openvswitch/db.sock --mlockall
  mem: {{ openvswitch_vswitchd_mem }}
  cpus: {{ openvswitch_vswitchd_cpus }}
  instances: {{ all_nodes }}
  constraints: {{ controller_compute_constraints }}
commands:
  bootstrap:
    command: kolla_extend_start
  check_ovs_db:
    dependencies:
     - path: openvswitch-db/daemon
    retries: 30
    delay: 5
    command: ovs-vsctl --no-wait show
  setup_ovs_bridge:
    dependencies:
     - path: openvswitch-vswitchd/check_ovs_db
    retries: 10
    delay: 5
    command: /usr/local/bin/kolla_ensure_openvswitch_configured {{ neutron_bridge_name }} {{ neutron_external_interface }}
    files:
      ovs_ensure_configured.sh.j2:
        source: "config/neutron/templates/ovs_ensure_configured.sh.j2"
        dest: /usr/local/bin/kolla_ensure_openvswitch_configured
        owner: root
        perm: "0755"
