Skip to content

Commit b6735fd

Browse files
committed
Export GetFloatingIP
This allows fetching a floating IP without attempting to create one if it doesn't exist. There are currently no internal users, but it will be used by OpenShift's machine-api-provider-openstack.
1 parent f7a0c9f commit b6735fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pkg/cloud/services/networking/floatingip.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func (s *Service) GetOrCreateFloatingIP(eventObject runtime.Object, openStackClu
3636
var fpCreateOpts floatingips.CreateOpts
3737

3838
if ip != "" {
39-
fp, err = s.checkIfFloatingIPExists(ip)
39+
fp, err = s.GetFloatingIP(ip)
4040
if err != nil {
4141
return nil, err
4242
}
@@ -70,7 +70,7 @@ func (s *Service) GetOrCreateFloatingIP(eventObject runtime.Object, openStackClu
7070
return fp, nil
7171
}
7272

73-
func (s *Service) checkIfFloatingIPExists(ip string) (*floatingips.FloatingIP, error) {
73+
func (s *Service) GetFloatingIP(ip string) (*floatingips.FloatingIP, error) {
7474
fpList, err := s.client.ListFloatingIP(floatingips.ListOpts{FloatingIP: ip})
7575
if err != nil {
7676
return nil, err
@@ -93,7 +93,7 @@ func (s *Service) GetFloatingIPByPortID(portID string) (*floatingips.FloatingIP,
9393
}
9494

9595
func (s *Service) DeleteFloatingIP(eventObject runtime.Object, ip string) error {
96-
fip, err := s.checkIfFloatingIPExists(ip)
96+
fip, err := s.GetFloatingIP(ip)
9797
if err != nil {
9898
return err
9999
}
@@ -147,7 +147,7 @@ func (s *Service) AssociateFloatingIP(eventObject runtime.Object, fp *floatingip
147147
}
148148

149149
func (s *Service) DisassociateFloatingIP(eventObject runtime.Object, ip string) error {
150-
fip, err := s.checkIfFloatingIPExists(ip)
150+
fip, err := s.GetFloatingIP(ip)
151151
if err != nil {
152152
return err
153153
}

0 commit comments

Comments
 (0)