Merge pull request #1471 from remibergsma/47_lower_interface_wait

Lower the time we wait for interfaces to appearWaiting for interfaces is tricky. They might never appear.. for example when we have entries in `/etc/cloudstack/ips.json` that haven't been plugged yet. Waiting this long makes everything horribly slow (every vm, interface, static route, etc, etc, will hit this wait, for every device). We've seen CloudStack send an `ip_assoc.json` command for `eth1` public nic only and then the router goes crazy waiting for all other interfaces that were there before reboot and aren't there. If only the router would return to the mgt server a success of `eth1`, it would get the command for `eth2` etc etc. Obviously, a destroy works much faster because no state services, so no knowledge of previous devices so no waits :-)

After a stop/start the router has state in `/etc/cloudstack/ips.json` and every commands waits. Eventually hitting the hardcoded 120 sec timeout.

* pr/1471:
  lower the time we wait for interfaces to appear

Signed-off-by: Will Stevens <williamstevens@gmail.com>
This commit is contained in:
Will Stevens 2016-05-26 15:49:49 -04:00
commit d9429f6add

View File

@ -235,8 +235,7 @@ class CsDevice:
continue
self.devlist.append(vals[0])
def waitfordevice(self, timeout=15):
""" Wait up to 15 seconds for a device to become available """
def waitfordevice(self, timeout=2):
count = 0
while count < timeout:
if self.dev in self.devlist: