[ovs-dev] [PATCH v2 3/6] ovs-xapi-sync: Add unixctl support.

Ben Pfaff blp at nicira.com
Fri Mar 9 20:20:17 UTC 2012


On Thu, Mar 08, 2012 at 03:53:23PM -0800, Ethan Jackson wrote:
>      iface_ids = {}              # Map from xs-vif-uuid to iface-id
>      vm_ids = {}                 # Map from xs-vm-uuid to vm-id
>      seqno = idl.change_seqno    # Sequence number when we last processed the db
> -    while True:
> +    while not exiting:
>          idl.run()
> +        unixctl_server.run()
>          if not force_run and seqno == idl.change_seqno:
>              poller = ovs.poller.Poller()
> +
> +            unixctl_server.wait(poller)
>              idl.wait(poller)
> +
> +            if exiting:
> +                poller.immediate_wake()
> +
>              poller.block()
>              continue

I believe that your code is correct, but unixctl_server.run() is what
is going to set "exiting", so I'd be inclined to write it as:

    while True:
        unixctl_server.run()
        if exiting:
            break

        idl.run()
        if not force_run and seqno == idl.change_seqno:
            poller = ovs.poller.Poller()
            unixctl_server.wait(poller)
            idl.wait(poller)
            poller.block()
            continue

Thanks,

Ben.



More information about the dev mailing list