On Mon, Mar 4, 2013 at 12:08 PM, Ernesto Domato <edo...@gmail.com> wrote:
> On Mon, Mar 4, 2013 at 4:49 PM, Ansis Atteka <aatt...@nicira.com> wrote:
>> Though, I do agree that, if Open vSwitch was terminated before libvirt
>> for whatever reason, then libvirt still shouldn't hang because of
>> that. And on the next startup libvirt should try to clean up whatever
>> was left in OVS DB from its previous runs.
>
> Ok, I already send a patch for libvirt to this list and libvirt list
> with a fix that works this way:
>
> at start up, libvirt runs: ovs-vsctl --no-wait --timeout 5 --
> --if-exists del-port vnet0 -- --may-exist add-port ovsbr0 vnet0 -- set
> Interface vnet0 "external-ids:attached-mac=\"52:54:00:FF:D0:9C\"" --
> set Interface vnet0
> "external-ids:iface-id=\"eafbcb1f-3758-e976-015e-7a1f1029b1af\"" --
> set Interface vnet0
> "external-ids:vm-id=\"11245af8-b3ed-0d7c-7fd2-11c692d01da4\"" -- set
> Interface vnet0 external-ids:iface-status=active
>
> The part that I added was the "--no-wait --timeout 5 -- --if-exists
> del-port vnet0" portion.

If you do not block on interface creation and libvirt/Open vSwitch
init.d dependencies are not right, then I think you might end up with
another race condition, where VM automatic start-up would fail.
Imagine that:
1. Neither Open vSwitch or libvirt are running
2. libvirt starts up
3. libvirt tries to spin up VM and executes "ovs-vsctl --no-wait
--timeout=5 -- del-port ... -- add-port ..." command. After 5 seconds
this command times out, because Open vSwitch wasn't running
4. After 6 seconds Open vSwitch starts up, but VM still remains down.

This means that you will have to manually start the VM one more time.

>
> I also added "--no-wait --timeout 5" when libvirt goes down so it can
> timeout if ovs-switch is down.
Just curious, but wasn't this part already solved with libvirt commit
98e732fc34a47ad9dfdb64aa4207623ee4c1ebcd (network: prevent infinite
hang if ovs-vswitchd isn't running)? Are you using libvirt that has
this patch?

By the way I tried to execute the same commands as libvirt would have
executed. Except I ran them directly in the shell. What I observed is
that ovs-vsctl did not block indefinitely for this corner case:

root@ubuntu:~# service openvswitch-switch stop
 * ovs-brcompatd is not running
 * Killing ovs-vswitchd (13202)
 * Killing ovsdb-server (13193)
root@ubuntu:~# ovs-vsctl --timeout=5  -- --if-exists del-port p0
Mar 04 13:39:14|00002|stream_unix|ERR|/tmp/stream-unix.13222.0:
connection to /var/run/openvswitch/db.sock failed: No such file or
directory
Mar 04 13:39:14|00003|reconnect|WARN|unix:/var/run/openvswitch/db.sock:
connection attempt failed (No such file or directory)
Mar 04 13:39:15|00004|stream_unix|ERR|/tmp/stream-unix.13222.1:
connection to /var/run/openvswitch/db.sock failed: No such file or
directory
Mar 04 13:39:15|00005|reconnect|WARN|unix:/var/run/openvswitch/db.sock:
connection attempt failed (No such file or directory)
Mar 04 13:39:17|00006|stream_unix|ERR|/tmp/stream-unix.13222.2:
connection to /var/run/openvswitch/db.sock failed: No such file or
directory
Mar 04 13:39:17|00007|reconnect|WARN|unix:/var/run/openvswitch/db.sock:
connection attempt failed (No such file or directory)
Alarm clock
root@ubuntu:~#

I tried this with Open vSwitch: 1.4.3-0ubuntu2.1. Are you seeing the
same effect with your Open vSwitch?
_______________________________________________
dev mailing list
dev@openvswitch.org
http://openvswitch.org/mailman/listinfo/dev

Reply via email to