Skip to content

Commit

Permalink
Merge pull request lxc#456 from stgraber/ovn
Browse files Browse the repository at this point in the history
Expose OVN logic router name in state API
  • Loading branch information
hallyn authored Jan 31, 2024
2 parents b217562 + ea39f32 commit ee90200
Show file tree
Hide file tree
Showing 16 changed files with 638 additions and 570 deletions.
3 changes: 3 additions & 0 deletions cmd/incus/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,9 @@ func (c *cmdNetworkInfo) Run(cmd *cobra.Command, args []string) error {
fmt.Println("")
fmt.Println(i18n.G("OVN:"))
fmt.Printf(" %s: %s\n", i18n.G("Chassis"), state.OVN.Chassis)
if client.HasExtension("network_state_ovn_lr") {
fmt.Printf(" %s: %s\n", i18n.G("Logical router"), state.OVN.LogicalRouter)
}
}

return nil
Expand Down
6 changes: 6 additions & 0 deletions doc/api-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -2334,3 +2334,9 @@ It supports the value `stop`, `stateful-stop` and `force-stop`.
## `agent_config_drive`

This introduces a new `agent:config` disk `source` which can be used to expose an ISO to the VM guest containing the agent and its configuration.

## `network_state_ovn_lr`

Adds a new `LogicalRouter` field to the `NetworkStateOVN` struct which is part of the `GET /1.0/networks/NAME/state` API.

This is used to get the OVN logical router name.
6 changes: 6 additions & 0 deletions doc/rest-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3310,8 +3310,14 @@ definitions:
properties:
chassis:
description: OVN network chassis name
example: server01
type: string
x-go-name: Chassis
logical_router:
description: OVN logical router name
example: incus-net1-lr
type: string
x-go-name: LogicalRouter
type: object
x-go-package: github.com/lxc/incus/shared/api
NetworkStateVLAN:
Expand Down
5 changes: 4 additions & 1 deletion internal/server/network/driver_ovn.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,10 @@ func (n *ovn) State() (*api.NetworkState, error) {
Mtu: mtu,
State: "up",
Type: "broadcast",
OVN: &api.NetworkStateOVN{Chassis: chassis},
OVN: &api.NetworkStateOVN{
Chassis: chassis,
LogicalRouter: string(n.getRouterName()),
},
}, nil
}

Expand Down
1 change: 1 addition & 0 deletions internal/version/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ var APIExtensions = []string{
"clustering_evacuation_stop_options",
"boot_host_shutdown_action",
"agent_config_drive",
"network_state_ovn_lr",
}

// APIExtensionsCount returns the number of available API extensions.
Expand Down
Loading

0 comments on commit ee90200

Please sign in to comment.