diff --git a/pkg/operator/ceph/cluster/watcher.go b/pkg/operator/ceph/cluster/watcher.go index 722642412..f04e5353d 100644 --- a/pkg/operator/ceph/cluster/watcher.go +++ b/pkg/operator/ceph/cluster/watcher.go @@ -350,8 +350,9 @@ func rbdStatusUnMarshal(output []byte) ([]string, error) { } func concatenateWatcherIp(address string) string { - // split with separation '/' to remove nounce and concatenating `/32` to define a network with only one IP address - watcherIP := strings.Split(address, "/")[0] + "/32" + // address is in format `10.63.0.5:0/1254753579` + // split with separation ':0/' to remove nounce and concatenating `/32` to define a network with only one IP address + watcherIP := strings.Split(address, ":0/")[0] + "/32" return watcherIP } diff --git a/pkg/operator/ceph/cluster/watcher_test.go b/pkg/operator/ceph/cluster/watcher_test.go index 2339559c7..2a28d755f 100644 --- a/pkg/operator/ceph/cluster/watcher_test.go +++ b/pkg/operator/ceph/cluster/watcher_test.go @@ -348,12 +348,12 @@ func TestRBDStatusUnMarshal(t *testing.T) { listIP, err := rbdStatusUnMarshal([]byte(output)) assert.NoError(t, err) - assert.Equal(t, listIP[0], "192.168.39.137:0/32") + assert.Equal(t, listIP[0], "192.168.39.137/32") } func TestConcatenateWatcherIp(t *testing.T) { WatcherIP := concatenateWatcherIp("192.168.39.137:0/3762982934") - assert.Equal(t, WatcherIP, "192.168.39.137:0/32") + assert.Equal(t, WatcherIP, "192.168.39.137/32") } func TestOnDeviceCMUpdate(t *testing.T) {