Skip to content

Commit 4cbdf21

Browse files
Changes to fix ANF volume import failure with NFS v4.1
1 parent 86cd9c9 commit 4cbdf21

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

storage_drivers/azure/api/azure.go

+11-9
Original file line numberDiff line numberDiff line change
@@ -1256,15 +1256,17 @@ func (c Client) ModifyVolume(
12561256
anfVolume.Properties.SnapshotDirectoryVisible = snapshotDirAccess
12571257
}
12581258

1259-
// Modify the export-rule to restrict the kerberos protocol type
1260-
if len(anfVolume.Properties.ExportPolicy.Rules) > 0 && exportRule != nil {
1261-
anfVolume.Properties.ExportPolicy.Rules[0].Nfsv41 = &exportRule.Nfsv41
1262-
anfVolume.Properties.ExportPolicy.Rules[0].Kerberos5ReadWrite = &exportRule.Kerberos5ReadWrite
1263-
anfVolume.Properties.ExportPolicy.Rules[0].Kerberos5ReadOnly = &exportRule.Kerberos5ReadOnly
1264-
anfVolume.Properties.ExportPolicy.Rules[0].Kerberos5IReadWrite = &exportRule.Kerberos5IReadWrite
1265-
anfVolume.Properties.ExportPolicy.Rules[0].Kerberos5IReadOnly = &exportRule.Kerberos5IReadOnly
1266-
anfVolume.Properties.ExportPolicy.Rules[0].Kerberos5PReadWrite = &exportRule.Kerberos5PReadWrite
1267-
anfVolume.Properties.ExportPolicy.Rules[0].Kerberos5PReadOnly = &exportRule.Kerberos5PReadOnly
1259+
// Modify the export-rule for kerberos volumes
1260+
if *anfVolume.Properties.KerberosEnabled && exportRule != nil {
1261+
for i := range len(anfVolume.Properties.ExportPolicy.Rules) {
1262+
anfVolume.Properties.ExportPolicy.Rules[i].Nfsv41 = &exportRule.Nfsv41
1263+
anfVolume.Properties.ExportPolicy.Rules[i].Kerberos5ReadWrite = &exportRule.Kerberos5ReadWrite
1264+
anfVolume.Properties.ExportPolicy.Rules[i].Kerberos5ReadOnly = &exportRule.Kerberos5ReadOnly
1265+
anfVolume.Properties.ExportPolicy.Rules[i].Kerberos5IReadWrite = &exportRule.Kerberos5IReadWrite
1266+
anfVolume.Properties.ExportPolicy.Rules[i].Kerberos5IReadOnly = &exportRule.Kerberos5IReadOnly
1267+
anfVolume.Properties.ExportPolicy.Rules[i].Kerberos5PReadWrite = &exportRule.Kerberos5PReadWrite
1268+
anfVolume.Properties.ExportPolicy.Rules[i].Kerberos5PReadOnly = &exportRule.Kerberos5PReadOnly
1269+
}
12681270
}
12691271

12701272
// Clear out ReadOnly and other fields that we don't want to change when merely relabeling.

0 commit comments

Comments
 (0)