Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates for 24.1.1 #5036

Merged
merged 11 commits into from
Mar 11, 2024
Merged

Updates for 24.1.1 #5036

merged 11 commits into from
Mar 11, 2024

Conversation

holmanb
Copy link
Member

@holmanb holmanb commented Mar 9, 2024

24.1.1

Include the bugfixes planned for 24.1.1 (and dependent commits to avoid cherry-pick conflicts and failing tests), waiting on #5021 and #5028 to land and then will include them in this PR.

2516aed (HEAD -> 24.1.x, origin/24.1.x) fix: Add "broadcast" to network v1 schema (#5034)
db8272a pro: honor but warn on custom ubuntu_advantage in /etc/cloud/cloud.cfg (#5030)
95d6a65 net/dhcp: handle timeouts for dhcpcd (#5022)
1c4b7d5 fix: Make wait_for_url respect explicit arguments
888507d bug(wait_for_url): when exceptions occur url is unset, use url_exc
74481d2 test: Fix scaleway retry assumptions
a5aba0c fix: Make DataSourceOracle more resilient to early network issues (#5025)
38b69c8 tests: Fix wsl test (#5008)

  • Rebase merge

holmanb and others added 8 commits March 9, 2024 10:51
Force ds-identify to use the correct file mocks
Set defaults for optional os-release fields [1]

VERSION_ID and ID might not be set; set defaults.

[1] man 5 os-release

Fixes canonicalGH-5002
…nonical#5025)

If DataSourceOracle fails to retrieve IMDS info in init-local, try
again during network timeframe. Additionally, ensure max_wait,
timeout, and retries are respected.

LP: #2056194
In test_scaleway.py, test_metadata_connection_errors_legacy_ipv4_url
assumes that a call to wait_for_url() will retry the number of
retries specified by the datasource, but that retry number is used
for readurl() calls, not wait_for_url() calls. The fact that the
assertion happened to work previously was entirely incidental.

Additionally, mock time.time() and time.sleep() calls so that we're
not needlessly waiting in unit tests.
When processing multiple urls in wait_for_url and a timeout error
occurs, the local variable url is None yet url_exc.url is set.

Fallback to url_exc.url with url is unet to provide sensible
warning messages:
 Calling '<full_failed_url>' failed [3/120s]: request error

instead of:
 Calling 'None' failed [3/120s]

LP: #2055077
I'm not sure 10 seconds is enough of a timeout.  Azure will retry DHCP
failures, but I expect the reduction from 300s/60s -> 10s will result in
unexpected failures for other clouds where there is no retry.

I see that dhcpcd offers a --timeout option which might be better than
relying on subprocess timeout?  Something to consider.

In the meantime:

- catch the TimeoutExpired exception and raise NoDhcpLeaseError to
  address below traceback

- update the "dhclient" logs to "dhcpcd"

```
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceAzure.py", line 851, in _get_data
    crawled_data = util.log_time(
                   ^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/util.py", line 2825, in log_time
    ret = func(*args, **kwargs)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/sources/helpers/azure.py", line 45, in impl
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceAzure.py", line 630, in crawl_metadata
    self._setup_ephemeral_networking(timeout_minutes=timeout_minutes)
  File "/usr/lib/python3/dist-packages/cloudinit/sources/helpers/azure.py", line 45, in impl
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/sources/DataSourceAzure.py", line 440, in _setup_ephemeral_networking
    lease = self._ephemeral_dhcp_ctx.obtain_lease()
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/net/ephemeral.py", line 288, in obtain_lease
    self.lease = maybe_perform_dhcp_discovery(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 102, 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 649, in dhcp_discovery
    out, err = subp.subp(
               ^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/subp.py", line 276, in subp
    out, err = sp.communicate(data, timeout=timeout)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 1209, in communicate
    stdout, stderr = self._communicate(input, endtime, timeout)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 2114, in _communicate
    self._check_timeout(endtime, orig_timeout, stdout, stderr)
  File "/usr/lib/python3.12/subprocess.py", line 1253, in _check_timeout
    raise TimeoutExpired(
subprocess.TimeoutExpired: Command '[b'/usr/sbin/dhcpcd', b'--ipv4only', b'--waitip', b'--persistent', b'--noarp', b'--script=/bin/true', b'eth0']' timed out after 10 seconds
```

Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
canonical#5030)

Add RENAMED_MODULES to allow support for custom /etc/cloud/cloud.cfg.d/*
which may still contain the old ubuntu_advantage module name instead of
ubuntu_pro.

While the typical package upgrade path would replace ubuntu_avantage
with ubuntu_pro in /etc/cloud/cloud.cfg. It's possible a customer has
a customized /etc/cloud/cloud.cfg that they do not wish to update
with the version delivered by the cloud-init upstream package.

In cases where ubuntu_advantage is listed in system config, allow
cloud-init to WARN about the rename, but still load and run ubuntu_pro.

Fixes canonicalGH-5019
Both the klibc initramfs code and the eni code will write a network v1
configuration including the broadcast address if it is provided. It
gets rendered if using the eni renderer.

LP: #2056460
@blackboxsw
Copy link
Collaborator

Thanks for this @holmanb I think we are only missing #5021 Thanks for the review on that BTW. I'll be able to review this by Monday if things all land

@TheRealFalcon
Copy link
Member

@blackboxsw I can finish up 5021 and review this Monday

@holmanb
Copy link
Member Author

holmanb commented Mar 9, 2024

Thanks for this @holmanb I think we are only missing #5021 Thanks for the review on that BTW. I'll be able to review this by Monday if things all land

+1 agreed, I'll add a comment about that to the PR description

@blackboxsw I can finish up 5021 and review this Monday

+1 thanks @TheRealFalcon

holmanb and others added 3 commits March 11, 2024 11:32
…anonical#5021)

bug(vmware): initialize new DataSourceVMware attributes at unpickle

When a datasource has already been cached from a previous boot, the
datasource is deserialized from the cached object instead of running
__init__ method. Across a cloud-init package upgrade if new instance
attributes have been initialized in __init__, we need to also initialize
them in the class  _unpickle method to avoid AttributeErrors for any
instance methods referencing new attributes.

Fix AttributeError on rpctool and rpctool_fn

LP: #2056439
…al#5039)

Ensure `metadata_address` is ignored in the _unpickle test for
DataSourceCloudStack. It has existed for many years.
Copy link
Member

@TheRealFalcon TheRealFalcon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

If you plan on using the list of cherry-picks in the commit message, just make sure you update it with the last 3.

@holmanb holmanb merged commit 2a4c0b6 into canonical:24.1.x Mar 11, 2024
29 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants