Skip to content
Open
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
3 changes: 1 addition & 2 deletions pkg/azurelustre/nodeserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -727,8 +727,7 @@ func newLustreVolume(volumeID, volumeName string, params map[string]string) (*lu
case VolumeContextInternalDynamicallyCreated:
if v == "t" {
createdByDynamicProvisioning = true
}
if v != "" && v != "f" {
} else if v != "" && v != "f" {
klog.Warningf("invalid value for %s, should be 't' or 'f': %s", VolumeContextInternalDynamicallyCreated, v)
}
case VolumeContextResourceGroupName:
Expand Down
70 changes: 57 additions & 13 deletions pkg/azurelustre/nodeserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ func TestNodePublishVolume(t *testing.T) {
VolumeCapability: &csi.VolumeCapability{AccessMode: &volumeCap, AccessType: &csi.VolumeCapability_Mount{
Mount: &csi.VolumeCapability_MountVolume{MountFlags: []string{"noatime", "flock"}},
}},
VolumeId: "vol_1#lustrefs#1.1.1.1##test-amlfilesystem-rg",
VolumeId: "vol_1#lustrefs#1.1.1.1##t#test-amlfilesystem-rg",
TargetPath: targetTest,
VolumeContext: map[string]string{"mgs-ip-address": "1.1.1.1", "fs-name": "lustrefs", "amlfilesystem-name": "test-amlfilesystem-name", "resource-group-name": "test-amlfilesystem-rg"},
VolumeContext: map[string]string{"mgs-ip-address": "1.1.1.1", "fs-name": "lustrefs", "amlfilesystem-name": "test-amlfilesystem-name", "resource-group-name": "test-amlfilesystem-rg", "created-by-dynamic-provisioning": "t"},
Readonly: false,
},
expectedErr: nil,
Expand Down Expand Up @@ -1045,21 +1045,65 @@ func TestNewLustreVolume(t *testing.T) {
},
{
desc: "valid context with dynamic provisioning",
id: "vol_1#lustrefs#1.1.1.1##test-amlfilesystem-rg",
id: "vol_1#lustrefs#1.1.1.1##t#test-amlfilesystem-rg",
volName: "vol_1",
params: map[string]string{
"mgs-ip-address": "1.1.1.1",
"fs-name": "lustrefs",
"amlfilesystem-name": "test-amlfilesystem-name",
"resource-group-name": "test-amlfilesystem-rg",
"mgs-ip-address": "1.1.1.1",
"fs-name": "lustrefs",
"amlfilesystem-name": "test-amlfilesystem-name",
"resource-group-name": "test-amlfilesystem-rg",
"created-by-dynamic-provisioning": "t",
},
expectedLustreVolume: &lustreVolume{
id: "vol_1#lustrefs#1.1.1.1##test-amlfilesystem-rg",
name: "vol_1",
azureLustreName: "lustrefs",
mgsIPAddress: "1.1.1.1",
subDir: "",
resourceGroupName: "test-amlfilesystem-rg",
id: "vol_1#lustrefs#1.1.1.1##t#test-amlfilesystem-rg",
name: "vol_1",
azureLustreName: "lustrefs",
mgsIPAddress: "1.1.1.1",
subDir: "",
resourceGroupName: "test-amlfilesystem-rg",
createdByDynamicProvisioning: true,
},
},
{
desc: "valid context not created by dynamic provisioning",
id: "vol_1#lustrefs#1.1.1.1##f#test-amlfilesystem-rg",
volName: "vol_1",
params: map[string]string{
"mgs-ip-address": "1.1.1.1",
"fs-name": "lustrefs",
"amlfilesystem-name": "test-amlfilesystem-name",
"resource-group-name": "test-amlfilesystem-rg",
"created-by-dynamic-provisioning": "f",
},
expectedLustreVolume: &lustreVolume{
id: "vol_1#lustrefs#1.1.1.1##f#test-amlfilesystem-rg",
name: "vol_1",
azureLustreName: "lustrefs",
mgsIPAddress: "1.1.1.1",
subDir: "",
resourceGroupName: "test-amlfilesystem-rg",
createdByDynamicProvisioning: false,
},
},
{
desc: "ignore invalid 'created by dynamic provisioning' value",
id: "vol_1#lustrefs#1.1.1.1##unknown#test-amlfilesystem-rg",
volName: "vol_1",
params: map[string]string{
"mgs-ip-address": "1.1.1.1",
"fs-name": "lustrefs",
"amlfilesystem-name": "test-amlfilesystem-name",
"resource-group-name": "test-amlfilesystem-rg",
"created-by-dynamic-provisioning": "unknown",
},
expectedLustreVolume: &lustreVolume{
id: "vol_1#lustrefs#1.1.1.1##unknown#test-amlfilesystem-rg",
name: "vol_1",
azureLustreName: "lustrefs",
mgsIPAddress: "1.1.1.1",
subDir: "",
resourceGroupName: "test-amlfilesystem-rg",
createdByDynamicProvisioning: false,
},
},
{
Expand Down
Loading