Ticket: CM-13248
Reviewed By: Roopa, Kanna, Nikhil G
Testing Done: See bug
Today before starting dhclient6, we are sleeping 2 seconds we need to make sure
the configured interface is up and has a link-local address.
In some cases 2 seconds is not enough. This patch will install a retry loop
with a 10 sec timeout.
We are querying ip -6 addr show to make sure the interface is properly confi-
-gured but in the future the plan is to move this call to netlink.
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
#
try:
+ import re
from ipaddr import IPNetwork
from sets import Set
from ifupdown.iface import *
#add delay before starting IPv6 dhclient to
#make sure the configured interface/link is up.
time.sleep(2)
- self.dhclientcmd.start6(ifaceobj.name, wait=wait,
- cmd_prefix=dhclient_cmd_prefix)
+ timeout = 10
+ while timeout:
+ timeout -= 2
+ addr_output = utils.exec_command('ip -6 addr show %s'
+ % ifaceobj.name)
+ r = re.search('inet6 .* scope link', addr_output)
+ if r:
+ self.dhclientcmd.start6(ifaceobj.name,
+ wait=wait,
+ cmd_prefix=dhclient_cmd_prefix)
+ return
+ time.sleep(2)
+
+
except Exception, e:
self.log_error(str(e), ifaceobj)