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

Oracle netplan v2 migration #6024

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

a-dubs
Copy link
Collaborator

@a-dubs a-dubs commented Feb 17, 2025

Proposed Commit Message

feat(oracle): update Oracle Datasource to use netplan v2

Additional Context

Test Steps

Ran the full integration test suite against Noble using a custom deb created from this feature branch.

Merge type

  • Squash merge using "Proposed Commit Message"

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.

See my inline comments. I think you added some good code, but much of it can move into tests.

Additionally, I forget, why are we moving to support both v1 and v2 now? Once we move to v2, is there any reason we would need to keep the v1 support around?

@a-dubs
Copy link
Collaborator Author

a-dubs commented Feb 19, 2025

@TheRealFalcon thanks for the feedback! I guess the idea here was that by keeping the old v1 code around, we could do the comparisons on live systems that way if anyone ever finds a weird edge case then it will log a warning and they could file a bug. But honestly, now that you mention it, I do kinda prefer the idea of just having a super comprehensive unit test suite to verify it once and be done and then move on with our lives.

@holmanb thoughts? since this was your idea originally?

@holmanb
Copy link
Member

holmanb commented Feb 20, 2025

@TheRealFalcon thanks for the feedback! I guess the idea here was that by keeping the old v1 code around, we could do the comparisons on live systems that way if anyone ever finds a weird edge case then it will log a warning and they could file a bug. But honestly, now that you mention it, I do kinda prefer the idea of just having a super comprehensive unit test suite to verify it once and be done and then move on with our lives.

@holmanb thoughts? since this was your idea originally?

The only benefit that I see of a runtime check is that it might catch edge cases that couldn't be predicted with a battery of unit tests. I'm fine with just getting some good test coverage instead if that's preferred.

@a-dubs a-dubs force-pushed the CPC-6431-oracle-netplan-v2-migration branch 5 times, most recently from f5074ad to 6711993 Compare February 26, 2025 20:23
@a-dubs a-dubs force-pushed the CPC-6431-oracle-netplan-v2-migration branch from 6711993 to 8302d70 Compare February 26, 2025 20:32
@a-dubs a-dubs marked this pull request as ready for review February 26, 2025 21:27
Copy link
Member

@holmanb holmanb left a comment

Choose a reason for hiding this comment

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

@a-dubs I left some comments below.

@a-dubs a-dubs force-pushed the CPC-6431-oracle-netplan-v2-migration branch from 8bbaa92 to bf79f07 Compare February 28, 2025 17:57
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This PR migrates the Oracle datasource configuration from netplan v1 to netplan v2 and improves test coverage for helper functions.

  • Updates the Oracle datasource to use the new netplan v2 configuration schema.
  • Adds a set of comprehensive unit tests for the dict comparison helper function.
  • Introduces YAML import and logger initialization in the test helpers to support improved debugging.

Reviewed Changes

File Description
tests/unittests/helpers.py Adds YAML import, logger initialization, and the dicts_are_equal helper function.
tests/unittests/test_helpers.py Introduces unit tests for the dicts_are_equal function.
cloudinit/sources/DataSourceOracle.py Migrates Oracle datasource configuration from netplan v1 to v2 and refactors related methods.

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

if not metadata_address:
return False
return metadata_address.startswith(IPV4_METADATA_ROOT.split("opc")[0])
def convert_v1_netplan_to_v2(network_config: dict) -> dict:
Copy link
Preview

Copilot AI Mar 3, 2025

Choose a reason for hiding this comment

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

The function convert_v1_netplan_to_v2 uses the protected method _render_content from netplan.Renderer, which may break if the internal API changes. Consider using a public API for rendering if available.

Copilot is powered by AI, so mistakes are possible. Review output carefully before use.

Positive Feedback
Negative Feedback

Provide additional feedback

Please help us improve GitHub Copilot by sharing more details about this comment.

Please select one or more of the options
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.

3 participants