Skip to content

Commit

Permalink
Merge pull request #17 from dell/release1.5.1
Browse files Browse the repository at this point in the history
Release v1.5.1
  • Loading branch information
jooseppi-luna authored Aug 27, 2021
2 parents f37a9d5 + 52075a6 commit 6c92387
Show file tree
Hide file tree
Showing 16 changed files with 314 additions and 101 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ LABEL vendor="Dell Inc." \
name="csi-powerflex" \
summary="CSI Driver for Dell EMC PowerFlex" \
description="CSI Driver for provisioning persistent storage from Dell EMC PowerFlex" \
version="1.5.0" \
version="1.5.1" \
license="Apache-2.0"
COPY ./licenses /licenses
5 changes: 5 additions & 0 deletions env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export ALT_GUID=
#Debug variables for goscaleio library
export GOSCALEIO_SHOWHTTP="true"

#If you put the system ID in your config.json, put the
#system's name here, and vice versa. If your instance does not have a name,
#leave this variable blank.
export ALT_SYSTEM_ID=""

MDM=`grep mdm ../../config.json | awk -F":" '{print $2}'`
for i in $MDM
do
Expand Down
4 changes: 2 additions & 2 deletions helm/csi-vxflexos/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: csi-vxflexos
version: 1.5.0
appVersion: 1.5.0
version: 1.5.1
appVersion: 1.5.1
apiVersion: v2
description: |
VxFlex OS CSI (Container Storage Interface) driver Kubernetes
Expand Down
2 changes: 1 addition & 1 deletion helm/csi-vxflexos/driver-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# IT IS RECOMMENDED YOU DO NOT CHANGE THE IMAGES TO BE USED.
images:
# "driver" defines the container image, used for the driver container.
driver: dellemc/csi-vxflexos:v1.5.0
driver: dellemc/csi-vxflexos:v1.5.1


# "powerflexSdc" defines the SDC image for init container.
Expand Down
2 changes: 1 addition & 1 deletion k8sutils/k8sutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func CreateKubeClientSet(kubeconfig string) (*kubernetes.Clientset, error) {
return clientset, nil
}

// LeaderElection
//LeaderElection setup
func LeaderElection(clientset *kubernetes.Clientset, lockName string, namespace string, runFunc func(ctx context.Context)) {
le := leaderelection.NewLeaderElection(clientset, lockName, runFunc)
le.WithNamespace(namespace)
Expand Down
88 changes: 63 additions & 25 deletions service/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,12 @@ func (s *service) CreateVolume(
}

sName := ""
if s.opts.defaultSystemID == systemID {
// if default system, we will also check name match with topology (backward compatibility)
sName = s.systems[systemID].System.Name
}

//We need to get name of system, in case sc was set up to use name
sName = s.systems[systemID].System.Name

segments := accessibility.GetPreferred()[0].GetSegments()

for key := range segments {
if strings.HasPrefix(key, Name) {
tokens := strings.Split(key, "/")
Expand All @@ -144,12 +144,18 @@ func (s *service) CreateVolume(
constraint = tokens[1]
}
Log.Printf("Found topology constraint: VxFlex OS system: %s", constraint)

if constraint == sID || constraint == sName {
requestedSystem = sID
// segment matches system ID/Name where volume will be created
systemSegments[key] = segments[key]
if constraint == sID {
requestedSystem = sID
} else {
requestedSystem = sName
}
//segment matches system ID/Name where volume will be created
topologyKey := tokens[0] + "/" + sID
systemSegments[topologyKey] = segments[key]
Log.Printf("Added accessible topology segment for volume: %s, segment: %s = %s", req.GetName(),
key, systemSegments[key])
topologyKey, systemSegments[topologyKey])
}
}
}
Expand Down Expand Up @@ -344,8 +350,14 @@ func (s *service) getSystemIDFromParameters(params map[string]string) (string, e
return "", status.Errorf(codes.FailedPrecondition, "No system ID is found in parameters or as default")
}
}
Log.Printf("getSystemIDFromParameters system %s", systemID)

Log.Printf("getSystemIDFromParameters got system %s", systemID)
// if name set for array.SystemID use id instead
// names can change , id will remain unique
if id, ok := s.connectedSystemNameToID[systemID]; ok {
systemID = id
}
Log.Printf("Use systemID as %s", systemID)
return systemID, nil
}

Expand All @@ -356,7 +368,7 @@ func (s *service) createVolumeFromSnapshot(req *csi.CreateVolumeRequest,
name string, sizeInKbytes int64, storagePool string) (*csi.CreateVolumeResponse, error) {

// get systemID from snapshot source CSI id
systemID := getSystemIDFromCsiVolumeID(snapshotSource.SnapshotId)
systemID := s.getSystemIDFromCsiVolumeID(snapshotSource.SnapshotId)
if systemID == "" {
// use default system
systemID = s.opts.defaultSystemID
Expand Down Expand Up @@ -523,7 +535,7 @@ func (s *service) DeleteVolume(
}

// get systemID from req
systemID := getSystemIDFromCsiVolumeID(csiVolID)
systemID := s.getSystemIDFromCsiVolumeID(csiVolID)
if systemID == "" {
// use default system
systemID = s.opts.defaultSystemID
Expand Down Expand Up @@ -618,7 +630,7 @@ func (s *service) ControllerPublishVolume(
}

// get systemID from req
systemID := getSystemIDFromCsiVolumeID(csiVolID)
systemID := s.getSystemIDFromCsiVolumeID(csiVolID)
if systemID == "" {
// use default system
systemID = s.opts.defaultSystemID
Expand Down Expand Up @@ -796,7 +808,7 @@ func (s *service) ControllerUnpublishVolume(
*csi.ControllerUnpublishVolumeResponse, error) {

// get systemID from req
systemID := getSystemIDFromCsiVolumeID(req.GetVolumeId())
systemID := s.getSystemIDFromCsiVolumeID(req.GetVolumeId())
if systemID == "" {
// use default system
systemID = s.opts.defaultSystemID
Expand Down Expand Up @@ -899,7 +911,7 @@ func (s *service) ValidateVolumeCapabilities(
}

// get systemID from req
systemID := getSystemIDFromCsiVolumeID(csiVolID)
systemID := s.getSystemIDFromCsiVolumeID(csiVolID)
if systemID == "" {
// use default system
systemID = s.opts.defaultSystemID
Expand Down Expand Up @@ -1117,7 +1129,7 @@ func (s *service) ListSnapshots(
// Use systemID from csiSourceID if available, otherwise default systemID is used
systemID := s.opts.defaultSystemID
if csiSourceID != "" {
systemID = getSystemIDFromCsiVolumeID(csiSourceID)
systemID = s.getSystemIDFromCsiVolumeID(csiSourceID)
if systemID == "" {
// use default system
systemID = s.opts.defaultSystemID
Expand Down Expand Up @@ -1491,7 +1503,7 @@ func (s *service) systemProbeAll(ctx context.Context) error {
err := s.systemProbe(ctx, array)
systemID := array.SystemID
if err == nil {
Log.Infof("array %s probe successfully", systemID)
Log.Infof("array %s probed successfully", systemID)
allArrayFail = false
} else {
errMap[systemID] = err
Expand Down Expand Up @@ -1527,6 +1539,10 @@ func (s *service) systemProbe(ctx context.Context, array *ArrayConnectionData) e
return status.Error(codes.FailedPrecondition,
"missing VxFlexOS system name")
}
var altSystemNames []string
if array.AllSystemNames != "" {
altSystemNames = strings.Split(array.AllSystemNames, ",")
}

systemID := array.SystemID

Expand All @@ -1539,6 +1555,9 @@ func (s *service) systemProbe(ctx context.Context, array *ArrayConnectionData) e
"unable to create ScaleIO client: %s", err.Error())
}
s.adminClients[systemID] = c
for _, name := range altSystemNames {
s.adminClients[name] = c
}
}

if s.adminClients[systemID].GetToken() == "" {
Expand All @@ -1563,15 +1582,34 @@ func (s *service) systemProbe(ctx context.Context, array *ArrayConnectionData) e
"unable to find matching VxFlexOS system name: %s",
err.Error())
}

s.systems[systemID] = system
if system.System != nil && system.System.Name != "" {
Log.Printf("Found Name for system=%s with ID=%s", system.System.Name, system.System.ID)
s.connectedSystemNameToID[system.System.Name] = system.System.ID
s.systems[system.System.ID] = system
s.adminClients[system.System.ID] = s.adminClients[systemID]
}
// associate alternate system name to systemID
for _, name := range altSystemNames {
s.systems[name] = system
s.adminClients[name] = s.adminClients[systemID]
s.connectedSystemNameToID[name] = system.System.ID
}
}

sysID := systemID
if id, ok := s.connectedSystemNameToID[systemID]; ok {
Log.Printf("System with name %s found id: %s", systemID, id)
sysID = id
s.opts.arrays[sysID] = array
}
if array.IsDefault == true {
Log.Infof("default array is set to array ID: %s", systemID)
s.opts.defaultSystemID = systemID
Log.Printf("%s is the default array, skipping VolumePrefixToSystems map update. \n", systemID)
Log.Infof("default array is set to array ID: %s", sysID)
s.opts.defaultSystemID = sysID
Log.Printf("%s is the default array, skipping VolumePrefixToSystems map update. \n", sysID)
} else {
err := s.UpdateVolumePrefixToSystemsMap(systemID)
err := s.UpdateVolumePrefixToSystemsMap(sysID)
if err != nil {
return err
}
Expand Down Expand Up @@ -1623,7 +1661,7 @@ func (s *service) CreateSnapshot(
}

volID := getVolumeIDFromCsiVolumeID(csiVolID)
systemID := getSystemIDFromCsiVolumeID(csiVolID)
systemID := s.getSystemIDFromCsiVolumeID(csiVolID)

if systemID == "" {
// use default system
Expand Down Expand Up @@ -1708,7 +1746,7 @@ func (s *service) CreateSnapshot(
volIDs := strings.Split(volIDList, ",")
for _, v := range volIDs {
//neeed to trim space in case there are spaces inside VolumeIDList
consistencyGroupSystem := strings.TrimSpace(getSystemIDFromCsiVolumeID(v))
consistencyGroupSystem := strings.TrimSpace(s.getSystemIDFromCsiVolumeID(v))
if consistencyGroupSystem != "" && consistencyGroupSystem != systemID {
//system needs to be the same throughout snapshot consistency group, this is an error
err = status.Errorf(codes.Internal, "Consistency group needs to be on the same system but vol %s is not on system: %s ", v, systemID)
Expand Down Expand Up @@ -1789,7 +1827,7 @@ func (s *service) DeleteSnapshot(
return nil, status.Errorf(codes.InvalidArgument, "snapshot ID to be deleted is required")
}

systemID := getSystemIDFromCsiVolumeID(csiSnapID)
systemID := s.getSystemIDFromCsiVolumeID(csiSnapID)
if systemID == "" {
// use default system
systemID = s.opts.defaultSystemID
Expand Down Expand Up @@ -1926,7 +1964,7 @@ func (s *service) ControllerExpandVolume(ctx context.Context, req *csi.Controlle
}

volID := getVolumeIDFromCsiVolumeID(csiVolID)
systemID := getSystemIDFromCsiVolumeID(csiVolID)
systemID := s.getSystemIDFromCsiVolumeID(csiVolID)
if systemID == "" {
// use default system
systemID = s.opts.defaultSystemID
Expand Down Expand Up @@ -2018,7 +2056,7 @@ func (s *service) Clone(req *csi.CreateVolumeRequest,
volumeSource *csi.VolumeContentSource_VolumeSource, name string, sizeInKbytes int64, storagePool string) (*csi.CreateVolumeResponse, error) {

// get systemID from volume source CSI id
systemID := getSystemIDFromCsiVolumeID(volumeSource.VolumeId)
systemID := s.getSystemIDFromCsiVolumeID(volumeSource.VolumeId)
if systemID == "" {
// use default system
systemID = s.opts.defaultSystemID
Expand Down
8 changes: 4 additions & 4 deletions service/csi_extension_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func (s *service) ValidateVolumeHostConnectivity(ctx context.Context, req *podmo
systemID := req.GetArrayId()
if systemID == "" {
if len(req.GetVolumeIds()) > 0 {
systemID = getSystemIDFromCsiVolumeID(req.GetVolumeIds()[0])
systemID = s.getSystemIDFromCsiVolumeID(req.GetVolumeIds()[0])
}
if systemID == "" {
systemID = s.opts.defaultSystemID
Expand All @@ -60,7 +60,7 @@ func (s *service) ValidateVolumeHostConnectivity(ctx context.Context, req *podmo
for _, volID := range req.GetVolumeIds() {
// Probe system
prevSystemID := systemID
systemID = getSystemIDFromCsiVolumeID(volID)
systemID = s.getSystemIDFromCsiVolumeID(volID)
if systemID == "" {
systemID = s.opts.defaultSystemID
}
Expand Down Expand Up @@ -191,7 +191,7 @@ func checkCreationTime(time int64, snapshots []*volumeGroupSnapshot.Snapshot) er

func (s *service) getSystemID(req *volumeGroupSnapshot.CreateVolumeGroupSnapshotRequest) (string, error) {
//take first volume to calculate systemID. It is expected this systemID is consistent throughout
systemID := getSystemIDFromCsiVolumeID(req.SourceVolumeIDs[0])
systemID := s.getSystemIDFromCsiVolumeID(req.SourceVolumeIDs[0])
if systemID == "" {
// use default system
systemID = s.opts.defaultSystemID
Expand Down Expand Up @@ -237,7 +237,7 @@ func (s *service) buildSnapshotDefs(req *volumeGroupSnapshot.CreateVolumeGroupSn
snapshotDefs := make([]*siotypes.SnapshotDef, 0)

for index, id := range req.SourceVolumeIDs {
snapSystemID := strings.TrimSpace(getSystemIDFromCsiVolumeID(id))
snapSystemID := strings.TrimSpace(s.getSystemIDFromCsiVolumeID(id))
if snapSystemID != "" && snapSystemID != systemID {
err := status.Errorf(codes.Internal, "Source volumes for volume group snapshot should be on the same system but vol %s is not on system: %s", id, systemID)
Log.Errorf("Error from buildSnapshotDefs: %v \n", err)
Expand Down
18 changes: 16 additions & 2 deletions service/ephemeral.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,26 @@ func (s *service) ephemeralNodePublish(
systemName := req.VolumeContext["systemID"]

if systemName == "" {
Log.Debug("systemName not specified, using default array")
Log.Info("systemName not specified, using default array")
systemName = s.opts.defaultSystemID
}

array := s.opts.arrays[systemName]

if array == nil {
//to get inside this if block, req has name, but secret has ID, need to convert from name -> ID
if id, ok := s.connectedSystemNameToID[systemName]; ok {
//systemName was sent in req, but secret used ID. Change to ID.
Log.Debug("systemName set to id")
array = s.opts.arrays[id]
} else {
err = status.Errorf(codes.Internal, "systemID: %s not recgonized", systemName)
Log.Errorf("Error from ephemeralNodePublish: %v ", err)
return nil, err

}
}

err = s.systemProbe(ctx, array)

if err != nil {
Expand Down Expand Up @@ -129,7 +143,7 @@ func (s *service) ephemeralNodePublish(
volumeID := crvolresp.Volume.VolumeId

//in case systemName was not given with volume context
systemName = getSystemIDFromCsiVolumeID(volumeID)
systemName = s.getSystemIDFromCsiVolumeID(volumeID)

if systemName == "" {

Expand Down
4 changes: 1 addition & 3 deletions service/features/service.feature
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,6 @@ Feature: VxFlex OS CSI interface
| "none" | "test/tmp/datafile" | "none" |
| "CorrectFormatBadCsiVolIDInNodeExpand" | "test/tmp/datadir" | "is not configured in the driver" |
| "VolumeIDTooShortErrorInNodeExpand" | "test/tmp/datadir" | "is shorter than 3 chars, returning error" |
| "TooManyDashesVolIDInNodeExpand" | "test/tmp/datadir" | "volume ID is required" |

Scenario: Call NodeGetVolumeStats, should get unimplemented
Given a VxFlexOS service
Expand All @@ -716,7 +715,7 @@ Feature: VxFlex OS CSI interface
Scenario: Call getDefaultSystemName, should get error Unable to probe system with ID
Given a VxFlexOS service
When I call getDefaultSystemNameError
Then the error contains "Unable to probe system with ID"
Then the error contains "missing VxFlexOS system name"

Scenario: Call getDefaultSystemName, should get Found system Name: mocksystem
Given a VxFlexOS service
Expand All @@ -738,7 +737,6 @@ Feature: VxFlex OS CSI interface
When i Call getStoragePoolnameByID "123"
Then the error contains "cannot find storage pool"


Scenario: Call Node getAllSystems
Given a VxFlexOS service
When I Call nodeGetAllSystems
Expand Down
Loading

0 comments on commit 6c92387

Please sign in to comment.