Skip to content

Commit

Permalink
Fix CephFS volumes failing to mount after upgrade to 4.18
Browse files Browse the repository at this point in the history
Until 4.18 Provider mode was using v1(6789) port as default, so v1 ports
were present in the rook-ceph-mon-endpoints CM. Rook doesn’t update this
CM to v2 3300 port until the mons are failed over, even after
requireMsgr2 is set to true. Provider sends the mon endpoints from the
same rook-ceph-mon-endpoints CM to the client, so the client uses the v1
(6789) port address it received in it’s ceph-csi-config CM.

But client receives the cephFS kernel mount option from provider as
‘prefer-crc’ as requireMsgr2 is true. When mounting new cephFS volume on
client side it tries to use the v1 6789 port with the ‘prefer-crc’
kernel mount option. Which can't work,thus cephFS volumes fail to mount.

As since 4.18 we are using v2 port always, so the provider should send
the v2 port address to the client by modifying the mon IPs.
Similar implementation can be seen in rook.

Signed-off-by: Malay Kumar Parida <mparida@redhat.com>
  • Loading branch information
malayparida2000 committed Feb 4, 2025
1 parent 7e38947 commit cdf97f5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions services/provider/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,13 @@ func isEncryptionInTransitEnabled(networkSpec *rookCephv1.NetworkSpec) bool {

func extractMonitorIps(data string) ([]string, error) {
var ips []string
const (
// msgr2port is the listening port of the messenger v2 protocol
msgr2port = "3300"
// msgr1port is the listening port of the messenger v1 protocol
msgr1port = "6789"
)

mons := strings.Split(data, ",")
for _, mon := range mons {
parts := strings.Split(mon, "=")
Expand All @@ -1077,6 +1084,16 @@ func extractMonitorIps(data string) ([]string, error) {
}
// sorting here removes any positional change which reduces spurious reconciles
slices.Sort(ips)

// Rook does not update the rook-ceph-mon-endpoint ConfigMap until mons failover
// Starting from 4.18, RequireMsgr2 is always enabled, and encryption in transit is allowed on existing clusters.
// So, we need to replace the msgr1 port with msgr2 port.
for i, ip := range ips {
if strings.HasSuffix(ip, msgr1port) {
ips[i] = strings.TrimSuffix(ip, msgr1port) + msgr2port
}
}

return ips, nil
}

Expand Down

0 comments on commit cdf97f5

Please sign in to comment.