launch-node.py : add option to skip ipv6 address checks

As noted inline, this needs to be skipped on OVH (and I always forget,
and debug this over and over when launching a mirror node there :).

Change-Id: I07780e29f5fef75cdbab3b504f278387ddc4b13f
This commit is contained in:
Ian Wienand 2019-06-26 18:28:28 +10:00
parent 263ab148fe
commit f673b71466

View File

@ -94,7 +94,7 @@ def stream_syslog(ssh_client):
def bootstrap_server(server, key, name, volume_device, keep,
mount_path, fs_label, environment, timeout):
mount_path, fs_label, environment, timeout, ignore_ipv6):
ip = server.public_v4
ssh_kwargs = dict(pkey=key)
@ -120,6 +120,7 @@ def bootstrap_server(server, key, name, volume_device, keep,
ssh_client = utils.ssh_connect(ip, 'root', ssh_kwargs, timeout=timeout)
if not ignore_ipv6:
# Something up with RAX images that they have the ipv6 interface in
# /etc/network/interfaces but eth0 hasn't noticed yet; reload it
ssh_client.ssh('(ifdown eth0 && ifup eth0) || true')
@ -208,7 +209,7 @@ def bootstrap_server(server, key, name, volume_device, keep,
def build_server(cloud, name, image, flavor,
volume, keep, network, boot_from_volume, config_drive,
mount_path, fs_label, availability_zone, environment,
volume_size, timeout):
volume_size, timeout, ignore_ipv6):
key = None
server = None
@ -246,6 +247,7 @@ def build_server(cloud, name, image, flavor,
cloud.delete_keypair(key_name)
server = cloud.get_openstack_vars(server)
if volume:
volume = cloud.get_volume(volume)
volume_device = cloud.get_volume_attach_device(volume,
@ -253,7 +255,7 @@ def build_server(cloud, name, image, flavor,
else:
volume_device = None
bootstrap_server(server, key, name, volume_device, keep,
mount_path, fs_label, environment, timeout)
mount_path, fs_label, environment, timeout, ignore_ipv6)
print('UUID=%s\nIPV4=%s\nIPV6=%s\n' % (
server.id, server.public_v4, server.public_v6))
except Exception:
@ -337,6 +339,10 @@ def main():
parser.add_argument("--timeout", dest="timeout",
help="Increase timeouts (default 600s)",
type=int, default=600)
parser.add_argument("--ignore_ipv6", dest="ignore_ipv6",
help="Ignore IPv6 addresses from API",
action='store_true', default=False)
parser.add_argument("--az", dest="availability_zone", default=None,
help="AZ to boot in.")
options = parser.parse_args()
@ -366,6 +372,14 @@ def main():
print(i.name)
sys.exit(1)
# NOTE(ianw): 2019-06-26 for whatever reason OVH assigns an IPv6
# address that is seen in API queries, but it is not in the host
# metadata so the interface isn't autoconfigured. Auto skip it to
# avoid this bombing out.
if "-ovh" in options.cloud:
print("Ignoring IPv6 for OVH cloud instances")
options.ignore_ipv6 = True
server = build_server(cloud, options.name, image, flavor,
options.volume, options.keep,
options.network, options.boot_from_volume,
@ -373,7 +387,7 @@ def main():
options.mount_path, options.fs_label,
options.availability_zone,
options.environment, options.volume_size,
options.timeout)
options.timeout, options.ignore_ipv6)
dns.print_dns(cloud, server)
print("If this is a server that is expected to send email (ask, review,")
print("lists, etc) double check that the server's IPs are not listed on")