From 8bef66c17dc30948e5511e76e2d4f93abbb29758 Mon Sep 17 00:00:00 2001 From: Open vSwitch CI Date: May 15 2021 10:34:03 +0000 Subject: Import openvswitch2.15-2.15.0-21 from Fast DataPath --- diff --git a/SOURCES/openvswitch-2.15.0.patch b/SOURCES/openvswitch-2.15.0.patch index b9a918e..264f9bd 100644 --- a/SOURCES/openvswitch-2.15.0.patch +++ b/SOURCES/openvswitch-2.15.0.patch @@ -19367,8 +19367,41 @@ index 72756eb1f2..ba28e36d78 100644 } struct ovsdb_schema *schema2 = fetch_schema(rpc, schema1->name); +diff --git a/ovsdb/ovsdb.c b/ovsdb/ovsdb.c +index 9042658fa8..e019631e9a 100644 +--- a/ovsdb/ovsdb.c ++++ b/ovsdb/ovsdb.c +@@ -31,6 +31,7 @@ + #include "simap.h" + #include "storage.h" + #include "table.h" ++#include "timeval.h" + #include "transaction.h" + #include "trigger.h" + +@@ -525,6 +526,7 @@ ovsdb_snapshot(struct ovsdb *db, bool trim_memory OVS_UNUSED) + return NULL; + } + ++ uint64_t elapsed, start_time = time_msec(); + struct json *schema = ovsdb_schema_to_json(db->schema); + struct json *data = ovsdb_to_txn_json(db, "compacting database online"); + struct ovsdb_error *error = ovsdb_storage_store_snapshot(db->storage, +@@ -537,6 +539,12 @@ ovsdb_snapshot(struct ovsdb *db, bool trim_memory OVS_UNUSED) + malloc_trim(0); + } + #endif ++ ++ elapsed = time_msec() - start_time; ++ if (elapsed > 1000) { ++ VLOG_INFO("%s: Database compaction took %"PRIu64"ms", ++ db->name, elapsed); ++ } + return error; + } + diff --git a/ovsdb/raft.c b/ovsdb/raft.c -index ea91d1fdba..192f7f0a96 100644 +index ea91d1fdba..8fa872494e 100644 --- a/ovsdb/raft.c +++ b/ovsdb/raft.c @@ -940,6 +940,34 @@ raft_reset_ping_timer(struct raft *raft) @@ -19431,7 +19464,32 @@ index ea91d1fdba..192f7f0a96 100644 } } /* Check if any pending command can be completed, and complete it. -@@ -4468,6 +4498,8 @@ raft_unixctl_status(struct unixctl_conn *conn, +@@ -4122,9 +4152,24 @@ raft_may_snapshot(const struct raft *raft) + && !raft->leaving + && !raft->left + && !raft->failed ++ && raft->role != RAFT_LEADER + && raft->last_applied >= raft->log_start); + } + ++/* Prepares for soon snapshotting. */ ++void ++raft_notify_snapshot_recommended(struct raft *raft) ++{ ++ if (raft->role == RAFT_LEADER) { ++ /* Leader is about to write database snapshot to the disk and this ++ * might take significant amount of time. Stepping back from the ++ * leadership to keep the cluster functional during this process. */ ++ VLOG_INFO("Transferring leadership to write a snapshot."); ++ raft_transfer_leadership(raft, "preparing to write snapshot"); ++ raft_become_follower(raft); ++ } ++} ++ + /* Replaces the log for 'raft', up to the last log entry read, by + * 'new_snapshot_data'. Returns NULL if successful, otherwise an error that + * the caller must eventually free. +@@ -4468,6 +4513,8 @@ raft_unixctl_status(struct unixctl_conn *conn, : raft->leaving ? "leaving cluster" : raft->left ? "left cluster" : raft->failed ? "failed" @@ -19440,6 +19498,67 @@ index ea91d1fdba..192f7f0a96 100644 : "cluster member"); if (raft->joining) { ds_put_format(&s, "Remotes for joining:"); +diff --git a/ovsdb/raft.h b/ovsdb/raft.h +index 99d5307e54..59902fe825 100644 +--- a/ovsdb/raft.h ++++ b/ovsdb/raft.h +@@ -174,6 +174,7 @@ void raft_command_wait(const struct raft_command *); + bool raft_grew_lots(const struct raft *); + uint64_t raft_get_log_length(const struct raft *); + bool raft_may_snapshot(const struct raft *); ++void raft_notify_snapshot_recommended(struct raft *); + struct ovsdb_error *raft_store_snapshot(struct raft *, + const struct json *new_snapshot) + OVS_WARN_UNUSED_RESULT; +diff --git a/ovsdb/storage.c b/ovsdb/storage.c +index f662e90566..40415fcf62 100644 +--- a/ovsdb/storage.c ++++ b/ovsdb/storage.c +@@ -519,14 +519,11 @@ ovsdb_storage_should_snapshot(const struct ovsdb_storage *storage) + return false; + } + +- /* If we can't snapshot right now, don't. */ +- if (storage->raft && !raft_may_snapshot(storage->raft)) { +- return false; +- } +- + uint64_t log_len = (storage->raft + ? raft_get_log_length(storage->raft) + : storage->n_read + storage->n_written); ++ bool snapshot_recommended = false; ++ + if (now < storage->next_snapshot_max) { + /* Maximum snapshot time not yet reached. Take a snapshot if there + * have been at least 100 log entries and the log file size has +@@ -534,12 +531,25 @@ ovsdb_storage_should_snapshot(const struct ovsdb_storage *storage) + bool grew_lots = (storage->raft + ? raft_grew_lots(storage->raft) + : ovsdb_log_grew_lots(storage->log)); +- return log_len >= 100 && grew_lots; ++ snapshot_recommended = (log_len >= 100 && grew_lots); + } else { + /* We have reached the maximum snapshot time. Take a snapshot if + * there have been any log entries at all. */ +- return log_len > 0; ++ snapshot_recommended = (log_len > 0); + } ++ ++ if (!snapshot_recommended) { ++ return false; ++ } ++ ++ /* If we can't snapshot right now, don't. */ ++ if (storage->raft && !raft_may_snapshot(storage->raft)) { ++ /* Notifying the storage that it needs to make a snapshot soon. */ ++ raft_notify_snapshot_recommended(storage->raft); ++ return false; ++ } ++ ++ return true; + } + + return false; diff --git a/python/ovs/db/idl.py b/python/ovs/db/idl.py index 5850ac7abf..4226d1cb2f 100644 --- a/python/ovs/db/idl.py @@ -21710,7 +21829,7 @@ index d71c34e691..4156da20ef 100644 usage ;; diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c -index 3601890f40..62059e962f 100644 +index 3601890f40..ede7f1e61a 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -4020,6 +4020,7 @@ ofctl_meter_mod__(const char *bridge, const char *str, int command) @@ -21745,6 +21864,15 @@ index 3601890f40..62059e962f 100644 } protocol = open_vconn_for_flow_mod(bridge, &vconn, usable_protocols); +@@ -5051,7 +5051,7 @@ static const struct ovs_cmdl_command all_commands[] = { + { "add-group", "switch group", + 1, 2, ofctl_add_group, OVS_RW }, + { "add-groups", "switch file", +- 1, 2, ofctl_add_groups, OVS_RW }, ++ 2, 2, ofctl_add_groups, OVS_RW }, + { "mod-group", "switch group", + 1, 2, ofctl_mod_group, OVS_RW }, + { "del-groups", "switch [group]", diff --git a/vswitchd/vswitch.xml b/vswitchd/vswitch.xml index a2ad84edef..4597a215d9 100644 --- a/vswitchd/vswitch.xml diff --git a/SPECS/openvswitch2.15.spec b/SPECS/openvswitch2.15.spec index f31b710..888a450 100644 --- a/SPECS/openvswitch2.15.spec +++ b/SPECS/openvswitch2.15.spec @@ -57,7 +57,7 @@ Summary: Open vSwitch Group: System Environment/Daemons daemon/database/utilities URL: http://www.openvswitch.org/ Version: 2.15.0 -Release: 19%{?dist} +Release: 21%{?dist} # Nearly all of openvswitch is ASL 2.0. The bugtool is LGPLv2+, and the # lib/sflow*.[ch] files are SISSL @@ -697,6 +697,18 @@ exit 0 %endif %changelog +* Sat May 15 2021 Open vSwitch CI - 2.15.0-21 +- Merging upstream branch-2.15 [RH gerrit: c7b9daa243] + Commit list: + a3ee3258e2 ovs-ofctl: Fix coredump when using "add-groups" command. + + +* Fri May 14 2021 Open vSwitch CI - 2.15.0-20 +- Merging upstream branch-2.15 [RH gerrit: 69559c9283] + Commit list: + c5d2a62750 raft: Transfer leadership before creating snapshots. + + * Fri May 14 2021 Open vSwitch CI - 2.15.0-19 - Merging upstream branch-2.15 [RH gerrit: 6aa50cbb89] Commit list: