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

Create/Delete Metro Volume Group #134

Merged
merged 11 commits into from
Sep 24, 2024
2 changes: 2 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,9 @@ type Client interface {
GetVolumeGroupSnapshotByName(ctx context.Context, snapName string) (VolumeGroup, error)
GetMaxVolumeSize(ctx context.Context) (int64, error)
ConfigureMetroVolume(ctx context.Context, id string, config *MetroConfig) (resp MetroSessionResponse, err error)
ConfigureMetroVolumeGroup(ctx context.Context, id string, config *MetroConfig) (resp MetroSessionResponse, err error)
EndMetroVolume(ctx context.Context, id string, options *EndMetroVolumeOptions) (resp EmptyResponse, err error)
EndMetroVolumeGroup(ctx context.Context, id string, options *EndMetroVolumeGroupOptions) (resp EmptyResponse, err error)
}

// ClientIMPL provides basic API client implementation
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/oklog/ulid v1.3.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/stretchr/objx v0.5.2 // indirect
go.mongodb.org/mongo-driver v1.16.1 // indirect
go.mongodb.org/mongo-driver v1.17.0 // indirect
golang.org/x/sys v0.25.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
go.mongodb.org/mongo-driver v1.16.1 h1:rIVLL3q0IHM39dvE+z2ulZLp9ENZKThVfuvN/IiN4l8=
go.mongodb.org/mongo-driver v1.16.1/go.mod h1:oB6AhJQvFQL4LEHyXi6aJzQJtBiTQHiAd83l0GdFaiw=
go.mongodb.org/mongo-driver v1.17.0 h1:Hp4q2MCjvY19ViwimTs00wHi7G4yzxh4/2+nTx8r40k=
go.mongodb.org/mongo-driver v1.17.0/go.mod h1:wwWm/+BuOddhcq3n68LKRmgk2wXzmF6s0SFOa0GINL4=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
Expand Down
23 changes: 23 additions & 0 deletions inttests/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,3 +85,26 @@ func Includes(list *[]string, target string) bool {
}
return false
}

// GetRemoteSystemForMetro queries the source PowerStore array for configured remote systems
// to find a remote system capable of metro replication and returns the system if one is found
// and an empty RemoteSystem struct otherwise.
func GetRemoteSystemForMetro(client gopowerstore.Client, t *testing.T) gopowerstore.RemoteSystem {
systems, err := client.GetAllRemoteSystems(context.Background())
if err != nil {
t.Skip("Could not get remote systems. Skipping test...")
}

// try to find a valid remote system with Metro from the list of all available remote systems
for _, sys := range systems {
// check remote capabilities for metro and create MetroConfig if found
if Includes(&sys.Capabilities, string(gopowerstore.BlockMetro)) {
// make sure the connection is in a good state
if sys.DataConnectionState == string(gopowerstore.ConnStateOK) {
return sys
}
}
}

return gopowerstore.RemoteSystem{}
}
15 changes: 9 additions & 6 deletions inttests/metrics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,25 @@ func Test_PerformanceMetricsSmb2BuiltinclientByNode(t *testing.T) {
func Test_PerformanceMetricsNfsByNode(t *testing.T) {
resp, err := C.PerformanceMetricsNfsByNode(context.Background(), "N1", gopowerstore.FiveMins)
checkAPIErr(t, err)
assert.NotEmpty(t, resp)
assert.Equal(t, "performance_metrics_nfs_by_node", resp[0].Entity)
if assert.NotEmpty(t, resp) {
assert.Equal(t, "performance_metrics_nfs_by_node", resp[0].Entity)
}
}

func Test_PerformanceMetricsNfsv3ByNode(t *testing.T) {
resp, err := C.PerformanceMetricsNfsv3ByNode(context.Background(), "N1", gopowerstore.FiveMins)
checkAPIErr(t, err)
assert.NotEmpty(t, resp)
assert.Equal(t, "performance_metrics_nfsv3_by_node", resp[0].Entity)
if assert.NotEmpty(t, resp) {
assert.Equal(t, "performance_metrics_nfsv3_by_node", resp[0].Entity)
}
}

func Test_PerformanceMetricsNfsv4ByNode(t *testing.T) {
resp, err := C.PerformanceMetricsNfsv4ByNode(context.Background(), "N1", gopowerstore.FiveMins)
checkAPIErr(t, err)
assert.NotEmpty(t, resp)
assert.Equal(t, "performance_metrics_nfsv4_by_node", resp[0].Entity)
if assert.NotEmpty(t, resp) {
assert.Equal(t, "performance_metrics_nfsv4_by_node", resp[0].Entity)
}
}

func Test_WearMetricsByDrive(t *testing.T) {
Expand Down
Loading