ITADN

DataSourceOpenStack fails when first interface attached doesn't have dhcp enabled

#6786Openmklejn-ovh 创建于 2026-03-09
bugnew
M
mklejn-ovhcommented
# Bug report DataSourceOpenStackLocal is not clever enough to try all available interfaces, and because of that it can fail when given interface without dhcp enabled. This makes metadata service unavailable, and in turn yields instance without configuration. Expected behaviour: cloud-init tries interfaces until it hits one that can reach dhcp, or until it runs out of available interfaces, and only then fails. ## Steps to reproduce the problem - create private network in openstack, ensure dhcp is not enabled - create instance with interface in above network, and with public interface. order matters here. nova will attach interfaces in order provided, this replicates only when no-dhcp interface is provided first ## Environment details - Cloud-init version: 25.2-0ubuntu1~24.04.1 - Operating System Distribution: Ubuntu 24.04 - Cloud provider, platform or installer type: Openstack ## cloud-init logs ``` 2026-03-09 08:55:20,599 - ephemeral.py[DEBUG]: No connectivity URLs provided. Skipping connectivity check before ephemeral network setup. 2026-03-09 08:55:20,599 - distros[DEBUG]: Using configured dhcp client priority list: ['dhcpcd', 'dhclient', 'udhcpc'] 2026-03-09 08:55:20,599 - distros[DEBUG]: DHCP client selected: dhcpcd 2026-03-09 08:55:20,599 - dhcp.py[DEBUG]: Performing a dhcp discovery on ens3 2026-03-09 08:55:20,599 - subp.py[DEBUG]: Running command ['ip', 'link', 'set', 'dev', 'ens3', 'up'] with allowed return codes [0] (shell=False, capture=True) 2026-03-09 08:55:20,604 - util.py[DEBUG]: Reading from /sys/class/net/ens3/type (quiet=False) 2026-03-09 08:55:20,604 - util.py[DEBUG]: Reading 2 bytes from /sys/class/net/ens3/type 2026-03-09 08:55:20,604 - subp.py[DEBUG]: Running command ['dhcpcd', '--ipv4only', '--waitip', '--persistent', '--noarp', '--script=/bin/true', 'ens3'] with allowed return codes [0] (shell=False, capture=True) 2026-03-09 08:55:50,668 - performance.py[DEBUG]: Running ['dhcpcd', '--ipv4only', '--waitip', '--persistent', '--noarp', '--script=/bin/true', 'ens3'] took 30.064 seconds 2026-03-09 08:55:50,669 - dhcp.py[DEBUG]: dhcpcd exited with code: 1 stderr: 'dhcpcd-10.0.6 starting\n DUID 00:01:00:01:30:98:67:06:fa:16:3e:7a:28:32\n ens3: IAID 3e:a2:75:de\n ens3: soliciting a DHCP lease\n timed out\n dhcpcd exited' stdout: '' 2026-03-09 08:55:50,670 - log_util.py[WARNING]: 2026-03-09 08:55:50,670 - log_util.py[DEBUG]: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 668, in dhcp_discovery out, err = subp.subp( ^^^^^^^^^^ File "/usr/lib/python3/dist-packages/cloudinit/subp.py", line 291, in subp raise ProcessExecutionError( cloudinit.subp.ProcessExecutionError: Unexpected error while running command. Command: ['dhcpcd', '--ipv4only', '--waitip', '--persistent', '--noarp', '--script=/bin/true', 'ens3'] Exit code: 1 Reason: - Stdout: Stderr: dhcpcd-10.0.6 starting DUID 00:01:00:01:30:98:67:06:fa:16:3e:7a:28:32 ens3: IAID 3e:a2:75:de ens3: soliciting a DHCP lease timed out dhcpcd exited The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceOpenStack.py", line 163, in _get_data with EphemeralDHCPv4( File "/usr/lib/python3/dist-packages/cloudinit/net/ephemeral.py", line 309, in __enter__ return self.obtain_lease() ^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/cloudinit/net/ephemeral.py", line 332, in obtain_lease self.lease = maybe_perform_dhcp_discovery( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 107, in maybe_perform_dhcp_discovery return distro.dhcp_client.dhcp_discovery(interface, dhcp_log_func, distro) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 735, in dhcp_discovery raise NoDHCPLeaseError from error cloudinit.net.dhcp.NoDHCPLeaseError 2026-03-09 08:55:50,677 - performance.py[DEBUG]: Getting metadata took 30.093 seconds <--- snip ---> 2026-03-09 08:57:51,762 - url_helper.py[DEBUG]: [0/1] open 'http://[fe80::a9fe:a9fe%25ens3]/openstack' with {'url': 'http://[fe80::a9fe:a9fe%25ens3]/openstack', 'stream': False, 'allow_redirects': True, 'method': 'GET', 'timeout': 10.0, 'headers': {'User-Agent': 'Cloud-Init/25.2-0ubuntu1~24.04.1'}} configuration 2026-03-09 08:57:51,913 - url_helper.py[DEBUG]: [0/1] open 'http://169.254.169.254/openstack' with {'url': 'http://169.254.169.254/openstack', 'stream': False, 'allow_redirects': True, 'method': 'GET', 'timeout': 10.0, 'headers': {'User-Agent': 'Cloud-Init/25.2-0ubuntu1~24.04.1'}} configuration 2026-03-09 08:58:01,763 - url_helper.py[DEBUG]: Timed out waiting for addresses: http://[fe80::a9fe:a9fe%25ens3]/openstack http://169.254.169.254/openstack, exception(s) raised while waiting: HTTPConnectionPool(host='169.254.169.254', port=80): Max retries exceeded with url: /openstack (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7c74d098b860>: Failed to establish a new connection: [Errno 101] Network is unreachable')) 2026-03-09 08:58:01,763 - url_helper.py[DEBUG]: Calling 'http://169.254.169.254/openstack' failed [10/-1s]: Request timed out 2026-03-09 08:58:01,764 - DataSourceOpenStack.py[DEBUG]: Giving up on OpenStack md from ['http://[fe80::a9fe:a9fe%25ens3]/openstack', 'http://169.254.169.254/openstack'] after 10 seconds 2026-03-09 08:58:01,764 - log_util.py[WARNING]: No active metadata service found 2026-03-09 08:58:01,764 - log_util.py[DEBUG]: No active metadata service found Traceback (most recent call last): File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceOpenStack.py", line 172, in _get_data results = self._crawl_metadata() ^^^^^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceOpenStack.py", line 214, in _crawl_metadata raise sources.InvalidMetaDataException( cloudinit.sources.InvalidMetaDataException: No active metadata service found 2026-03-09 08:58:01,765 - performance.py[DEBUG]: Getting metadata took 10.010 seconds <--- snip ---> # from bootlog, to present network instance is left with [ 155.720169] cloud-init[699]: Cloud-init v. 25.2-0ubuntu1~24.04.1 running 'init' at Mon, 09 Mar 2026 08:57:51 +0000. Up 155.70 seconds. [ 155.732660] cloud-init[699]: ci-info: +++++++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++++++ [ 155.734603] cloud-init[699]: ci-info: +--------+-------+------------------------------+-----------+-------+-------------------+ [ 155.736583] cloud-init[699]: ci-info: | Device | Up | Address | Mask | Scope | Hw-Address | [ 155.738598] cloud-init[699]: ci-info: +--------+-------+------------------------------+-----------+-------+-------------------+ [ 155.740476] cloud-init[699]: ci-info: | ens3 | True | fe80::f816:3eff:fea2:75de/64 | . | link | fa:16:3e:a2:75:de | [ 155.742345] cloud-init[699]: ci-info: | ens4 | False | . | . | . | fa:16:3e:1d:69:68 | [ 155.743725] cloud-init[699]: ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | host | . | [ 155.745252] cloud-init[699]: ci-info: | lo | True | ::1/128 | . | host | . | [ 155.746538] cloud-init[699]: ci-info: +--------+-------+------------------------------+-----------+-------+-------------------+ ```
0 条评论