Skip to content

Commit

Permalink
trying ipv6 conn check from oracleds instead of ephemeral.py
Browse files Browse the repository at this point in the history
  • Loading branch information
a-dubs committed Oct 24, 2024
1 parent 2f2e065 commit ea9b746
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions cloudinit/sources/DataSourceOracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,37 +182,40 @@ def ds_detect() -> bool:
def _get_data(self):

self.system_uuid = _read_system_uuid()
nic_name = net.find_fallback_nic()

# Test against both v1 and v2 metadata URLs
connectivity_urls_data = [
{
"url": IPV4_METADATA_PATTERN.format(
version=1, path="instance"
version=2, path="instance"
),
"headers": V2_HEADERS,
},
{
"url": IPV4_METADATA_PATTERN.format(
version=2, path="instance"
version=1, path="instance"
),
"headers": V2_HEADERS,
},
]

ipv6_url_that_worked = check_ipv6_connectivity()
if ipv6_url_that_worked:
md_patterns = [IPV6_METADATA_PATTERN]
else:
md_patterns = [IPV4_METADATA_PATTERN]

# if we have connectivity to imds, then skip ephemeral network setup
if self.perform_dhcp_setup: # and not available_urls:
# TODO: ask james: this obviously fails on ipv6 single stack only
# is there a way to detect when we need this?
# would this only work/be needed if isci is being used?
# if so, could we just check for iscsi root and then do this?
if self.perform_dhcp_setup and not ipv6_url_that_worked:

nic_name = net.find_fallback_nic()
try:
network_context = ephemeral.EphemeralIPNetwork(
distro=self.distro,
interface=nic_name,
ipv6=True,
ipv6=False,
ipv4=True,
connectivity_urls_data=connectivity_urls_data,
ipv6_connectivity_check_callback=check_ipv6_connectivity,
ipv6_connectivity_check_callback=None,
)
except Exception:
network_context = util.nullcontext()
Expand All @@ -225,10 +228,6 @@ def _get_data(self):
)

with network_context:
if network_context.ipv6_reached_at_url:
md_patterns = [IPV6_METADATA_PATTERN]
else:
md_patterns = [IPV4_METADATA_PATTERN]
fetched_metadata, url_that_worked = read_opc_metadata(
fetch_vnics_data=fetch_primary_nic or fetch_secondary_nics,
max_wait=self.url_max_wait,
Expand Down

0 comments on commit ea9b746

Please sign in to comment.