Skip to content

Commit

Permalink
Release v1.5.0 (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
kumarrprashant2005 authored Jun 17, 2021
1 parent fff149b commit 44a95ce
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 7 deletions.
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
c.out

# editor and IDE paraphernalia
.idea
*.swp
*.swo
*~

62 changes: 60 additions & 2 deletions VolumeReplication.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
const (
XRDFGroup = "/rdf_group"
ASYNC = "ASYNC"
METRO = "METRO"
)

// GetRDFGroup returns RDF group information given the RDF group number
Expand Down Expand Up @@ -119,6 +120,40 @@ func (c *Client) ExecuteReplicationActionOnSG(symID, action, storageGroup, rdfGr
Action: action,
ExecutionOption: types.ExecutionOptionSynchronous,
}
case "Failback":
actionParam := &types.Failback{
Force: force,
SymForce: false,
Star: false,
Hop2: false,
Bypass: false,
Remote: false,
RecoverPoint: false,
}
modifyParam = &types.ModifySGRDFGroup{
Failback: actionParam,
Action: action,
ExecutionOption: types.ExecutionOptionSynchronous,
}
case "Failover":
actionParam := &types.Failover{
Force: force,
SymForce: false,
Star: false,
Hop2: false,
Bypass: false,
Remote: false,
Immediate: false,
ConsExempt: exemptConsistency,
MetroBias: false,
Establish: false,
Restore: false,
}
modifyParam = &types.ModifySGRDFGroup{
Failover: actionParam,
Action: action,
ExecutionOption: types.ExecutionOptionSynchronous,
}
default:
return fmt.Errorf("not a supported action on a protected storage group")
}
Expand All @@ -142,7 +177,8 @@ func (c *Client) ExecuteReplicationActionOnSG(symID, action, storageGroup, rdfGr
func (c *Client) GetCreateSGReplicaPayload(remoteSymID string, rdfMode string, rdfgNo int, remoteSGName string, remoteServiceLevel string, establish bool) *types.CreateSGSRDF {

var payload *types.CreateSGSRDF
if rdfMode == ASYNC {
switch rdfMode {
case ASYNC:
payload = &types.CreateSGSRDF{
ReplicationMode: "Asynchronous",
RemoteSLO: remoteServiceLevel,
Expand All @@ -152,6 +188,17 @@ func (c *Client) GetCreateSGReplicaPayload(remoteSymID string, rdfMode string, r
Establish: establish,
ExecutionOption: types.ExecutionOptionSynchronous,
}
case METRO:
payload = &types.CreateSGSRDF{
ReplicationMode: "Active",
RemoteSLO: remoteServiceLevel,
RemoteSymmID: remoteSymID,
RdfgNumber: rdfgNo,
RemoteStorageGroupName: remoteSGName,
Establish: establish,
MetroBias: true,
ExecutionOption: types.ExecutionOptionSynchronous,
}
}
return payload
}
Expand Down Expand Up @@ -189,7 +236,8 @@ func (c *Client) CreateSGReplica(symID, remoteSymID, rdfMode, rdfGroupNo, source
func (c *Client) GetCreateRDFPairPayload(devList types.LocalDeviceListCriteria, rdfMode, rdfType string, establish, exemptConsistency bool) *types.CreateRDFPair {

var payload *types.CreateRDFPair
if rdfMode == ASYNC {
switch rdfMode {
case ASYNC:
payload = &types.CreateRDFPair{
RdfMode: "Asynchronous",
RdfType: rdfType,
Expand All @@ -198,6 +246,16 @@ func (c *Client) GetCreateRDFPairPayload(devList types.LocalDeviceListCriteria,
LocalDeviceListCriteria: &devList,
ExecutionOption: types.ExecutionOptionSynchronous,
}
case METRO:
payload = &types.CreateRDFPair{
RdfMode: "Active",
RdfType: "RDF1",
Bias: true,
Establish: establish,
Exempt: exemptConsistency,
LocalDeviceListCriteria: &devList,
ExecutionOption: types.ExecutionOptionSynchronous,
}
}
return payload
}
Expand Down
11 changes: 11 additions & 0 deletions authenticate.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ type Client struct {
api api.Client
allowedArrays []string
version string
symmetrixID string
}

var (
Expand Down Expand Up @@ -185,6 +186,13 @@ func NewClientWithArgs(
return client, nil
}

// WithSymmetrixID sets the default array for the client
func (c *Client) WithSymmetrixID(symmetrixID string) Pmax {
client := *c
client.symmetrixID = symmetrixID
return &client
}

func (c *Client) getDefaultHeaders() map[string]string {
headers := make(map[string]string)
headers["Accept"] = accHeader
Expand All @@ -194,5 +202,8 @@ func (c *Client) getDefaultHeaders() map[string]string {
headers["Content-Type"] = conHeader
basicAuthString := basicAuth(c.configConnect.Username, c.configConnect.Password)
headers["Authorization"] = "Basic " + basicAuthString
if c.symmetrixID != "" {
headers["symid"] = c.symmetrixID
}
return headers
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/dell/gopowermax

go 1.12
go 1.16

require (
github.com/cucumber/godog v0.10.0
Expand Down
4 changes: 4 additions & 0 deletions interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ type Pmax interface {
// Authenticate causes authentication and tests the connection
Authenticate(configConnect *ConfigConnect) error

// WithSymmetrixID set a default symmetrix ID for the admin client,
// for it to be added to the request header.
WithSymmetrixID(symmetrixID string) Pmax

// SLO provisioning are the methods for SLO provisioning. All the methods requre a
// symID to identify the Symmetrix.

Expand Down
36 changes: 32 additions & 4 deletions types/v90/Replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,12 @@ type Resume struct {

// ModifySGRDFGroup holds parameters for rdf storage group updates
type ModifySGRDFGroup struct {
Action string `json:"action"`
Suspend *Suspend `json:"suspend,omitempty"`
Resume *Resume `json:"resume,omitempty"`
ExecutionOption string `json:"executionOption"`
Action string `json:"action"`
Suspend *Suspend `json:"suspend,omitempty"`
Resume *Resume `json:"resume,omitempty"`
Failback *Failback `json:"failback,omitempty"`
Failover *Failover `json:"failover,omitempty"`
ExecutionOption string `json:"executionOption"`
}

// CreateSGSRDF contains parameters to create storage group replication {in u4p a.k.a "storageGroupSrdfCreate"}
Expand Down Expand Up @@ -196,3 +198,29 @@ type StorageGroupRDFG struct {
States []string `json:"states"`
Modes []string `json:"modes"`
}

// Failover action
type Failover struct {
Force bool `json:"force"`
SymForce bool `json:"symForce"`
Star bool `json:"star"`
Hop2 bool `json:"hop2"`
Bypass bool `json:"bypass"`
Immediate bool `json:"immediate"`
ConsExempt bool `json:"consExempt"`
MetroBias bool `json:"metroBias"`
Establish bool `json:"establish"`
Restore bool `json:"restore"`
Remote bool `json:"remote"`
}

// Failback action
type Failback struct {
Force bool `json:"force"`
SymForce bool `json:"symForce"`
Star bool `json:"star"`
Hop2 bool `json:"hop2"`
Bypass bool `json:"bypass"`
Remote bool `json:"remote"`
RecoverPoint bool `json:"recoverPoint"`
}

0 comments on commit 44a95ce

Please sign in to comment.