Skip to content

🐛 Search by either port ID or name/network #2583

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

Merged
merged 1 commit into from
Jun 16, 2025
Merged
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
4 changes: 1 addition & 3 deletions controllers/openstackserver_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,7 @@ var listDefaultPorts = func(r *recorders) {

var listDefaultPortsWithID = func(r *recorders) {
r.network.ListPort(ports.ListOpts{
Name: openStackServerName + "-0",
ID: portUUID,
NetworkID: networkUUID,
ID: portUUID,
}).Return([]ports.Port{
{
ID: portUUID,
Expand Down
8 changes: 4 additions & 4 deletions pkg/cloud/services/networking/port.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ func (s *Service) ensurePortTagsAndTrunk(port *ports.Port, eventObject runtime.O
// and that the port has suitable tags and trunk. If the PortStatus is already known,
// use the ID when filtering for existing ports.
func (s *Service) EnsurePort(eventObject runtime.Object, portSpec *infrav1.ResolvedPortSpec, portStatus infrav1.PortStatus) (*ports.Port, error) {
opts := ports.ListOpts{
Name: portSpec.Name,
NetworkID: portSpec.NetworkID,
}
opts := ports.ListOpts{}
if portStatus.ID != "" {
opts.ID = portStatus.ID
} else {
opts.Name = portSpec.Name
opts.NetworkID = portSpec.NetworkID
}

existingPorts, err := s.client.ListPort(opts)
Expand Down