diff --git a/launch/launch-node.py b/launch/launch-node.py index fa3c43f320..2e1ae2016c 100755 --- a/launch/launch-node.py +++ b/launch/launch-node.py @@ -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,13 +120,14 @@ def bootstrap_server(server, key, name, volume_device, keep, ssh_client = utils.ssh_connect(ip, 'root', ssh_kwargs, timeout=timeout) - # 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') + 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') - if server.public_v6: - ssh_client.ssh('ping6 -c5 -Q 0x10 review.openstack.org ' - '|| ping6 -c5 -Q 0x10 wiki.openstack.org') + if server.public_v6: + ssh_client.ssh('ping6 -c5 -Q 0x10 review.openstack.org ' + '|| ping6 -c5 -Q 0x10 wiki.openstack.org') ssh_client.scp(os.path.join(SCRIPT_DIR, '..', 'make_swap.sh'), 'make_swap.sh') @@ -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")