Skip to content

Commit

Permalink
binding: fixed qos when no iface
Browse files Browse the repository at this point in the history
Before this patch, if iface did not exist when qos I+P was run the first time
a qos queue was still created and qos I+P was not applying qos to OVS.
qos was potentially applied later, if/when (for any reason) runtime_data had to be recomputed.

Fixes: 7d1d111 ("controller: configure qos through ovs qos table and do not run tc directly")
Signed-off-by: Xavier Simonart <xsimonar@redhat.com>
Acked-by: Ales Musil <amusil@redhat.com>
Signed-off-by: Dumitru Ceara <dceara@redhat.com>
  • Loading branch information
simonartxavier authored and dceara committed Jul 17, 2023
1 parent 0794a6e commit 34131d2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
26 changes: 12 additions & 14 deletions controller/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ configure_qos(const struct sbrec_port_binding *pb,
struct qos_queue *q = find_qos_queue(b_ctx_out->qos_map, hash,
pb->logical_port);
if (!q || q->min_rate != min_rate || q->max_rate != max_rate ||
q->burst != burst) {
q->burst != burst || (network && strcmp(network, q->network))) {
struct shash bridge_mappings = SHASH_INITIALIZER(&bridge_mappings);
add_ovs_bridge_mappings(b_ctx_in->ovs_table, b_ctx_in->bridge_table,
&bridge_mappings);
Expand All @@ -378,22 +378,20 @@ configure_qos(const struct sbrec_port_binding *pb,
add_ovs_qos_table_entry(b_ctx_in->ovs_idl_txn, port, min_rate,
max_rate, burst, queue_id,
pb->logical_port);
if (!q) {
q = xzalloc(sizeof *q);
hmap_insert(b_ctx_out->qos_map, &q->node, hash);
q->port = xstrdup(pb->logical_port);
q->queue_id = queue_id;
}
free(q->network);
q->network = network ? xstrdup(network) : NULL;
q->min_rate = min_rate;
q->max_rate = max_rate;
q->burst = burst;
}
shash_destroy(&bridge_mappings);
}

if (!q) {
q = xzalloc(sizeof *q);
hmap_insert(b_ctx_out->qos_map, &q->node, hash);
q->port = xstrdup(pb->logical_port);
q->queue_id = queue_id;
}

free(q->network);
q->network = network ? xstrdup(network) : NULL;
q->min_rate = min_rate;
q->max_rate = max_rate;
q->burst = burst;
}

static const struct ovsrec_queue *
Expand Down
8 changes: 8 additions & 0 deletions tests/ovn.at
Original file line number Diff line number Diff line change
Expand Up @@ -36267,6 +36267,7 @@ check ovn-nbctl ls-add ls1
check ovn-nbctl lsp-add ls1 public1
check ovn-nbctl lsp-set-addresses public1 unknown
check ovn-nbctl lsp-set-type public1 localnet
check ovn-nbctl lsp-set-options public1 network_name=phys

check ovn-nbctl lsp-add ls1 lsp5
check ovn-nbctl lsp-set-addresses lsp5 f0:00:00:00:00:05
Expand All @@ -36276,6 +36277,12 @@ ovs-vsctl add-port br-int vif5 -- \
ofport-request=5
OVS_WAIT_UNTIL([test x`ovn-nbctl lsp-get-up lsp5` = xup])

# Delete and add back public1
check ovn-nbctl --wait=hv lsp-del public1
check ovn-nbctl lsp-add ls1 public1
check ovn-nbctl lsp-set-addresses public1 unknown
check ovn-nbctl lsp-set-type public1 localnet

check ovn-nbctl set Logical_Switch_Port public1 options:qos_min_rate=6000000000
check ovn-nbctl set Logical_Switch_Port public1 options:qos_max_rate=7000000000
check ovn-nbctl set Logical_Switch_Port public1 options:qos_burst=8000000000
Expand Down Expand Up @@ -36541,6 +36548,7 @@ check ovn-nbctl lsp-add ls2 public2
check ovn-nbctl lsp-set-addresses public2 unknown
check ovn-nbctl lsp-set-type public2 localnet
check ovn-nbctl --wait=sb set Logical_Switch_Port public2 options:qos_min_rate=6000000000 options:qos_max_rate=7000000000 options:qos_burst=8000000000 options:network_name=phys
check ovn-nbctl --wait=sb lsp-set-options public2 qos_min_rate=6000000000 qos_max_rate=7000000000 qos_burst=8000000000

# Let's now send ovn controller to sleep, so it will receive both ofport notification and ls deletion simultaneously
sleep_controller hv-1
Expand Down

0 comments on commit 34131d2

Please sign in to comment.