Skip to content

Commit

Permalink
Fix issue with dataLIF query for FCP interfaces with ZAPI.
Browse files Browse the repository at this point in the history
  • Loading branch information
VinayKumarHavanur authored Jan 24, 2025
1 parent 6941b07 commit 323b105
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions storage_drivers/ontap/api/ontap_zapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -2984,26 +2984,22 @@ func (c Client) NetInterfaceGetDataLIFs(ctx context.Context, protocol string) ([
return dataLIFs, nil
}

func (c Client) NetFcpInterfaceGet() (*azgo.FcpInterfaceGetIterResponse, error) {
response, err := azgo.NewFcpInterfaceGetIterRequest().
SetMaxRecords(DefaultZapiRecords).
SetQuery(azgo.FcpInterfaceGetIterRequestQuery{
FcpInterfaceInfoPtr: &azgo.FcpInterfaceInfoType{},
}).ExecuteUsing(c.zr)

return response, err
}

func (c Client) NetFcpInterfaceGetDataLIFs(ctx context.Context, protocol string) ([]string, error) {
lifResponse, err := c.NetFcpInterfaceGet()
lifResponse, err := c.NetInterfaceGet()
if err = azgo.GetError(ctx, lifResponse, err); err != nil {
return nil, fmt.Errorf("error checking network interfaces: %v", err)
}

dataLIFs := make([]string, 0)
if lifResponse.Result.AttributesListPtr != nil {
for _, attrs := range lifResponse.Result.AttributesListPtr.FcpInterfaceInfoPtr {
dataLIFs = append(dataLIFs, attrs.PortName())
for _, attrs := range lifResponse.Result.AttributesListPtr.NetInterfaceInfoPtr {
if attrs.OperationalStatus() == LifOperationalStatusUp {
for _, proto := range attrs.DataProtocols().DataProtocolPtr {
if proto == protocol {
dataLIFs = append(dataLIFs, attrs.Wwpn())
}
}
}
}
}

Expand Down

0 comments on commit 323b105

Please sign in to comment.