Skip to content

Commit

Permalink
Remove ACP check for SAN Economy volume import
Browse files Browse the repository at this point in the history
  • Loading branch information
mravi-na authored Jun 21, 2024
1 parent 2885f73 commit 30a62b8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 46 deletions.
9 changes: 4 additions & 5 deletions acp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ const (

// Feature constants.

FeatureSnapshotRestore = "SnapshotRestore"
FeatureSnapshotMirrorUpdate = "SnapshotMirrorUpdate"
FeatureReadOnlyClone = "ReadOnlyClone"
FeatureInflightEncryption = "InflightEncryption"
FeatureSANEconomyVolumeImport = "SANEconomyVolumeImport"
FeatureSnapshotRestore = "SnapshotRestore"
FeatureSnapshotMirrorUpdate = "SnapshotMirrorUpdate"
FeatureReadOnlyClone = "ReadOnlyClone"
FeatureInflightEncryption = "InflightEncryption"
)
7 changes: 0 additions & 7 deletions storage_drivers/ontap/ontap_san_economy.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

"github.com/RoaringBitmap/roaring"

"github.com/netapp/trident/acp"
tridentconfig "github.com/netapp/trident/config"
. "github.com/netapp/trident/logging"
"github.com/netapp/trident/storage"
Expand Down Expand Up @@ -844,12 +843,6 @@ func (d *SANEconomyStorageDriver) Import(
Logd(ctx, d.Name(), d.Config.DebugTraceFlags["method"]).WithFields(fields).Trace(">>>> Import")
defer Logd(ctx, d.Name(), d.Config.DebugTraceFlags["method"]).WithFields(fields).Trace("<<<< Import")

if err := acp.API().IsFeatureEnabled(ctx, acp.FeatureSANEconomyVolumeImport); err != nil {
Logc(ctx).WithField("feature", acp.FeatureSANEconomyVolumeImport).
WithError(err).Error("Failed to import volume.")
return fmt.Errorf("feature %s requires ACP; %w", acp.FeatureSANEconomyVolumeImport, err)
}

pathElements := strings.Split(originalName, "/")
if len(pathElements) < 2 {
return fmt.Errorf("%s is not a valid import vol/LUN path", originalName)
Expand Down
34 changes: 0 additions & 34 deletions storage_drivers/ontap/ontap_san_economy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,8 @@ import (
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"

"github.com/netapp/trident/acp"
tridentconfig "github.com/netapp/trident/config"
. "github.com/netapp/trident/logging"
"github.com/netapp/trident/mocks/mock_acp"
mockapi "github.com/netapp/trident/mocks/mock_storage_drivers/mock_ontap"
"github.com/netapp/trident/storage"
sa "github.com/netapp/trident/storage_attribute"
Expand Down Expand Up @@ -1699,12 +1697,6 @@ func TestOntapSanEconomyVolumeClone_BothQosPolicy(t *testing.T) {
func TestOntapSanEconomyVolumeImport(t *testing.T) {
mockAPI, d := newMockOntapSanEcoDriver(t)

mockController := gomock.NewController(t)
mockACP := mock_acp.NewMockTridentACP(mockController)
acp.SetAPI(mockACP)
// Mock out any expected calls on the ACP API.
mockACP.EXPECT().IsFeatureEnabled(gomock.Any(), acp.FeatureSANEconomyVolumeImport).Return(nil).AnyTimes()

volConfig := &storage.VolumeConfig{
Size: "1g",
Encryption: "false",
Expand Down Expand Up @@ -1824,12 +1816,6 @@ func TestOntapSanEconomyVolumeImport(t *testing.T) {
func TestOntapSanEconomyVolumeImport_Managed(t *testing.T) {
mockAPI, d := newMockOntapSanEcoDriver(t)

mockController := gomock.NewController(t)
mockACP := mock_acp.NewMockTridentACP(mockController)
acp.SetAPI(mockACP)
// Mock out any expected calls on the ACP API.
mockACP.EXPECT().IsFeatureEnabled(gomock.Any(), acp.FeatureSANEconomyVolumeImport).Return(nil).AnyTimes()

volConfig := &storage.VolumeConfig{
InternalName: "my_vol/my_LUN",
Size: "1g",
Expand Down Expand Up @@ -1930,29 +1916,9 @@ func TestOntapSanEconomyVolumeImport_Managed(t *testing.T) {
}
}

func TestOntapSanEconomyVolumeImport_Unsupported(t *testing.T) {
mockController := gomock.NewController(t)
mockACP := mock_acp.NewMockTridentACP(mockController)
acp.SetAPI(mockACP)
// Mock out any expected calls on the ACP API.
mockACP.EXPECT().IsFeatureEnabled(gomock.Any(), acp.FeatureSANEconomyVolumeImport).
Return(utilserrors.UnsupportedError("unsupported"))

volConfig := &storage.VolumeConfig{}
_, d := newMockOntapSanEcoDriver(t)
err := d.Import(ctx, volConfig, "testvol")
assert.Error(t, err, "Import is supported")
}

func TestOntapSanEconomyVolumeImport_UnsupportedNameLength(t *testing.T) {
mockAPI, d := newMockOntapSanEcoDriver(t)

mockController := gomock.NewController(t)
mockACP := mock_acp.NewMockTridentACP(mockController)
acp.SetAPI(mockACP)
// Mock out any expected calls on the ACP API.
mockACP.EXPECT().IsFeatureEnabled(gomock.Any(), acp.FeatureSANEconomyVolumeImport).Return(nil).AnyTimes()

volConfig := &storage.VolumeConfig{
InternalName: "my_vol" +
"/VOLUME_NAME_BIGGER_THAN_SUPPORTED_LENGTH_wsvawgwasvsdgadsfbadsvadsfhbadvbsDFASBsdvsvsdvsdvsvs" +
Expand Down

0 comments on commit 30a62b8

Please sign in to comment.