From 4ea74ce05e81ad13df012e424fd9349214387f64 Mon Sep 17 00:00:00 2001 From: delldubey Date: Mon, 21 Nov 2022 17:23:32 +0530 Subject: [PATCH] Adds RDFG number in ExpandVolume (#34) --- interface.go | 42 +++++++++++++++++--------------- inttest/pmax_integration_test.go | 2 +- sloprovisioning.go | 7 +++++- unit_steps_test.go | 2 +- 4 files changed, 30 insertions(+), 23 deletions(-) diff --git a/interface.go b/interface.go index 8899cdc..8017530 100644 --- a/interface.go +++ b/interface.go @@ -118,11 +118,11 @@ type Pmax interface { // This method creates a job and waits on the job to complete. CreateVolumeInStorageGroup(ctx context.Context, symID string, storageGroupID string, volumeName string, sizeInCylinders int) (*types.Volume, error) - // CreateVolumeInStorageGroup takes simplified input arguments to create a volume of a give name and size in a particular storage group. - // This is done synchronously and no jobs are created. HTTP header argument is optional + //CreateVolumeInStorageGroupS takes simplified input arguments to create a volume of a give name and size in a particular storage group. + //This is done synchronously and no jobs are created. HTTP header argument is optional CreateVolumeInStorageGroupS(ctx context.Context, symID, storageGroupID string, volumeName string, sizeInCylinders int, opts ...http.Header) (*types.Volume, error) - // CreateVolumeInProtectedStorageGroup takes simplified input arguments to create a volume of a give name and size in a protected storage group. + // CreateVolumeInProtectedStorageGroupS takes simplified input arguments to create a volume of a give name and size in a protected storage group. // This will add volume in both Local and Remote Storage group // This is done synchronously and no jobs are created. HTTP header argument is optional CreateVolumeInProtectedStorageGroupS(ctx context.Context, symID, remoteSymID, storageGroupID string, remoteStorageGroupID string, volumeName string, sizeInCylinders int, opts ...http.Header) (*types.Volume, error) @@ -133,30 +133,32 @@ type Pmax interface { // DeleteMaskingView deletes a masking view given a masking view id DeleteMaskingView(ctx context.Context, symID string, maskingViewID string) error - // Get the list of Storage Pools + //GetStoragePoolList Gets the list of Storage Pools GetStoragePoolList(ctx context.Context, symID string) (*types.StoragePoolList, error) - // Rename a Volume given the volumeID + //RenameVolume Renames a Volume given the volumeID RenameVolume(ctx context.Context, symID string, volumeID string, newName string) (*types.Volume, error) - // Add volume(s) asynchronously to a StorageGroup + //AddVolumesToStorageGroup Adds volume(s) asynchronously to a StorageGroup AddVolumesToStorageGroup(ctx context.Context, symID, storageGroupID string, force bool, volumeIDs ...string) error - // Add volume(s) synchronously to a StorageGroup + + //AddVolumesToStorageGroupS Adds volume(s) synchronously to a StorageGroup // This is a blocking call and will only return once the volumes have been added to storage group AddVolumesToStorageGroupS(ctx context.Context, symID, storageGroupID string, force bool, volumeIDs ...string) error - // Adds one or more volumes (given by their volumeIDs) to a Protected StorageGroup + + //AddVolumesToProtectedStorageGroup Adds one or more volumes (given by their volumeIDs) to a Protected StorageGroup AddVolumesToProtectedStorageGroup(ctx context.Context, symID, storageGroupID, remoteSymID, remoteStorageGroupID string, force bool, volumeIDs ...string) error - // Remove volume(s) synchronously from a StorageGroup + //RemoveVolumesFromStorageGroup Remove volume(s) synchronously from a StorageGroup RemoveVolumesFromStorageGroup(ctx context.Context, symID string, storageGroupID string, force bool, volumeIDs ...string) (*types.StorageGroup, error) // RemoveVolumesFromProtectedStorageGroup removes one or more volumes (given by their volumeIDs) from a Protected StorageGroup. RemoveVolumesFromProtectedStorageGroup(ctx context.Context, symID string, storageGroupID, remoteSymID, remoteStorageGroupID string, force bool, volumeIDs ...string) (*types.StorageGroup, error) - // Initiate a job to remove storage space from the volume. + //InitiateDeallocationOfTracksFromVolume Initiate a job to remove storage space from the volume. InitiateDeallocationOfTracksFromVolume(ctx context.Context, symID string, volumeID string) (*types.Job, error) - // Deletes a volume + //DeleteVolume Deletes a volume DeleteVolume(ctx context.Context, symID string, volumeID string) error // GetMaskingViewList returns a list of the MaskingView names. @@ -176,7 +178,7 @@ type Pmax interface { // CreatePortGroup creates a port group given the Port Group id and a list of dir/port ids CreatePortGroup(ctx context.Context, symID string, portGroupID string, dirPorts []types.PortKey) (*types.PortGroup, error) - // System + //GetSymmetrixIDList gets all the symmetrix systems GetSymmetrixIDList(ctx context.Context) (*types.SymmetrixIDList, error) GetSymmetrixByID(ctx context.Context, id string) (*types.Symmetrix, error) @@ -266,17 +268,17 @@ type Pmax interface { // GetPrivVolumeByID returns a Volume structure given the symmetrix and volume ID (volume ID is in WWN format) GetPrivVolumeByID(ctx context.Context, symID string, volumeID string) (*types.VolumeResultPrivate, error) - // Delete PortGroup + //DeletePortGroup Deletes a PortGroup DeletePortGroup(ctx context.Context, symID string, portGroupID string) error - // Update PortGroup + //UpdatePortGroup Updates a PortGroup UpdatePortGroup(ctx context.Context, symID string, portGroupID string, ports []types.PortKey) (*types.PortGroup, error) - // Expand the size of an existing volume - ExpandVolume(ctx context.Context, symID string, volumeID string, newSizeCYL int) (*types.Volume, error) + //ExpandVolume Expands the size of an existing volume + ExpandVolume(ctx context.Context, symID string, volumeID string, rdfgNo int, newSizeCYL int) (*types.Volume, error) GetCreateVolInSGPayload(sizeInCylinders int, volumeName string, isSync bool, remoteSymID, storageGroupID string, opts ...http.Header) (payload interface{}) //GetCreateVolInSGPayloadWithMetaDataHeaders(sizeInCylinders int, volumeName string, isSync bool, remoteSymID, remoteStorageGroupID string, metadata http.Header) (payload interface{}) - // Fetches RDF group information + //GetRDFGroup Fetches RDF group information GetRDFGroup(ctx context.Context, symID, rdfGroup string) (*types.RDFGroup, error) // GetProtectedStorageGroup returns protected storage group given the storage group ID GetProtectedStorageGroup(ctx context.Context, symID, storageGroup string) (*types.RDFStorageGroup, error) @@ -284,10 +286,10 @@ type Pmax interface { CreateSGReplica(ctx context.Context, symID, remoteSymID, rdfMode, rdfGroupNo, sourceSG, remoteSGName, remoteServiceLevel string, bias bool) (*types.SGRDFInfo, error) // ExecuteReplicationActionOnSG executes supported replication based actions on the protected SG ExecuteReplicationActionOnSG(ctx context.Context, symID, action, storageGroup, rdfGroup string, force, exemptConsistency, bias bool) error - // Creates a volume replication pair + //CreateRDFPair Creates a volume replication pair CreateRDFPair(ctx context.Context, symID, rdfGroupNo, deviceID, rdfMode, rdfType string, establish, exemptConsistency bool) (*types.RDFDevicePairList, error) - /// GetRDFDevicePairInfo returns RDF volume information + //GetRDFDevicePairInfo returns RDF volume information GetRDFDevicePairInfo(ctx context.Context, symID, rdfGroup, volumeID string) (*types.RDFDevicePair, error) - // GetStorageGroupRDFInfo returns the of RDF info of protected storage group + //GetStorageGroupRDFInfo returns the of RDF info of protected storage group GetStorageGroupRDFInfo(ctx context.Context, symID, sgName, rdfGroupNo string) (*types.StorageGroupRDFG, error) } diff --git a/inttest/pmax_integration_test.go b/inttest/pmax_integration_test.go index 1f8c97c..a5b6374 100644 --- a/inttest/pmax_integration_test.go +++ b/inttest/pmax_integration_test.go @@ -1495,7 +1495,7 @@ func TestExpandVolume(t *testing.T) { //expand Volume expandedSize := 30 fmt.Println("Doing VolumeExpansion") - expandedVol, err := client.ExpandVolume(context.TODO(), symmetrixID, vol.VolumeID, expandedSize) + expandedVol, err := client.ExpandVolume(context.TODO(), symmetrixID, vol.VolumeID, 0, expandedSize) if err != nil { t.Error("Error in Volume Expansion: " + err.Error()) return diff --git a/sloprovisioning.go b/sloprovisioning.go index cbdaadf..d893178 100644 --- a/sloprovisioning.go +++ b/sloprovisioning.go @@ -608,7 +608,7 @@ func (c *Client) CreateVolumeInProtectedStorageGroupS(ctx context.Context, symID } // ExpandVolume expands an existing volume to a new (larger) size in CYL -func (c *Client) ExpandVolume(ctx context.Context, symID string, volumeID string, newSizeCYL int) (*types.Volume, error) { +func (c *Client) ExpandVolume(ctx context.Context, symID string, volumeID string, rdfgNo int, newSizeCYL int) (*types.Volume, error) { payload := &types.EditVolumeParam{ EditVolumeActionParam: types.EditVolumeActionParam{ ExpandVolumeParam: &types.ExpandVolumeParam{ @@ -620,6 +620,11 @@ func (c *Client) ExpandVolume(ctx context.Context, symID string, volumeID string }, } + if rdfgNo > 0 { + // This expansion is for replicated volume + payload.EditVolumeActionParam.ExpandVolumeParam.RDFGroupNumber = rdfgNo + } + payload.ExecutionOption = types.ExecutionOptionSynchronous ifDebugLogPayload(payload) ctx, cancel := c.GetTimeoutContext(ctx) diff --git a/unit_steps_test.go b/unit_steps_test.go index afe3802..5afa67b 100644 --- a/unit_steps_test.go +++ b/unit_steps_test.go @@ -473,7 +473,7 @@ func (c *unitContext) iExpandVolumeToSize(volumeID string, sizeStr string) error } if size, err := strconv.Atoi(sizeStr); err == nil { - c.vol, c.err = c.client.ExpandVolume(context.TODO(), symID, volumeID, size) + c.vol, c.err = c.client.ExpandVolume(context.TODO(), symID, volumeID, 0, size) } else { return err }