Skip to content

Use netavark create to fill out network config#610

Merged
Luap99 merged 2 commits intocontainers:mainfrom
ashley-cui:netavarkcreate
Apr 28, 2026
Merged

Use netavark create to fill out network config#610
Luap99 merged 2 commits intocontainers:mainfrom
ashley-cui:netavarkcreate

Conversation

@ashley-cui
Copy link
Copy Markdown
Member

@ashley-cui ashley-cui commented Jan 27, 2026

Netavark now supports a new command, netavark create, which will take incomplete network configs, validate options, and return a completed config.
Migrate c/common/libnetwork to use the netavark create command

Requires a new netavark, but mostly non-breaking, other than now we enforce true/false for no default route - 0/1 is no longer supported

@github-actions github-actions Bot added the common Related to "common" package label Jan 27, 2026
@ashley-cui ashley-cui force-pushed the netavarkcreate branch 2 times, most recently from fa4eabd to 0a9721c Compare April 7, 2026 19:40
@packit-as-a-service
Copy link
Copy Markdown

Packit jobs failed. @containers/packit-build please check.

@ashley-cui ashley-cui force-pushed the netavarkcreate branch 2 times, most recently from aaf14f5 to c34e22b Compare April 14, 2026 18:48
@ashley-cui ashley-cui force-pushed the netavarkcreate branch 3 times, most recently from 23535d7 to dac307f Compare April 16, 2026 14:35
@ashley-cui
Copy link
Copy Markdown
Member Author

Tests are passing here, but would love to do a vendor into podman before this merges, but that depends on new images which are currently failing. Hold tight..

Comment thread common/libnetwork/netavark/config.go Outdated
Comment thread common/libnetwork/types/network.go Outdated
Comment thread common/libnetwork/netavark/config.go
@ashley-cui ashley-cui force-pushed the netavarkcreate branch 2 times, most recently from c896fb5 to e635760 Compare April 22, 2026 15:02
@Luap99 Luap99 added the podman 6 breaking changes that should go only into podman 6 only label Apr 22, 2026
ashley-cui added a commit to ashley-cui/podman that referenced this pull request Apr 23, 2026
Signed-off-by: Ashley Cui <acui@redhat.com>
ashley-cui added a commit to ashley-cui/podman that referenced this pull request Apr 23, 2026
Signed-off-by: Ashley Cui <acui@redhat.com>
@ashley-cui ashley-cui marked this pull request as ready for review April 24, 2026 00:41
@ashley-cui
Copy link
Copy Markdown
Member Author

ashley-cui commented Apr 24, 2026

Ready to review. Tests are passing in containers/podman#28570 except for one, which will be fixed in containers/netavark#1440. Please merge the netavark PR first to unblock podman vendoring.

@containers/container-libs-maintainers PTAL

ashley-cui added a commit to ashley-cui/podman that referenced this pull request Apr 24, 2026
For containers/container-libs#610

Signed-off-by: Ashley Cui <acui@redhat.com>
From containers/automation_images#443

Signed-off-by: Ashley Cui <acui@redhat.com>
ashley-cui added a commit to ashley-cui/podman that referenced this pull request Apr 25, 2026
For containers/container-libs#610

Signed-off-by: Ashley Cui <acui@redhat.com>
@ashley-cui
Copy link
Copy Markdown
Member Author

ashley-cui commented Apr 27, 2026

Tests are passing in containers/podman#28570, this should be good to go.
PTAL @containers/container-libs-maintainers @Luap99, thanks!

Copy link
Copy Markdown
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

I don't really have time to do full thorough review, just some small comments I guess. overall seems fine

Comment thread common/libnetwork/netavark/network.go Outdated
Comment thread common/libnetwork/netavark/config.go Outdated
var result *types.Network
err = n.execNetavark([]string{"create"}, needsPlugin, &opts, &result)
if err != nil {
if strings.Contains(err.Error(), "already exists") {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

generally this is rather poor since this text could be triggered by a lot of unexpected future code paths. Is there a way we can match the exact code path and then comment here on the exact nv code and make a comment in nv code that we depend on string matches for now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The code path comes from
https://github.com/containers/netavark/blob/0043f76d1a54aac6aface5c5363149a2ae3cc9a2/src/network/create_config/validation.rs#L29

I can do a little more accurate match, and then comment in nv?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yes lets match the full string network already exists , though the longer I think about it do we actually want to do that check on the rust side? feels like the check could be done much easier on the go side before we call nv? like the IgnoreIfExists check

Copy link
Copy Markdown
Member Author

@ashley-cui ashley-cui Apr 28, 2026

Choose a reason for hiding this comment

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

I think used_names still needs to be passed to netavark anyway, so we don't collide on device names when generating device names? So we could add this check in later, no rush to remove the used_names from the input json in netavark

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

moving it would make sense but maybe lets not delays this further, we have some freedom to move things around later as well so lets continue with what we have

Comment thread common/libnetwork/netavark/config.go Outdated
Comment thread common/libnetwork/netavark/config_test.go
Netavark now supports a new command, netavark create, which will take incomplete network configs, validate options, and return a completed config.
Migrate c/common/libnetwork to use the netavark create command

Requires a new netavark, but mostly non-breaking, other than now we enforce true/false for no default route - 0/1 is no longer supported

Signed-off-by: Ashley Cui <acui@redhat.com>
@TomSweeneyRedHat
Copy link
Copy Markdown
Member

TomSweeneyRedHat commented Apr 28, 2026

Light weight netavark reviewer, but the changes LGTM

Copy link
Copy Markdown
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM

@Luap99 Luap99 merged commit d581460 into containers:main Apr 28, 2026
30 of 37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Related to "common" package podman 6 breaking changes that should go only into podman 6 only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants