diff options
author | Chris Patterson <cpatterson@microsoft.com> | 2023-03-16 16:22:30 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-16 15:22:30 -0500 |
commit | 5eb43b9548312ecb76a6a7e4567500a836ca3514 (patch) | |
tree | 764eac9ebd6915edef3832f35bfa340d779ff3f8 /cloudinit/sources | |
parent | fc6c1d3780cd1480b7819df8fbc08eb9247e4eec (diff) | |
download | cloud-init-git-5eb43b9548312ecb76a6a7e4567500a836ca3514.tar.gz |
sources/azure: add networking check for all source PPS (#2061)
There is a networking check in _poll_imds() which will attempt DHCP
again if networking is not up for source PPS. With the previous
change to wait at least 20 minutes during provisioning for DHCP,
this additional round is not necessary.
Report failure if networking is not up for any mode of source PPS.
In practice, this is very unlikely as provisioning will typically
timeout within the 20 minute window the VM is attempting DHCP and
the source PPS VM will be deleted.
This fixes an (unobserved) issue where Savable PPS does not have
networking prior to _wait_for_all_nics_ready().
Signed-off-by: Chris Patterson <cpatterson@microsoft.com>
Diffstat (limited to 'cloudinit/sources')
-rw-r--r-- | cloudinit/sources/DataSourceAzure.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index dfcb891f..9233384b 100644 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -579,6 +579,12 @@ class DataSourceAzure(sources.DataSource): report_diagnostic_event(msg, logger_func=LOG.error) raise sources.InvalidMetaDataException(msg) + # Networking is a hard requirement for source PPS, fail without it. + if not self._is_ephemeral_networking_up(): + msg = "DHCP failed while in source PPS" + report_diagnostic_event(msg, logger_func=LOG.error) + raise sources.InvalidMetaDataException(msg) + if pps_type == PPSType.SAVABLE: self._wait_for_all_nics_ready() elif pps_type == PPSType.OS_DISK: @@ -1096,13 +1102,6 @@ class DataSourceAzure(sources.DataSource): dhcp_attempts = 0 if report_ready: - # Networking must be up for netlink to detect - # media disconnect/connect. It may be down to due - # initial DHCP failure, if so check for it and retry, - # ensuring we flag it as required. - if not self._is_ephemeral_networking_up(): - self._setup_ephemeral_networking(timeout_minutes=20) - try: if ( self._ephemeral_dhcp_ctx is None |