From c60fdb9540bc5dfc60cf05d56ad9d8fe45164343 Mon Sep 17 00:00:00 2001
From: Takashi Kajinami <tkajinam@redhat.com>
Date: Thu, 11 Mar 2021 00:10:12 +0900
Subject: [PATCH] Deprecate duplicated implementation for hw-offload option

Currently the hw-offload option is managed by two modules,
puppet-vswitch and puppet-ovn. Because this option is generic and
valid for both ovs and ovn this change deprecate the parameter from
puppet-ovn.

Depends-on: https://review.opendev.org/779802
Change-Id: I4b402c58cc3c39cd2650d91d12d607fe0171e1d0
---
 manifests/controller.pp                       | 29 ++++++++++++-------
 ...te-enable_hw_offload-51f91d8d09f559f6.yaml |  5 ++++
 2 files changed, 24 insertions(+), 10 deletions(-)
 create mode 100644 releasenotes/notes/deprecate-enable_hw_offload-51f91d8d09f559f6.yaml

diff --git a/manifests/controller.pp b/manifests/controller.pp
index f390086..2ef99bf 100644
--- a/manifests/controller.pp
+++ b/manifests/controller.pp
@@ -33,12 +33,6 @@
 #   (optional) Name of the integration bridge.
 #   Defaults to 'br-int'
 #
-# [*enable_hw_offload*]
-#   (optional) Configure OVS to use
-#   Hardware Offload. This feature is
-#   supported from ovs 2.8.0.
-#   Defaults to False.
-#
 # [*mac_table_size*]
 #  Set the mac table size for the provider bridges if defined in ovn_bridge_mappings
 #  Defaults to 50000
@@ -87,6 +81,14 @@
 #  vlan type logical switch.
 #  Defaults to empty list
 #
+# DEPRECATED PARAMETERS
+#
+# [*enable_hw_offload*]
+#   (optional) Configure OVS to use
+#   Hardware Offload. This feature is
+#   supported from ovs 2.8.0.
+#   Defaults to undef.
+#
 class ovn::controller(
   $ovn_remote,
   $ovn_encap_ip,
@@ -95,7 +97,6 @@ class ovn::controller(
   $bridge_interface_mappings   = [],
   $hostname                    = $::fqdn,
   $ovn_bridge                  = 'br-int',
-  $enable_hw_offload           = false,
   $mac_table_size              = 50000,
   $datapath_type               = $::os_service_default,
   $enable_dpdk                 = false,
@@ -104,6 +105,8 @@ class ovn::controller(
   $ovn_transport_zones         = [],
   $enable_ovn_match_northd     = false,
   $ovn_chassis_mac_map         = [],
+  # DEPRECATED PARAMETERS
+  $enable_hw_offload           = undef,
 ) {
 
   include ovn::params
@@ -187,9 +190,15 @@ class ovn::controller(
     $tz_items = {}
   }
 
-  if $enable_hw_offload {
-    $hw_offload = { 'other_config:hw-offload' => { 'value' => bool2str($enable_hw_offload) } }
-  }else {
+  if $enable_hw_offload != undef {
+    warning('The ovn::controller::enable_hw_offload parmaeter is deperecated. \
+Use the same parameter of vswitch::ovs or vswitch::dpdk')
+    if $enable_hw_offload {
+      $hw_offload = { 'other_config:hw-offload' => { 'value' => bool2str($enable_hw_offload) } }
+    } else {
+      $hw_offload = {}
+    }
+  } else {
     $hw_offload = {}
   }
 
diff --git a/releasenotes/notes/deprecate-enable_hw_offload-51f91d8d09f559f6.yaml b/releasenotes/notes/deprecate-enable_hw_offload-51f91d8d09f559f6.yaml
new file mode 100644
index 0000000..195c4b1
--- /dev/null
+++ b/releasenotes/notes/deprecate-enable_hw_offload-51f91d8d09f559f6.yaml
@@ -0,0 +1,5 @@
+---
+deprecations:
+  - |
+    The ``ovn::controller::enable_hw_offload`` parameter has been deprecated.
+    Use the same parameter of ``vswitch::ovs`` or ``vswitch::dpdk`` instead.