[kvm]: reconnect during kvm installation process (#3837)
* [kvm]: reconnect during kvm installation process retry connect every 1 second for 10 maximum times Signed-off-by: Guohan Lu <gulv@microsoft.com>
This commit is contained in:
parent
343ad78931
commit
654bb0eae7
@ -24,7 +24,17 @@ def main():
|
|||||||
cmd_prompt = "%s@sonic:~\$ $" % args.u
|
cmd_prompt = "%s@sonic:~\$ $" % args.u
|
||||||
grub_selection = "The highlighted entry will be executed"
|
grub_selection = "The highlighted entry will be executed"
|
||||||
|
|
||||||
p = pexpect.spawn("telnet 127.0.0.1 %s" % args.p, timeout=600, logfile=sys.stdout)
|
i = 0
|
||||||
|
while True:
|
||||||
|
try:
|
||||||
|
p = pexpect.spawn("telnet 127.0.0.1 %s" % args.p, timeout=600, logfile=sys.stdout)
|
||||||
|
break
|
||||||
|
except Exception as e:
|
||||||
|
print str(e)
|
||||||
|
i += 1
|
||||||
|
if i == 10:
|
||||||
|
raise
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
# select ONIE embed
|
# select ONIE embed
|
||||||
p.expect(grub_selection)
|
p.expect(grub_selection)
|
||||||
|
Reference in New Issue
Block a user