diff mbox

[ovs-dev] ovs-save: Restore tunnel TLV map before flows.

Message ID 1472591796-80057-1-git-send-email-jesse@kernel.org
State Accepted
Headers show

Commit Message

Jesse Gross Aug. 30, 2016, 9:16 p.m. UTC
Scripts that integrate OVS with a distribution often save and
restore flows across distruptive events, such as an upgrade. The
ovs-save utility generates a script to assist with this.

When flows include tunnel metadata, we also need to restore the
TLV mappings before the flows are re-added. Otherwise, the instance
of OVS receiving the new flows won't know the meaning of these
fields and will ignore them.

Signed-off-by: Jesse Gross <jesse@kernel.org>
---
 utilities/ovs-save | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Ben Pfaff Aug. 30, 2016, 10:34 p.m. UTC | #1
On Tue, Aug 30, 2016 at 02:16:36PM -0700, Jesse Gross wrote:
> Scripts that integrate OVS with a distribution often save and
> restore flows across distruptive events, such as an upgrade. The
> ovs-save utility generates a script to assist with this.
> 
> When flows include tunnel metadata, we also need to restore the
> TLV mappings before the flows are re-added. Otherwise, the instance
> of OVS receiving the new flows won't know the meaning of these
> fields and will ignore them.
> 
> Signed-off-by: Jesse Gross <jesse@kernel.org>

Good catch.

Acked-by: Ben Pfaff <blp@ovn.org>
Jesse Gross Aug. 31, 2016, 12:55 a.m. UTC | #2
On Tue, Aug 30, 2016 at 3:34 PM, Ben Pfaff <blp@ovn.org> wrote:
> On Tue, Aug 30, 2016 at 02:16:36PM -0700, Jesse Gross wrote:
>> Scripts that integrate OVS with a distribution often save and
>> restore flows across distruptive events, such as an upgrade. The
>> ovs-save utility generates a script to assist with this.
>>
>> When flows include tunnel metadata, we also need to restore the
>> TLV mappings before the flows are re-added. Otherwise, the instance
>> of OVS receiving the new flows won't know the meaning of these
>> fields and will ignore them.
>>
>> Signed-off-by: Jesse Gross <jesse@kernel.org>
>
> Good catch.
>
> Acked-by: Ben Pfaff <blp@ovn.org>

Applied to master, branch-2.6, and branch-2.5 as well.
diff mbox

Patch

diff --git a/utilities/ovs-save b/utilities/ovs-save
index d4d3c35..4ae8fde 100755
--- a/utilities/ovs-save
+++ b/utilities/ovs-save
@@ -106,6 +106,12 @@  save_flows () {
     fi
 
     for bridge in "$@"; do
+        echo -n "ovs-ofctl add-tlv-map ${bridge} '"
+        ovs-ofctl dump-tlv-map br-int | \
+        awk '/^ 0x/ {if (cnt != 0) printf ","; \
+             cnt++;printf "{class="$1",type="$2",len="$3"}->"$4}'
+        echo "'"
+
         echo "ovs-ofctl add-flows ${bridge} - << EOF"
         ovs-ofctl dump-flows "${bridge}" | sed -e '/NXST_FLOW/d' \
             -e 's/\(idle\|hard\)_age=[^,]*,//g'