From ebad7a338621b1765f9096506a051a946a321c2f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Mathieu=20Gagne=CC=81?= <mgagne@iweb.com>
Date: Mon, 7 Jul 2014 21:46:51 -0400
Subject: [PATCH] Add ability to configure dhcp_agent_notification

Add a new dhcp_agent_notification parameter to allow its configuration.

Installation without any DHCP agents should have this option disabled
to avoid these kinds of error messages in Neutron logs:

- No more DHCP agents
- Unable to schedule network XXX: no agents available;
  will retry on subsequent port creation events.
- Will not send event port_create_end for network XXX:
  no agent available.

Conflicts:
  manifests/init.pp
  spec/classes/neutron_init_spec.rb

Change-Id: I42a5a045b777e42e5c99cea16a0fbc6ed145d73b
(cherry picked from commit 0346d48d19eb172713b166e13a6df9e8b4bd99ba)
---
 manifests/init.pp                 | 6 ++++++
 spec/classes/neutron_init_spec.rb | 1 +
 2 files changed, 7 insertions(+)

diff --git a/manifests/init.pp b/manifests/init.pp
index 6f63b0f7b..68192c38b 100644
--- a/manifests/init.pp
+++ b/manifests/init.pp
@@ -61,6 +61,10 @@
 #   This enables redundant DHCP agents for configured networks.
 #   Defaults to 1
 #
+# [*dhcp_agent_notification*]
+#   (optional) Allow sending resource operation notification to DHCP agent.
+#   Defaults to true
+#
 # [*allow_bulk*]
 #   (optional) Enable bulk crud operations
 #   Defaults to true
@@ -188,6 +192,7 @@
   $mac_generation_retries      = 16,
   $dhcp_lease_duration         = 86400,
   $dhcp_agents_per_network     = 1,
+  $dhcp_agent_notification     = true,
   $allow_bulk                  = true,
   $allow_pagination            = false,
   $allow_sorting               = false,
@@ -288,6 +293,7 @@
     'DEFAULT/mac_generation_retries':  value => $mac_generation_retries;
     'DEFAULT/dhcp_lease_duration':     value => $dhcp_lease_duration;
     'DEFAULT/dhcp_agents_per_network': value => $dhcp_agents_per_network;
+    'DEFAULT/dhcp_agent_notification': value => $dhcp_agent_notification;
     'DEFAULT/allow_bulk':              value => $allow_bulk;
     'DEFAULT/allow_pagination':        value => $allow_pagination;
     'DEFAULT/allow_sorting':           value => $allow_sorting;
diff --git a/spec/classes/neutron_init_spec.rb b/spec/classes/neutron_init_spec.rb
index afe2e1577..433fb6c5d 100644
--- a/spec/classes/neutron_init_spec.rb
+++ b/spec/classes/neutron_init_spec.rb
@@ -110,6 +110,7 @@
       should contain_neutron_config('DEFAULT/mac_generation_retries').with_value(16)
       should contain_neutron_config('DEFAULT/dhcp_lease_duration').with_value(86400)
       should contain_neutron_config('DEFAULT/dhcp_agents_per_network').with_value(1)
+      should contain_neutron_config('DEFAULT/dhcp_agent_notification').with_value(true)
       should contain_neutron_config('DEFAULT/allow_bulk').with_value(true)
       should contain_neutron_config('DEFAULT/allow_pagination').with_value(false)
       should contain_neutron_config('DEFAULT/allow_sorting').with_value(false)