From b3329fccfcab4cab520690e14fe5f892079e4686 Mon Sep 17 00:00:00 2001 From: santhoshatdell Date: Fri, 17 Jan 2025 16:23:06 +0000 Subject: [PATCH 1/2] Set default value for replication prefixes for Metro to work --- service/service.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/service/service.go b/service/service.go index 490ec596..d766b1cb 100644 --- a/service/service.go +++ b/service/service.go @@ -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. @@ -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" @@ -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 { From 581eebd399f48ab0ec39b18e02f029775f0c6495 Mon Sep 17 00:00:00 2001 From: santhoshatdell Date: Tue, 21 Jan 2025 21:40:55 +0000 Subject: [PATCH 2/2] Updated unit tests --- service/features/service.feature | 6 ++++++ service/service_test.go | 2 +- service/step_defs_test.go | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/service/features/service.feature b/service/features/service.feature index f837e7c4..a08673c8 100644 --- a/service/features/service.feature +++ b/service/features/service.feature @@ -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 diff --git a/service/service_test.go b/service/service_test.go index e0065e2c..8628a792 100644 --- a/service/service_test.go +++ b/service/service_test.go @@ -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, } diff --git a/service/step_defs_test.go b/service/step_defs_test.go index 1de97946..ff904fd5 100644 --- a/service/step_defs_test.go +++ b/service/step_defs_test.go @@ -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"}) @@ -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)