Skip to content

Commit

Permalink
Adds powermax as driver, unit, int and scale test (#199)
Browse files Browse the repository at this point in the history
  • Loading branch information
delldubey authored May 14, 2024
1 parent 8aed5ed commit 7456c1c
Show file tree
Hide file tree
Showing 17 changed files with 797 additions and 12 deletions.
1 change: 1 addition & 0 deletions cmd/podmon/features/main.feature
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ Feature: Podmon Main
| "localhost" | "1234" | "--driverPath=vxflexos" | "leader election: true" |
| "localhost" | "1234" | "--driverPath=isilon" | "leader election: true" |
| "localhost" | "1234" | "--driverPath=powerstore" | "leader election: true" |
| "localhost" | "1234" | "--driverPath=powermax" | "leader election: true" |

Scenario Outline: Test using driver ConfigMap
Given a podmon instance
Expand Down
3 changes: 3 additions & 0 deletions cmd/podmon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ func main() {
case strings.Contains(*args.driverPath, "powerstore"):
log.Infof("CSI Driver for PowerStore")
monitor.Driver = new(monitor.PStoreDriver)
case strings.Contains(*args.driverPath, "powermax"):
log.Infof("CSI Driver for PowerMax")
monitor.Driver = new(monitor.PMaxDriver)
default:
log.Infof("CSI Driver for VxFlex OS")
monitor.Driver = new(monitor.VxflexDriver)
Expand Down
25 changes: 24 additions & 1 deletion internal/monitor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ powerstore-integration-test:
SCRIPTS_DIR="../../test/sh" \
go test -timeout 6h -test.v -test.run "^\QTestPowerStoreFirstCheck\E|\QTestPowerStoreIntegration\E"

powermax-integration-test:
RESILIENCY_INT_TEST="true" \
RESILIENCY_TEST_CLEANUP="true" \
POLL_K8S="true" \
SCRIPTS_DIR="../../test/sh" \
go test -timeout 6h -test.v -test.run "^\QTestPowerMaxFirstCheck\E|\QTestPowerMaxIntegration\E"

powerflex-short-integration-test:
RESILIENCY_SHORT_INT_TEST="true" \
Expand Down Expand Up @@ -86,6 +92,13 @@ powerstore-short-integration-test:
SCRIPTS_DIR="../../test/sh" \
go test -timeout 6h -test.v -test.run "^\QTestPowerStoreShortCheck\E|\QTestPowerStoreShortIntegration\E"

powermax-short-integration-test:
RESILIENCY_SHORT_INT_TEST="true" \
RESILIENCY_TEST_CLEANUP="true" \
POLL_K8S="true" \
SCRIPTS_DIR="../../test/sh" \
go test -timeout 6h -test.v -test.run "^\QTestPowerMaxShortCheck\E|\QTestPowerMaxShortIntegration\E"

powerflex-array-interface-test:
RESILIENCY_INT_TEST="true" \
RESILIENCY_TEST_CLEANUP="true" \
Expand All @@ -111,4 +124,14 @@ powerstore-array-interface-test:
INTERFACE_A=${INTERFACE1} \
INTERFACE_B=${INTERFACE2} \
INTERFACE_C=${INTERFACE3} \
go test -timeout 6h -test.v -test.run "^\QTestPowerStoreFirstCheck\E|\QTestPowerStoreArrayInterfaceDown\E"
go test -timeout 6h -test.v -test.run "^\QTestPowerStoreFirstCheck\E|\QTestPowerStoreArrayInterfaceDown\E"

powermax-array-interface-test:
RESILIENCY_INT_TEST="true" \
RESILIENCY_TEST_CLEANUP="true" \
POLL_K8S="true" \
SCRIPTS_DIR="../../test/sh" \
INTERFACE_A=${INTERFACE1} \
INTERFACE_B=${INTERFACE2} \
INTERFACE_C=${INTERFACE3} \
go test -timeout 6h -test.v -test.run "^\QTestPowerMaxFirstCheck\E|\QTestPowerMaxArrayInterfaceDown\E"
65 changes: 65 additions & 0 deletions internal/monitor/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,71 @@ func (d *PStoreDriver) FinalCleanup(_ bool, _, _, _ string) error {
return nil
}

// PMaxDriver provides a Driver instance for the PowerMax architecture.
type PMaxDriver struct{}

// GetDriverName returns the driver name string
func (d *PMaxDriver) GetDriverName() string {
return "powermax"
}

// GetDriverMountDir returns the mount directory used for a PV by a pod.
func (d *PMaxDriver) GetDriverMountDir(_, pvName, podUUID string) string {
privateMountDir := getPrivateMountDir("/var/lib/kubelet")
privateMountDir = fmt.Sprintf("%s/pods/%s/volumes/kubernetes.io~csi/%s/mount", privateMountDir, podUUID, pvName)
log.Debugf("privateMountDir: %s", privateMountDir)
return privateMountDir
}

// GetDriverBlockDev Returns the block device used for a PV by a pod.
func (d *PMaxDriver) GetDriverBlockDev(_, pvName, podUUID string) string {
privateMountDir := getPrivateMountDir("/var/lib/kubelet")
privateBlockDev := fmt.Sprintf("%s/plugins/kubernetes.io/csi/volumeDevices/publish/%s/%s", privateMountDir, pvName, podUUID)
log.Debugf("privateBlockDev: %s", privateBlockDev)
return privateBlockDev
}

// GetStagingMountDir Returns the staging directory used by NodeUnstage for a mount device.
func (d *PMaxDriver) GetStagingMountDir(_, pvName string) string {
privateMountDir := getPrivateMountDir("/var/lib/kubelet")
stagingMountDev := fmt.Sprintf("%s/plugins/kubernetes.io/csi/pv/%s/globalmount", privateMountDir, pvName)
log.Debugf("stagingMountDev: %s", stagingMountDev)
return stagingMountDev
}

// GetStagingMountDirAfter125 Returns the staging directory used by NodeUnstage for a mount device.
func (d *PMaxDriver) GetStagingMountDirAfter125(volumeHandle, _ string) string {
result := sha256.Sum256([]byte(fmt.Sprintf("%s", volumeHandle)))
volSha := fmt.Sprintf("%x", result)

stagingMountDir := fmt.Sprintf("/var/lib/kubelet/plugins/kubernetes.io/csi/csi-powermax.dellemc.com/%s/globalmount", volSha)
log.Debugf("stagingMountDev: %s", stagingMountDir)
return stagingMountDir
}

// GetStagingBlockDir Returns the staging directory used by NodeUnstage for a block device.
func (d *PMaxDriver) GetStagingBlockDir(_, pvName string) string {
privateMountDir := getPrivateMountDir("/var/lib/kubelet")
stagingBlockDir := fmt.Sprintf("%s/plugins/kubernetes.io/csi/volumeDevices/staging/%s", privateMountDir, pvName)
log.Debugf("stagingBlockDir: %s", stagingBlockDir)
return stagingBlockDir
}

// NodeUnpublishExcludedError filters out NodeUnpublish errors that should be excluded
func (d *PMaxDriver) NodeUnpublishExcludedError(_ error) bool {
return false
}

// NodeUnstageExcludedError filters out NodeStage errors that should be excluded
func (d *PMaxDriver) NodeUnstageExcludedError(_ error) bool {
return false
}

// FinalCleanup handles any driver specific final cleanup.
func (d *PMaxDriver) FinalCleanup(_ bool, _, _, _ string) error {
return nil
}

func getPrivateMountDir(defaultDir string) string {
privateMountDir := os.Getenv("X_CSI_PRIVATE_MOUNT_DIR")
if privateMountDir == "" {
Expand Down
Loading

0 comments on commit 7456c1c

Please sign in to comment.