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

Ignore case difference for host name when X_CSI_IG_MODIFY_HOSTNAME is enabled #392

Merged
merged 5 commits into from
Dec 20, 2024
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
2 changes: 2 additions & 0 deletions service/features/node_publish_unpublish.feature
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ Feature: PowerMax CSI interface
|node1 | node2 | nvalid | induced | errormsg |
|"host1" | "host2" | 0 | "none" | "is already a part of a different host" |
|"host1" | "host1" | 1 | "none" | "none" |
|"host1" | "HOST1" | 1 | "none" | "none" |
|"host1" | "host1" | 0 | "GetInitiatorByIDError" | "none" |

@v1.4.0
Expand All @@ -542,6 +543,7 @@ Feature: PowerMax CSI interface
|"host1" | "host1" | 1 | false | "temp-csi-%host1%" | "none" | "none" |
|"host1" | "host1" | 0 | false | "temp-csi-%host1%" | "GetInitiatorByIDError" | "none" |
|"host1" | "host2" | 0 | false | "temp.!csi-%host1%" | "none" | "is already a part of a different host" |
|"host1" | "HOST1" | 1 | true | "temp-csi-%host1%" | "UpdateHostError" | "none" |
|"host1" | "host2" | 1 | true | "temp-csi-%host1%" | "none" | "none" |
|"host1" | "host2" | 0 | true | "temp-csi-%host1%" | "UpdateHostError" | "Error updating Host" |
|"host1" | "host2" | 1 | true | "temp-csi-%host1" | "none" | "none" |
Expand Down
37 changes: 19 additions & 18 deletions service/node.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-2024 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 @@ -1654,32 +1654,33 @@ func (s *service) verifyAndUpdateInitiatorsInADiffHost(ctx context.Context, symI
continue
}
if initiator.Host != "" {
if initiator.Host != hostID &&
s.opts.ModifyHostName {
if !hostUpdated {
// User has set ModifyHostName to modify host name in case of a mismatch
log.Infof("UpdateHostName processing: %s to %s", initiator.Host, hostID)
_, err := pmaxClient.UpdateHostName(ctx, symID, initiator.Host, hostID)
if err != nil {
errormsg = fmt.Sprintf("Failed to change host name from %s to %s: %s", initiator.HostID, hostID, err)
if !strings.EqualFold(initiator.Host, hostID) {
if s.opts.ModifyHostName {
if !hostUpdated {
// User has set ModifyHostName to modify host name in case of a mismatch
log.Infof("UpdateHostName processing: %s to %s", initiator.Host, hostID)
_, err := pmaxClient.UpdateHostName(ctx, symID, initiator.Host, hostID)
if err != nil {
errormsg = fmt.Sprintf("Failed to change host name from %s to %s: %s", initiator.Host, hostID, err)
log.Warning(errormsg)
continue
}
hostUpdated = true
} else {
errormsg = fmt.Sprintf("Skipping Updating Host %s for initiator: %s as updated host already present on: %s", initiator.Host,
initiatorID, symID)
log.Warning(errormsg)
continue
}
hostUpdated = true
} else {
errormsg = fmt.Sprintf("Skipping Updating Host %s for initiator: %s as updated host already present on: %s", initiator.HostID,
initiatorID, symID)
errormsg = fmt.Sprintf("initiator: %s is already a part of a different host: %s on: %s",
initiatorID, initiator.Host, symID)
log.Warning(errormsg)
continue
}
} else if initiator.Host != hostID {
errormsg = fmt.Sprintf("initiator: %s is already a part of a different host: %s on: %s",
initiatorID, initiator.Host, symID)
log.Warning(errormsg)
continue
}
}
log.Infof("valid initiator: %s\n", initiatorID)
log.Infof("Valid initiator: %s", initiatorID)
validInitiators = appendIfMissing(validInitiators, nodeInitiator)
errormsg = ""
}
Expand Down
4 changes: 2 additions & 2 deletions service/storage_group_svc.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-2024 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 @@ -571,7 +571,7 @@ func (g *storageGroupSvc) addVolumesToSGMV(ctx context.Context, reqID, symID, tg
if maskingViewExists {
// We just need to confirm if all the other entities are in order
// Check for host group too in case of vsphere
if (tgtMaskingView.HostID == hostID || tgtMaskingView.HostGroupID == hostID) && tgtMaskingView.StorageGroupID == tgtStorageGroupID {
if (strings.EqualFold(tgtMaskingView.HostID, hostID) || strings.EqualFold(tgtMaskingView.HostGroupID, hostID)) && strings.EqualFold(tgtMaskingView.StorageGroupID, tgtStorageGroupID) {
// Add the volumes to masking view, if any to be added
if len(devIDs) > 0 {
log.WithFields(f).Info("Calling AddVolumesToStorageGroup")
Expand Down
Loading