Merge "launch: add a probe for ssh after reboot"
This commit is contained in:
commit
b61c9edf66
@ -21,6 +21,7 @@
|
||||
import argparse
|
||||
import os
|
||||
import shutil
|
||||
import socket
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
@ -228,6 +229,19 @@ def bootstrap_server(server, key, name, volume_device, keep,
|
||||
else:
|
||||
raise
|
||||
|
||||
timeout = 120
|
||||
start = time.perf_counter()
|
||||
while True:
|
||||
try:
|
||||
print("Waiting for ssh...")
|
||||
with socket.create_connection((host_ip, 22), timeout=5):
|
||||
break
|
||||
except OSError as e:
|
||||
if time.perf_counter() - start >= timeout:
|
||||
raise Exception("Host did not reboot within timeout")
|
||||
time.sleep(10)
|
||||
print("Host rebooted!")
|
||||
|
||||
|
||||
def build_server(cloud, name, image, flavor,
|
||||
volume, keep, network, boot_from_volume, config_drive,
|
||||
|
Loading…
Reference in New Issue
Block a user