Skip to content

Handle parent=none for physical networks #2073

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions cmd/incusd/networks.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,11 @@ func networksPost(d *Daemon, r *http.Request) response.Response {
// A targetNode was specified, let's just define the node's network without actually creating it.
// Check that only NodeSpecificNetworkConfig keys are specified.
for key := range req.Config {
// Special-case: allow "parent=none". Used to indicate that this node should not act as a gateway chassis.
Copy link
Member

Choose a reason for hiding this comment

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

parent is a node-specific config, so this change isn't needed

if key == "parent" && req.Config[key] == "none" {
continue
}

if !slices.Contains(db.NodeSpecificNetworkConfig, key) {
return response.BadRequest(fmt.Errorf("Config key %q may not be used as member-specific key", key))
}
Expand Down
12 changes: 12 additions & 0 deletions internal/server/network/driver_ovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -3399,6 +3399,11 @@ func (n *ovn) Rename(newName string) error {
// chassisEnabled checks the cluster config to see if this particular
// member should act as an OVN chassis.
func (n *ovn) chassisEnabled(ctx context.Context, tx *db.ClusterTx) (bool, error) {
// If parent is "none", this network is standalone and should not act as a chassis.
if n.config["parent"] == "none" {
return false, nil
}
Comment on lines +3402 to +3405
Copy link
Member

Choose a reason for hiding this comment

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

This check is incorrect. n.config here refers to the config of the OVN network when the parent check needs to be done on the uplink network instead.

So you should change the check to:

  • Check that we have an uplink network at all d.config["network"] != "none"
  • Check that the uplink network is of type physical
  • Check if the parent property on the uplink network is set to none


// Get the member info.
memberID := tx.GetNodeID()
members, err := tx.GetNodes(ctx)
Expand Down Expand Up @@ -3446,6 +3451,13 @@ func (n *ovn) Start() error {

reverter.Add(func() { n.setUnavailable() })

// Skip full start logic if parent=none.
if n.config["parent"] == "none" {
n.logger.Info("Skipping OVN Start due to parent=none", logger.Ctx{"project": n.project, "name": n.name})
n.setAvailable()
return nil
}
Comment on lines +3454 to +3459
Copy link
Member

Choose a reason for hiding this comment

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

That looks wrong. You're skipping everything in the function which includes a lot of bits that are actually needed.

I think you should instead modify startUplinkPort to skip when the uplink network is of type physical and has a parent property set to none.


// Check that uplink network is available.
if n.config["network"] != "" && n.config["network"] != "none" && !IsAvailable(api.ProjectDefaultName, n.config["network"]) {
return fmt.Errorf("Uplink network %q is unavailable", n.config["network"])
Expand Down
Loading