Skip to content

Commit

Permalink
Use ovn-nbctl --wait=hv sync to get end-to-end port binding time
Browse files Browse the repository at this point in the history
Currently the scale testing waits port state UP in ovn-nb and then
starts next round of port creation and binding. This is inaccurate,
because when CPU is 100% in test farms it can't reflect the real
time that ovn-controllers spent to complete each round of processing.

With the new feature "--wait=hv" [1], and the follow-up "sync" cmd
support [2], we can now wait for the port bindings to be processed
and reflected on all HVs before starting next round, so that the real
processing time can be reflected and evaluate more accurately the
related scalability improvements.

[1] openvswitch/ovs@fa183ac
[2] openvswitch/ovs@de32cec
  • Loading branch information
hzhou8 committed Sep 7, 2016
1 parent d01d51f commit 0ece103
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
11 changes: 11 additions & 0 deletions rally_ovs/plugins/ovs/ovsclients_impl.py
Expand Up @@ -175,6 +175,17 @@ def show(self, lswitch=None):

return get_lswitch_info(output)

def sync(self, wait='hv'):
# sync command should always be flushed
opts = ["--wait=%s" % wait]
batch_mode = self.batch_mode
if batch_mode:
self.flush()
self.batch_mode = False

self.run("sync", opts)
self.batch_mode = batch_mode

def create_client(self):
print "********* call OvnNbctl.create_client"

Expand Down
17 changes: 12 additions & 5 deletions rally_ovs/plugins/ovs/scenarios/ovn.py
Expand Up @@ -263,6 +263,13 @@ def _create_networks(self, network_create_args):
def _bind_ports(self, lports, sandboxes, port_bind_args):
port_bind_args = port_bind_args or {}
wait_up = port_bind_args.get("wait_up", False)
# "wait_sync" takes effect only if wait_up is True.
# By default we wait for all HVs catching up with the change.
wait_sync = port_bind_args.get("wait_sync", "hv")
if wait_sync.lower() not in ['hv', 'sb', 'none']:
raise exceptions.InvalidConfigException(_(
"Unknown value for wait_sync: %s. "
"Only 'hv', 'sb' and 'none' are allowed.") % wait_sync)

sandbox_num = len(sandboxes)
lport_num = len(lports)
Expand Down Expand Up @@ -294,21 +301,21 @@ def _bind_ports(self, lports, sandboxes, port_bind_args):
j += 1

if wait_up:
self._wait_up_port(lports, install_method)
self._wait_up_port(lports, wait_sync, install_method)


@atomic.action_timer("ovn_network.wait_port_up")
def _wait_up_port(self, lports, install_method):
LOG.info("wait port up" )
def _wait_up_port(self, lports, wait_sync, install_method):
LOG.info("wait port up. sync: %s" % wait_sync)
ovn_nbctl = self.controller_client("ovn-nbctl")
ovn_nbctl.set_sandbox("controller-sandbox", install_method)
ovn_nbctl.enable_batch_mode(True)

for lport in lports:
ovn_nbctl.wait_until('Logical_Switch_Port', lport["name"], ('up', 'true'))

ovn_nbctl.flush()

if wait_sync != "none":
ovn_nbctl.sync(wait_sync)



Expand Down

0 comments on commit 0ece103

Please sign in to comment.