Skip to content

[DigitalOcean] Include IPv6 addresses in node public/private IPs - #2173

Open
Sanjays2402 wants to merge 2 commits into
apache:trunkfrom
Sanjays2402:fix/digitalocean-ipv6-public-ips
Open

[DigitalOcean] Include IPv6 addresses in node public/private IPs#2173
Sanjays2402 wants to merge 2 commits into
apache:trunkfrom
Sanjays2402:fix/digitalocean-ipv6-public-ips

Conversation

@Sanjays2402

Copy link
Copy Markdown
Contributor

[DigitalOcean] Include IPv6 addresses in node public/private IPs

Description

Closes #1738

DigitalOcean_v2_NodeDriver._to_node() only iterated the v4 networks list, so a droplet's public IPv6 address was never reported in Node.public_ips. Each match also reassigned the list (public_ips = [...]) instead of appending, so only the last address of a given type survived. Both lists are now iterated and addresses appended.

This matches the patch proposed in the issue. Note that the existing list_nodes fixture already contains a public IPv6 address (2604:a880:4:1d0::142:9000) that was being silently dropped, so test_list_nodes_success was updated to assert it.

Status

done, ready for review

Checklist (tick everything that applies)

  • Code linting (required, can be done after the PR checks)
  • Documentation
  • Tests
  • ICLA (required for bigger changes)

The DigitalOcean v2 driver's _to_node() only iterated the "v4" networks
list, so a droplet's public IPv6 address was never reported in
Node.public_ips. Each match also reassigned the list rather than
appending, so only the last address of a given type survived.

Iterate both the "v4" and "v6" network lists and append, keeping every
reported address.

Adds a regression test covering a droplet with both an IPv4 and an IPv6
public address, and updates test_list_nodes_success, whose existing
fixture already contains a public IPv6 address that was being dropped.

Closes apache#1738

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes DigitalOcean v2 node network parsing so Node.public_ips / Node.private_ips include IPv6 addresses and preserve multiple addresses instead of overwriting earlier entries.

Changes:

  • Update DigitalOcean_v2_NodeDriver._to_node() to iterate both networks["v4"] and networks["v6"] and append IPs.
  • Update the DigitalOcean v2 compute tests to assert IPv6 appears in public_ips, and add a targeted _to_node() unit test.
  • Add a changelog entry documenting the behavior fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
libcloud/compute/drivers/digitalocean.py Include IPv6 networks in IP extraction and append IPs to avoid overwriting.
libcloud/test/compute/test_digitalocean_v2.py Extend assertions to cover IPv6 in public_ips and add a unit test for _to_node().
CHANGES.rst Document the DigitalOcean IPv6/public+private IP reporting fix.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread libcloud/test/compute/test_digitalocean_v2.py Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.40%. Comparing base (b646588) to head (5ccda1b).
⚠️ Report is 1 commits behind head on trunk.

Additional details and impacted files
@@            Coverage Diff             @@
##            trunk    #2173      +/-   ##
==========================================
+ Coverage   83.39%   83.40%   +0.01%     
==========================================
  Files         351      351              
  Lines       81519    81524       +5     
  Branches     8747     8747              
==========================================
+ Hits        67982    67992      +10     
+ Misses      10744    10742       -2     
+ Partials     2793     2790       -3     
Files with missing lines Coverage Δ
libcloud/compute/drivers/digitalocean.py 86.85% <100.00%> (+1.99%) ⬆️
libcloud/test/compute/test_digitalocean_v2.py 99.49% <100.00%> (+0.01%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Digital Ocean compute: public_ips += IPv6 addresses

4 participants