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

focal: Add dhcp6 patch for ec2 #5132

Merged
merged 28 commits into from
Apr 3, 2024
Merged

Conversation

holmanb
Copy link
Member

@holmanb holmanb commented Apr 2, 2024

Context

Followup for reverting #5131 and #5104 on old series to avoid breaking change.

Merge type

  • Squash merge using "Proposed Commit Message"
  • Rebase and merge unique commits. Requires commit messages per-commit each referencing the pull request number (#<PR_NUM>)

bin456789 and others added 26 commits March 22, 2024 15:14
…cal#5077)

* Fixes certificates being placed in the wrong folder
  (/etc/pki/tls/certs/ instead of the correct /etc/ssl/certs/)
* Fixes certificates having the wrong extension (.crt instead of .pem)
According to the JSON schema, the "homedir" directive should be used to
set a user's home directory. However, we use "home" in a documented
example. Supplying the example cloud-config to cloud-init schema fails
with:
  Additional properties are not allowed ('home' was unexpected),

Fixed by replacing "home" with "homedir" in the example.

LP: #2047796
…nical#5073)

`_network_config` is only explicitly set on the instance if
`_is_iscsi_root()` is True. This means that when `_is_iscsi_root()` is
False, we're modifying the class variable directly. When the instance
gets pickled, the class variable is not included so such changes do
not get persisted. This commit fixes this.
NM_CONTROLLED=true allows cloud-init to wait until network devices are online.
BREAKING_CHANGE: Use NetworkManager renderer by default for RHEL family
Fixes canonicalGH-3781
This change may require a user to add `None` to the `datasource_list`
defined in `/etc/cloud/cloud.cfg[.d]` if they have a customized
datasource_list and want the DataSourceNone fallback behavior.

ds-identify would automatically append "None" to the datasource_list
if a single entry was provided in /etc/cloud/cloud.cfg[.d].
This wasn't a problem in the past as the python code would detect
a single datasource along with None as an indication to automatically
use that datasource. Since the python code no longer does that,
we should ensure that one specified datasource results in one specified
datasource after ds-identify has run.

Fixes canonicalGH-5091
Ignore these bandit violations as we're not dealing with untrusted
input. Violations ignored in this commit are:
 B314: xml_bad_ElementTree
 B318: xml_bad_mindom
 B405: import_xml_etree
 B406: import_xml_sax
 B408: import_xml_minidom
 B603: subprocess_without_shell_equals_true
Bump the version in cloudinit/version.py to 24.1.3 and
update ChangeLog.
Address assignment and link management is manual for isc-dhcp-client
whereas dhcpcd brings up its own interface and assigns the IP address.

Interface rename code assumes that the link will be down for rename.
Make sure to set dhcpcd's interface to the same state.
Rebooting an instance which has finished VMware guest
customization with DataSourceVMware will load
DataSourceNone due to metadata is NOT available.

This is mostly a re-post of PR#229, few differences are:
1. Let ds decide if fallback is allowed, not always fall back
   to previous cached LOCAL ds.
2. No comparing instance-id of cached ds with previous instance-id
   due to I think they are always identical.

Fixes canonicalGH-3402
When cloud-init finds any ipv6 information in the instance metadata, it
automatically enables dhcp6 for the network interface. However, this
brings up the instance with a broken IPv6 configuration because SLAAC
should be used for almost all situations on EC2.

Red Hat BZ: https://bugzilla.redhat.com/show_bug.cgi?id=2092459
Fedora Pagure: https://pagure.io/cloud-sig/issue/382
Upstream: https://bugs.launchpad.net/cloud-init/+bug/1976526

Fixes canonicalGH-3980

Signed-off-by: Major Hayden <major@redhat.com>
On most distros, including Ubuntu, the default timeout for dhclient is 300s.
There is no cloud-init controlled duration for the dhclient process as
it doesn't fork until after it receives an IP address and there is no timeout
value passed to subp().

I have seen some distros configure dhclient with a timeout of 60s, but
is far less common.

Given that a cloud VM is not very useful with DHCP, err on the generous
side and allow up to 300 seconds for dhcpcd to get an address.

Note that there is still an issue with dhcpcd retries which will be
addressed later in a separate PR.

Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Update various hard-coded filepaths. Also make sure we
bootstrap our Paths() config correctly so that we read
from the configured rundir.

Co-authored-by: Mina Galić <freebsd@igalic.co>
Sponsored by: The FreeBSD Foundation

Fixes canonicalGH-4766
…se (canonical#5128)

Seeing a fairly large number of lease parsing failures on Azure similar
to:
```
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 2828, 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 660, in crawl_metadata
    self._wait_for_pps_savable_reuse()
  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 1236, in _wait_for_pps_savable_reuse
    self._wait_for_hot_attached_primary_nic(nl_sock)
  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 1142, in _wait_for_hot_attached_primary_nic
    primary_nic_found = self._setup_ephemeral_networking(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 293, in obtain_lease
    self.lease = maybe_perform_dhcp_discovery(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 103, 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 656, in dhcp_discovery
    lease = self.get_newest_lease(interface)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 829, in get_newest_lease
    return self.parse_dhcpcd_lease(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/cloudinit/net/dhcp.py", line 787, in parse_dhcpcd_lease
    lease = dict(
            ^^^^^
ValueError: dictionary update sequence element #0 has length 1; 2 is required
```

Catch this error in parse_dhcpcd_lease() and raise
InvalidDHCPLeaseFileError after logging an error.

Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
After [0, 1], dhcp6 is going to be always false after upgrading
cloud-init. Correct this in the integration test.

Refs:
[0] canonical#3980
[1] https://bugs.launchpad.net/cloud-init/+bug/1976526
@holmanb holmanb changed the title Add dhcp6 patch for ec2 focal: Add dhcp6 patch for ec2 Apr 2, 2024
Copy link
Collaborator

@blackboxsw blackboxsw left a comment

Choose a reason for hiding this comment

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

Changeset is good, d/changelog doesn't have repeated refresh entries, content looks good. Only diff between focal and jammy/mantic is that the new_upstream_snapshot to focal was pulled one commit earlier than jammy/mantic. This isn't a big deal at all because we aren't releasing this and we'll be performing a new_upstream_snapshot again before we release/SRU anyway.

@holmanb holmanb merged commit 888ef36 into canonical:ubuntu/focal Apr 3, 2024
26 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.