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

Metro: Set default value for replication prefixes #417

Merged
merged 2 commits into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions service/features/service.feature
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,12 @@ Feature: PowerMax CSI interface
When I call BeforeServe with an invalid ClusterPrefix
Then the error contains "exceeds maximum length"

@v2.14.0
Scenario: Test BeforeServe
Given a PowerMax service
When I call BeforeServe
Then replication prefixes have default values

@v1.0.0
Scenario: Call ListVolumes, should get unimplemented
Given a PowerMax service
Expand Down
9 changes: 8 additions & 1 deletion service/service.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright © 2021 Dell Inc. or its subsidiaries. All Rights Reserved.
Copyright © 2021-2025 Dell Inc. or its subsidiaries. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -68,6 +68,8 @@ const (
CSILogFormatParam = "CSI_LOG_FORMAT"
ArrayStatus = "/array-status"
DefaultPodmonPollRate = 60
ReplicationContextPrefix = "powermax"
ReplicationPrefix = "replication.storage.dell.com"
PortGroups = "X_CSI_POWERMAX_PORTGROUPS"
Protocol = "X_CSI_TRANSPORT_PROTOCOL"
// PmaxEndPoint = "X_CSI_POWERMAX_ENDPOINT"
Expand Down Expand Up @@ -424,11 +426,16 @@ func (s *service) BeforeServe(
opts.KubeConfigPath = kubeConfigPath
}

// set default values for replication prefix since replicator sidecar is not needed for Metro feature.
if replicationContextPrefix, ok := csictx.LookupEnv(ctx, EnvReplicationContextPrefix); ok {
opts.ReplicationContextPrefix = replicationContextPrefix
} else {
opts.ReplicationContextPrefix = ReplicationContextPrefix
}
if replicationPrefix, ok := csictx.LookupEnv(ctx, EnvReplicationPrefix); ok {
opts.ReplicationPrefix = replicationPrefix
} else {
opts.ReplicationPrefix = ReplicationPrefix
}

if MaxVolumesPerNode, ok := csictx.LookupEnv(ctx, EnvMaxVolumesPerNode); ok {
Expand Down
2 changes: 1 addition & 1 deletion service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func TestGoDog(t *testing.T) {
runOptions := godog.Options{
Format: "pretty",
Paths: []string{"features"},
Tags: "v1.0.0, v1.1.0, v1.2.0, v1.3.0, v1.4.0, v1.5.0, v1.6.0, v2.2.0, v2.3.0, v2.4.0, v2.5.0, v2.6.0, v2.7.0, v2.8.0, v2.9.0, v2.11.0, v2.12.0, v2.13.0",
Tags: "v1.0.0, v1.1.0, v1.2.0, v1.3.0, v1.4.0, v1.5.0, v1.6.0, v2.2.0, v2.3.0, v2.4.0, v2.5.0, v2.6.0, v2.7.0, v2.8.0, v2.9.0, v2.11.0, v2.12.0, v2.13.0, v2.14.0",
// Tags: "wip",
// Tags: "resiliency", // uncomment to run all node resiliency related tests,
}
Expand Down
10 changes: 10 additions & 0 deletions service/step_defs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2720,6 +2720,15 @@ func (f *feature) iCallBeforeServeWithTopologyConfigSetAt(path string) error {
return nil
}

func (f *feature) verifyDefaultReplicationPrefix() error {
opts := f.service.opts
if opts.ReplicationPrefix != "replication.storage.dell.com" || opts.ReplicationContextPrefix != "powermax" {
return fmt.Errorf("expected default replication prefix, got %s %s", opts.ReplicationPrefix, opts.ReplicationContextPrefix)
}

return nil
}

func (f *feature) iCallNodeStageVolume() error {
// _ = f.getNodePublishVolumeRequest()
header := metadata.New(map[string]string{"csi.requestid": "1"})
Expand Down Expand Up @@ -5056,6 +5065,7 @@ func FeatureContext(s *godog.ScenarioContext) {
s.Step(`^I call BeforeServe$`, f.iCallBeforeServe)
s.Step(`^I call BeforeServe without ClusterPrefix$`, f.iCallBeforeServeWithoutClusterPrefix)
s.Step(`^I call BeforeServe with an invalid ClusterPrefix$`, f.iCallBeforeServeWithAnInvalidClusterPrefix)
s.Step(`^replication prefixes have default values$`, f.verifyDefaultReplicationPrefix)
s.Step(`^I call NodeStageVolume$`, f.iCallNodeStageVolume)
s.Step(`^I call NodeUnstageVolume$`, f.iCallNodeUnstageVolume)
s.Step(`^I call NodeStageVolume with simulator$`, f.iCallNodeStageVolumeWithSimulator)
Expand Down
Loading