Skip to content
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

Added API to GetNVMeTCP targets #122

Merged
merged 3 commits into from
Jan 23, 2024
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
1 change: 1 addition & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ type Client interface {
DetachVolumeFromHost(ctx context.Context, hostID string, detachParams *HostVolumeDetach) (EmptyResponse, error)
DetachVolumeFromHostGroup(ctx context.Context, hostGroupID string, detachParams *HostVolumeDetach) (EmptyResponse, error)
GetStorageISCSITargetAddresses(ctx context.Context) ([]IPPoolAddress, error)
GetStorageNVMETCPTargetAddresses(ctx context.Context) ([]IPPoolAddress, error)
GetCapacity(ctx context.Context) (int64, error)
GetFCPorts(ctx context.Context) (resp []FcPort, err error)
GetFCPort(ctx context.Context, id string) (resp FcPort, err error)
Expand Down
26 changes: 26 additions & 0 deletions ip_pool_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,29 @@ func (c *ClientIMPL) GetStorageISCSITargetAddresses(
}
return resp, nil
}

// GetStorageNVMETCPTargetAddresses returns a list of PowerStore NVME/TCP targets ip addresses
func (c *ClientIMPL) GetStorageNVMETCPTargetAddresses(
ctx context.Context,
) (resp []IPPoolAddress, err error) {
var ipPoolAddress IPPoolAddress
qp := c.APIClient().QueryParamsWithFields(&ipPoolAddress)
qp.RawArg("purposes", fmt.Sprintf("cs.{%s}", IPPurposeTypeEnumStorageNVMETCPPort))
qp.Order("id")
_, err = c.APIClient().Query(
ctx,
RequestConfig{
Method: "GET",
Endpoint: apiPoolAddressURL,
QueryParams: qp,
},
&resp)
err = WrapErr(err)
if err != nil {
return resp, err
}
if len(resp) == 0 {
return resp, errors.New("can't get NVMeTCP target address")
}
return resp, nil
}
2 changes: 2 additions & 0 deletions ip_pool_address_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const (
IPPurposeTypeEnumStorageIscsiInitiator IPPurposeTypeEnum = "Storage_Iscsi_Initiator"
// IPPurposeTypeEnumStorageIscsiTarget captures enum value "Storage_Iscsi_Target"
IPPurposeTypeEnumStorageIscsiTarget IPPurposeTypeEnum = "Storage_Iscsi_Target"
// IPPurposeTypeEnumStorageNVMETCPPort captures enum value "Storage_NVMe_TCP_Port"
IPPurposeTypeEnumStorageNVMETCPPort IPPurposeTypeEnum = "Storage_NVMe_TCP_Port"
// IPPurposeTypeEnumStorageClusterFloating captures enum value "Storage_Cluster_Floating"
IPPurposeTypeEnumStorageClusterFloating IPPurposeTypeEnum = "Storage_Cluster_Floating"
// IPPurposeTypeEnumICDNode captures enum value "ICD_Node"
Expand Down
32 changes: 31 additions & 1 deletion mocks/Client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mocks/FieldProvider.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mocks/Logger.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mocks/QueryParamsEncoder.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mocks/RequestConfigRenderer.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mocks/TimeoutSemaphoreInterface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion mocks/Traceable.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion replication_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const (
RsStatePausedForNdu RSStateEnum = "Paused_For_NDU"
RsStateResuming RSStateEnum = "Resuming"
RsStateFailingOver RSStateEnum = "Failing_Over"
RsStateFailingOverForDr RSStateEnum = "Failing_Over_For_DR"
RsStateFailingOverForDR RSStateEnum = "Failing_Over_For_DR"
RsStateFailedOver RSStateEnum = "Failed_Over"
RsStateReprotecting RSStateEnum = "Reprotecting"
RsStatePartialCutoverForMigration RSStateEnum = "Partial_Cutover_For_Migration"
Expand Down
Loading