Add ability to deploy dhcp agent on compute node
Related-Prod: PROD-18109
Change-Id: I1a19106959e0bf96bc64b90a9c4b400551c30c00
diff --git a/README.rst b/README.rst
index 81d7e5e..7cdb12d 100644
--- a/README.rst
+++ b/README.rst
@@ -747,6 +747,17 @@
gateway:
vlan_aware_vms: true
+Neutron with DHCP agent on compute node
+---------------------------------------
+
+.. code-block:: yaml
+
+ neutron:
+ ....
+ compute:
+ dhcp_agent_enabled: true
+ ....
+
Neutron with OVN
----------------
diff --git a/metadata/service/compute/single.yml b/metadata/service/compute/single.yml
index 2c6f177..3c14765 100644
--- a/metadata/service/compute/single.yml
+++ b/metadata/service/compute/single.yml
@@ -7,6 +7,7 @@
openstack_log_appender: false
openstack_fluentd_handler_enabled: false
openstack_ossyslog_handler_enabled: false
+ compute_dhcp_agent_enabled: false
neutron:
compute:
enabled: true
@@ -20,6 +21,7 @@
virtual_host: '/openstack'
local_ip: ${_param:tenant_address}
dvr: false
+ dhcp_agent_enabled: ${_param:compute_dhcp_agent_enabled}
external_access: false
security_groups_enabled: true
qos: false
diff --git a/neutron/compute.sls b/neutron/compute.sls
index d540fa7..22cc29a 100644
--- a/neutron/compute.sls
+++ b/neutron/compute.sls
@@ -48,6 +48,31 @@
{% endif %}
+{% if compute.get('dhcp_agent_enabled', False) %}
+neutron_dhcp_agent_packages:
+ pkg.installed:
+ - names:
+ - neutron-dhcp-agent
+
+neutron_dhcp_agent:
+ service.running:
+ - enable: true
+ - names:
+ - neutron-dhcp-agent
+ - watch:
+ - file: /etc/neutron/dhcp_agent.ini
+ - require:
+ - pkg: neutron_dhcp_agent_packages
+
+/etc/neutron/dhcp_agent.ini:
+ file.managed:
+ - source: salt://neutron/files/{{ compute.version }}/dhcp_agent.ini
+ - template: jinja
+ - require:
+ - pkg: neutron_dhcp_agent_packages
+
+{% endif %}
+
{% if compute.dvr %}
{%- if fwaas.get('enabled', False) %}
@@ -125,6 +150,9 @@
{%- if compute.dvr %}
{%- do neutron_compute_services_list.extend(['neutron-l3-agent', 'neutron-metadata-agent']) %}
{%- endif %}
+{%- if compute.get('dhcp_agent_enabled', False) %}
+ {%- do neutron_compute_services_list.append('neutron-dhcp-agent') %}
+{%- endif %}
{%- for service_name in neutron_compute_services_list %}
{{ service_name }}_default:
diff --git a/tests/pillar/compute_dhcp.sls b/tests/pillar/compute_dhcp.sls
new file mode 100644
index 0000000..6dcf31b
--- /dev/null
+++ b/tests/pillar/compute_dhcp.sls
@@ -0,0 +1,26 @@
+neutron:
+ compute:
+ agent_mode: legacy
+ backend:
+ engine: ml2
+ tenant_network_types: "flat,vxlan"
+ mechanism:
+ ovs:
+ driver: openvswitch
+ dvr: false
+ dhcp_agent_enabled: true
+ enabled: true
+ external_access: false
+ local_ip: 10.1.0.105
+ message_queue:
+ engine: rabbitmq
+ host: 127.0.0.1
+ password: workshop
+ port: 5672
+ user: openstack
+ virtual_host: /openstack
+ metadata:
+ host: 127.0.0.1
+ password: password
+ workers: 2
+ version: ocata