core: remove pacific specific code
Since pacific is no longer supported, we can remove pacific specific
code.
Signed-off-by: Satoru Takeuchi <satoru.takeuchi@gmail.com>
(cherry picked from commit f776c0b35e)
This commit is contained in:
1 parent
8b1ad00598
commit
a5d232b15c
16 files changed
+140
-272
No files matched your search
@@ -25,7 +25,6 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
cephv1 "github.com/rook/rook/pkg/apis/ceph.rook.io/v1"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
cephver "github.com/rook/rook/pkg/operator/ceph/version"
|
||||
"github.com/rook/rook/pkg/util/exec"
|
||||
)
|
||||
|
||||
@@ -215,12 +214,8 @@ func GetFSMirrorDaemonStatus(context *clusterd.Context, clusterInfo *ClusterInfo
|
||||
// Using Debug level since this is called in a recurrent go routine
|
||||
logger.Debugf("retrieving filesystem mirror status for filesystem %q", fsName)
|
||||
|
||||
args := []string{"fs", "snapshot", "mirror", "daemon", "status"} // for Ceph v16.2.7 and above
|
||||
if !clusterInfo.CephVersion.IsAtLeast(cephver.CephVersion{Major: 16, Minor: 2, Extra: 7}) {
|
||||
// fs-name needed for Ceph v16.2.6 and earlier
|
||||
args = append(args, fsName)
|
||||
}
|
||||
// Build command
|
||||
args := []string{"fs", "snapshot", "mirror", "daemon", "status"}
|
||||
cmd := NewCephCommand(context, clusterInfo, args)
|
||||
|
||||
// Run command
|
||||
|
||||
@@ -22,7 +22,6 @@ import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/rook/rook/pkg/clusterd"
|
||||
cephver "github.com/rook/rook/pkg/operator/ceph/version"
|
||||
exectest "github.com/rook/rook/pkg/util/exec/test"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -32,10 +31,6 @@ var (
|
||||
//nolint:gosec // since this is not leaking any credentials
|
||||
fsMirrorToken = `{"token": "eyJmc2lkIjogIjgyYjdlZDkyLTczYjAtNGIyMi1hOGI3LWVkOTQ4M2UyODc1NiIsICJmaWxlc3lzdGVtIjogIm15ZnMyIiwgInVzZXIiOiAiY2xpZW50Lm1pcnJvciIsICJzaXRlX25hbWUiOiAidGVzdCIsICJrZXkiOiAiQVFEVVAxSmdqM3RYQVJBQWs1cEU4cDI1ZUhld2lQK0ZXRm9uOVE9PSIsICJtb25faG9zdCI6ICJbdjI6MTAuOTYuMTQyLjIxMzozMzAwLHYxOjEwLjk2LjE0Mi4yMTM6Njc4OV0sW3YyOjEwLjk2LjIxNy4yMDc6MzMwMCx2MToxMC45Ni4yMTcuMjA3OjY3ODldLFt2MjoxMC45OS4xMC4xNTc6MzMwMCx2MToxMC45OS4xMC4xNTc6Njc4OV0ifQ=="}`
|
||||
|
||||
// response of "ceph fs snapshot mirror daemon status myfs"
|
||||
// fsMirrorDaemonStatus = `{ "daemon_id": "444607", "filesystems": [ { "filesystem_id": "1", "name": "myfs", "directory_count": 0, "peers": [ { "uuid": "4a6983c0-3c9d-40f5-b2a9-2334a4659827", "remote": { "client_name": "client.mirror_remote", "cluster_name": "site-remote", "fs_name": "backup_fs" }, "stats": { "failure_count": 0, "recovery_count": 0 } } ] } ] }`
|
||||
fsMirrorDaemonStatus = `[{"daemon_id":25103, "filesystems": [{"filesystem_id": 1, "name": "myfs", "directory_count": 0, "peers": []}]}]`
|
||||
|
||||
// response of "ceph fs snapshot mirror daemon status"
|
||||
fsMirrorDaemonStatusNew = `[{"daemon_id":23102, "filesystems": [{"filesystem_id": 2, "name": "myfsNew", "directory_count": 0, "peers": []}]}]`
|
||||
)
|
||||
@@ -146,27 +141,7 @@ func TestRemoveFilesystemMirrorPeer(t *testing.T) {
|
||||
func TestFSMirrorDaemonStatus(t *testing.T) {
|
||||
fs := "myfs"
|
||||
executor := &exectest.MockExecutor{}
|
||||
t.Run("snapshot status command with fsName - test for Ceph v16.2.6 and earlier", func(t *testing.T) {
|
||||
executor.MockExecuteCommandWithOutput = func(command string, args ...string) (string, error) {
|
||||
if args[0] == "fs" {
|
||||
assert.Equal(t, "snapshot", args[1])
|
||||
assert.Equal(t, "mirror", args[2])
|
||||
assert.Equal(t, "daemon", args[3])
|
||||
assert.Equal(t, "status", args[4])
|
||||
assert.Equal(t, fs, args[5]) // fs-name needed for Ceph v16.2.6 and earlier
|
||||
return fsMirrorDaemonStatus, nil
|
||||
}
|
||||
return "", errors.New("unknown command")
|
||||
}
|
||||
context := &clusterd.Context{Executor: executor}
|
||||
clusterInfo := AdminTestClusterInfo("mycluster")
|
||||
clusterInfo.CephVersion = cephver.CephVersion{Major: 16, Minor: 2, Extra: 6}
|
||||
s, err := GetFSMirrorDaemonStatus(context, clusterInfo, fs)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 25103, s[0].DaemonID)
|
||||
assert.Equal(t, "myfs", s[0].Filesystems[0].Name)
|
||||
})
|
||||
t.Run("snapshot status command without fsName - test for Ceph v16.2.7 and above", func(t *testing.T) {
|
||||
t.Run("snapshot status command", func(t *testing.T) {
|
||||
executor.MockExecuteCommandWithOutput = func(command string, args ...string) (string, error) {
|
||||
if args[0] == "fs" {
|
||||
assert.Equal(t, "snapshot", args[1])
|
||||
@@ -180,7 +155,6 @@ func TestFSMirrorDaemonStatus(t *testing.T) {
|
||||
}
|
||||
context := &clusterd.Context{Executor: executor}
|
||||
clusterInfo := AdminTestClusterInfo("mycluster")
|
||||
clusterInfo.CephVersion = cephver.CephVersion{Major: 16, Minor: 2, Extra: 7}
|
||||
s, err := GetFSMirrorDaemonStatus(context, clusterInfo, fs)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, 23102, s[0].DaemonID)
|
||||
|
||||
@@ -34,7 +34,6 @@ import (
|
||||
"github.com/rook/rook/pkg/daemon/ceph/client"
|
||||
oposd "github.com/rook/rook/pkg/operator/ceph/cluster/osd"
|
||||
"github.com/rook/rook/pkg/operator/ceph/cluster/osd/config"
|
||||
cephver "github.com/rook/rook/pkg/operator/ceph/version"
|
||||
"github.com/rook/rook/pkg/util/display"
|
||||
"github.com/rook/rook/pkg/util/sys"
|
||||
)
|
||||
@@ -60,11 +59,8 @@ var (
|
||||
lvmConfPath = "/etc/lvm/lvm.conf"
|
||||
cvLogDir = ""
|
||||
|
||||
// The mitigation of phantom ATARI partition problem is fixed in Ceph v16.2.6. Quincy doesn't have this problem from the beginning
|
||||
// See https://github.com/ceph/ceph/pull/42469
|
||||
cephIgnorePhantomAtariPartitionCephVersion = cephver.CephVersion{Major: 16, Minor: 2, Extra: 6}
|
||||
isEncrypted = os.Getenv(oposd.EncryptedDeviceEnvVarName) == "true"
|
||||
isOnPVC = os.Getenv(oposd.PVCBackedOSDVarName) == "true"
|
||||
isEncrypted = os.Getenv(oposd.EncryptedDeviceEnvVarName) == "true"
|
||||
isOnPVC = os.Getenv(oposd.PVCBackedOSDVarName) == "true"
|
||||
)
|
||||
|
||||
type osdInfoBlock struct {
|
||||
@@ -446,15 +442,7 @@ func (a *OsdAgent) allowRawMode(context *clusterd.Context) (bool, error) {
|
||||
}
|
||||
|
||||
// test if safe to use raw mode for a particular device
|
||||
func isSafeToUseRawMode(device *DeviceOsdIDEntry, cephVersion cephver.CephVersion) bool {
|
||||
if device.DeviceInfo.Type == sys.DiskType {
|
||||
// if this is a disk but the atari partition fix isn't in, we can't use raw mode
|
||||
if !cephVersion.IsAtLeast(cephIgnorePhantomAtariPartitionCephVersion) {
|
||||
logger.Debugf("won't use raw mode for disk %q since this is a disk and the atari partition issue isn't fixed", device.Config.Name)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
func isSafeToUseRawMode(device *DeviceOsdIDEntry) bool {
|
||||
// ceph-volume raw mode does not support more than one OSD per disk
|
||||
if device.Config.OSDsPerDevice > 1 {
|
||||
logger.Debugf("won't use raw mode for disk %q since osd per device is %d", device.Config.Name, device.Config.OSDsPerDevice)
|
||||
@@ -517,7 +505,7 @@ func (a *OsdAgent) initializeDevices(context *clusterd.Context, devices *DeviceO
|
||||
// which reports only the phantom partitions (and malformed OSD info) when they exist and
|
||||
// ignores the original (correct) OSDs created on the raw disk.
|
||||
// See: https://github.com/rook/rook/issues/7940
|
||||
if allowRawMode && isSafeToUseRawMode(device, a.clusterInfo.CephVersion) {
|
||||
if allowRawMode && isSafeToUseRawMode(device) {
|
||||
rawDevices.Entries[name] = device
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -561,8 +561,7 @@ func TestConfigureCVDevices(t *testing.T) {
|
||||
|
||||
context := &clusterd.Context{Executor: executor, ConfigDir: cephConfigDir}
|
||||
clusterInfo := &cephclient.ClusterInfo{
|
||||
CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 1}, // It supports raw mode OSD
|
||||
FSID: clusterFSID,
|
||||
FSID: clusterFSID,
|
||||
}
|
||||
agent := &OsdAgent{clusterInfo: clusterInfo, nodeName: nodeName, storeConfig: config.StoreConfig{DeviceClass: "myclass", StoreType: "bluestore"}}
|
||||
devices := &DeviceOsdMapping{
|
||||
@@ -575,54 +574,52 @@ func TestConfigureCVDevices(t *testing.T) {
|
||||
assert.True(t, deviceClassSet)
|
||||
}
|
||||
|
||||
// disabled while raw mode is disabled for disks
|
||||
// {
|
||||
// // Test case for a raw mode OSD
|
||||
// t.Log("Test case for a raw mode OSD")
|
||||
// executor := &exectest.MockExecutor{}
|
||||
// executor.MockExecuteCommandWithOutput = func(command string, args ...string) (string, error) {
|
||||
// logger.Infof("[MockExecuteCommandWithOutput] %s %v", command, args)
|
||||
// // get lsblk for disks from cephVolumeRAWTestResult var
|
||||
// if command == "lsblk" && (args[0] == "/dev/vdb" || args[0] == "/dev/vdc") {
|
||||
// return fmt.Sprintf(`SIZE="17179869184" ROTA="1" RO="0" TYPE="disk" PKNAME="" NAME="%s" KNAME="%s"`, args[0], args[0]), nil
|
||||
// }
|
||||
// if args[1] == "ceph-volume" && args[4] == "raw" && args[5] == "list" {
|
||||
// return cephVolumeRAWTestResult, nil
|
||||
// }
|
||||
// if args[1] == "ceph-volume" && args[4] == "lvm" && args[5] == "list" {
|
||||
// return `{}`, nil
|
||||
// }
|
||||
// if command == "sgdisk" {
|
||||
// return "Disk identifier (GUID): 18484D7E-5287-4CE9-AC73-D02FB69055CE", nil
|
||||
// }
|
||||
// return "", errors.Errorf("unknown command %s %s", command, args)
|
||||
// }
|
||||
// deviceClassSet := false
|
||||
// executor.MockExecuteCommandWithCombinedOutput = func(command string, args ...string) (string, error) {
|
||||
// logger.Infof("[MockExecuteCommandWithCombinedOutput] %s %v", command, args)
|
||||
// if args[1] == "ceph-volume" && args[2] == "raw" && args[3] == "prepare" && args[4] == "--bluestore" && args[7] == "--crush-device-class" {
|
||||
// assert.Equal(t, "myclass", args[8])
|
||||
// deviceClassSet = true
|
||||
// return "", nil
|
||||
// }
|
||||
// return "", errors.Errorf("unknown command %s %s", command, args)
|
||||
// }
|
||||
{
|
||||
// Test case for a raw mode OSD
|
||||
t.Log("Test case for a raw mode OSD")
|
||||
executor := &exectest.MockExecutor{}
|
||||
executor.MockExecuteCommandWithOutput = func(command string, args ...string) (string, error) {
|
||||
logger.Infof("[MockExecuteCommandWithOutput] %s %v", command, args)
|
||||
// get lsblk for disks from cephVolumeRAWTestResult var
|
||||
if command == "lsblk" && (args[0] == "/dev/vdb" || args[0] == "/dev/vdc") {
|
||||
return fmt.Sprintf(`SIZE="17179869184" ROTA="1" RO="0" TYPE="disk" PKNAME="" NAME="%s" KNAME="%s"`, args[0], args[0]), nil
|
||||
}
|
||||
if args[1] == "ceph-volume" && args[4] == "raw" && args[5] == "list" {
|
||||
return cephVolumeRAWTestResult, nil
|
||||
}
|
||||
if args[1] == "ceph-volume" && args[4] == "lvm" && args[5] == "list" {
|
||||
return `{}`, nil
|
||||
}
|
||||
if command == "sgdisk" {
|
||||
return "Disk identifier (GUID): 18484D7E-5287-4CE9-AC73-D02FB69055CE", nil
|
||||
}
|
||||
return "", errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
deviceClassSet := false
|
||||
executor.MockExecuteCommandWithCombinedOutput = func(command string, args ...string) (string, error) {
|
||||
logger.Infof("[MockExecuteCommandWithCombinedOutput] %s %v", command, args)
|
||||
if args[1] == "ceph-volume" && args[2] == "raw" && args[3] == "prepare" && args[4] == "--bluestore" && args[7] == "--crush-device-class" {
|
||||
assert.Equal(t, "myclass", args[8])
|
||||
deviceClassSet = true
|
||||
return "", nil
|
||||
}
|
||||
return "", errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
|
||||
// context := &clusterd.Context{Executor: executor, ConfigDir: cephConfigDir}
|
||||
// clusterInfo := &cephclient.ClusterInfo{
|
||||
// CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 1}, // It supports raw mode OSD
|
||||
// FSID: clusterFSID,
|
||||
// }
|
||||
// agent := &OsdAgent{clusterInfo: clusterInfo, nodeName: nodeName, storeConfig: config.StoreConfig{DeviceClass: "myclass"}}
|
||||
// devices := &DeviceOsdMapping{
|
||||
// Entries: map[string]*DeviceOsdIDEntry{
|
||||
// "vdb": {Data: -1, Metadata: nil, Config: DesiredDevice{Name: "/dev/vdb"}},
|
||||
// },
|
||||
// }
|
||||
// _, err := agent.configureCVDevices(context, devices)
|
||||
// assert.Nil(t, err)
|
||||
// assert.True(t, deviceClassSet)
|
||||
// }
|
||||
context := &clusterd.Context{Executor: executor, ConfigDir: cephConfigDir}
|
||||
clusterInfo := &cephclient.ClusterInfo{
|
||||
FSID: clusterFSID,
|
||||
}
|
||||
agent := &OsdAgent{clusterInfo: clusterInfo, nodeName: nodeName, storeConfig: config.StoreConfig{DeviceClass: "myclass", StoreType: "bluestore"}}
|
||||
devices := &DeviceOsdMapping{
|
||||
Entries: map[string]*DeviceOsdIDEntry{
|
||||
"vdb": {Data: -1, Metadata: nil, Config: DesiredDevice{Name: "/dev/vdb"}},
|
||||
},
|
||||
}
|
||||
_, err := agent.configureCVDevices(context, devices)
|
||||
assert.Nil(t, err)
|
||||
assert.True(t, deviceClassSet)
|
||||
}
|
||||
}
|
||||
|
||||
func testBaseArgs(args []string) error {
|
||||
@@ -676,7 +673,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
|
||||
return errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{Executor: executor}
|
||||
|
||||
err := a.initializeDevicesLVMMode(context, devices)
|
||||
@@ -708,7 +705,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
|
||||
return errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{EncryptedDevice: true, StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{EncryptedDevice: true, StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{Executor: executor}
|
||||
|
||||
err := a.initializeDevicesLVMMode(context, devices)
|
||||
@@ -740,7 +737,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
|
||||
return errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{OSDsPerDevice: 3, StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{OSDsPerDevice: 3, StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{Executor: executor}
|
||||
|
||||
err := a.initializeDevicesLVMMode(context, devices)
|
||||
@@ -772,7 +769,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
|
||||
return errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{DeviceClass: "hybrid", StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{DeviceClass: "hybrid", StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{Executor: executor}
|
||||
err := a.initializeDevicesLVMMode(context, devices)
|
||||
assert.NoError(t, err, "failed crush device class test")
|
||||
@@ -826,7 +823,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
|
||||
return "", errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{
|
||||
Executor: executor,
|
||||
Devices: []*sys.LocalDisk{
|
||||
@@ -889,7 +886,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
|
||||
return "", errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{
|
||||
Executor: executor,
|
||||
Devices: []*sys.LocalDisk{
|
||||
@@ -914,7 +911,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}, metadataDevice: "/dev/sdb1"}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}, metadataDevice: "/dev/sdb1"}
|
||||
context := &clusterd.Context{
|
||||
Devices: []*sys.LocalDisk{
|
||||
{Name: "sda"},
|
||||
@@ -957,7 +954,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
return errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{OSDsPerDevice: 3, StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{OSDsPerDevice: 3, StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{
|
||||
Executor: executor,
|
||||
Devices: []*sys.LocalDisk{
|
||||
@@ -1000,7 +997,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
return errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{
|
||||
Executor: executor,
|
||||
Devices: []*sys.LocalDisk{
|
||||
@@ -1079,7 +1076,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{
|
||||
Executor: executor,
|
||||
Devices: []*sys.LocalDisk{
|
||||
@@ -1155,7 +1152,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
|
||||
return "", errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{
|
||||
Executor: executor,
|
||||
Devices: []*sys.LocalDisk{
|
||||
@@ -1207,7 +1204,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
return errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{
|
||||
Executor: executor,
|
||||
Devices: []*sys.LocalDisk{
|
||||
@@ -1289,7 +1286,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
}
|
||||
agent := &OsdAgent{
|
||||
clusterInfo: &cephclient.ClusterInfo{
|
||||
CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0},
|
||||
CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0},
|
||||
},
|
||||
nodeName: "node1",
|
||||
storeConfig: config.StoreConfig{StoreType: "bluestore"},
|
||||
@@ -1349,7 +1346,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
|
||||
agent := &OsdAgent{
|
||||
clusterInfo: &cephclient.ClusterInfo{
|
||||
CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0},
|
||||
CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0},
|
||||
},
|
||||
nodeName: "node1",
|
||||
storeConfig: config.StoreConfig{StoreType: "bluestore"},
|
||||
@@ -1431,7 +1428,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
}
|
||||
agent := &OsdAgent{
|
||||
clusterInfo: &cephclient.ClusterInfo{
|
||||
CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0},
|
||||
CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0},
|
||||
},
|
||||
nodeName: "node1",
|
||||
storeConfig: config.StoreConfig{StoreType: "bluestore"},
|
||||
@@ -1475,7 +1472,7 @@ func TestInitializeBlock(t *testing.T) {
|
||||
|
||||
agent := &OsdAgent{
|
||||
clusterInfo: &cephclient.ClusterInfo{
|
||||
CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 0},
|
||||
CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 0},
|
||||
},
|
||||
nodeName: "node1",
|
||||
storeConfig: config.StoreConfig{StoreType: "bluestore"},
|
||||
@@ -1948,7 +1945,7 @@ func TestInitializeBlockWithMD(t *testing.T) {
|
||||
|
||||
return "", errors.Errorf("unknown command %s %s", command, args)
|
||||
}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Extra: 4}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
a := &OsdAgent{clusterInfo: &cephclient.ClusterInfo{CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Extra: 4}}, nodeName: "node1", storeConfig: config.StoreConfig{StoreType: "bluestore"}}
|
||||
context := &clusterd.Context{
|
||||
Executor: executor,
|
||||
Devices: []*sys.LocalDisk{
|
||||
@@ -2066,66 +2063,29 @@ func TestAppendOSDInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestIsSafeToUseRawMode(t *testing.T) {
|
||||
baseDisk := func() *DeviceOsdIDEntry {
|
||||
return &DeviceOsdIDEntry{
|
||||
Config: DesiredDevice{
|
||||
Name: "vda",
|
||||
},
|
||||
DeviceInfo: &sys.LocalDisk{
|
||||
Name: "vda",
|
||||
Type: sys.DiskType,
|
||||
},
|
||||
}
|
||||
}
|
||||
basePart := func() *DeviceOsdIDEntry {
|
||||
return &DeviceOsdIDEntry{
|
||||
Config: DesiredDevice{
|
||||
Name: "vda1",
|
||||
},
|
||||
DeviceInfo: &sys.LocalDisk{
|
||||
Name: "vda1",
|
||||
Type: sys.PartType,
|
||||
},
|
||||
}
|
||||
device := &DeviceOsdIDEntry{
|
||||
Config: DesiredDevice{
|
||||
Name: "vda",
|
||||
OSDsPerDevice: 1,
|
||||
},
|
||||
DeviceInfo: &sys.LocalDisk{
|
||||
Name: "vda",
|
||||
Type: sys.DiskType,
|
||||
},
|
||||
}
|
||||
|
||||
cephPrevMajor := cephver.CephVersion{Major: 15, Minor: 2, Extra: 15}
|
||||
cephBeforeAtariPatch := cephver.CephVersion{Major: 16, Minor: 2, Extra: 5}
|
||||
cephWithAtariPatch := cephver.CephVersion{Major: 16, Minor: 2, Extra: 6}
|
||||
cephNextMajor := cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}
|
||||
|
||||
t.Run("safe for partitions with all Ceph versions", func(t *testing.T) {
|
||||
device := basePart()
|
||||
assert.True(t, isSafeToUseRawMode(device, cephPrevMajor))
|
||||
assert.True(t, isSafeToUseRawMode(device, cephBeforeAtariPatch))
|
||||
assert.True(t, isSafeToUseRawMode(device, cephWithAtariPatch))
|
||||
assert.True(t, isSafeToUseRawMode(device, cephNextMajor))
|
||||
})
|
||||
|
||||
t.Run("safe for disks only with atari patch", func(t *testing.T) {
|
||||
device := baseDisk()
|
||||
// make sure it's still unsafe for previous ceph version
|
||||
assert.False(t, isSafeToUseRawMode(device, cephPrevMajor))
|
||||
assert.False(t, isSafeToUseRawMode(device, cephBeforeAtariPatch))
|
||||
assert.True(t, isSafeToUseRawMode(device, cephWithAtariPatch))
|
||||
// make sure it's still safe when next ceph version comes out
|
||||
assert.True(t, isSafeToUseRawMode(device, cephNextMajor))
|
||||
t.Run("safe if OSDs per device == 1 and metadata device is not specified", func(t *testing.T) {
|
||||
assert.True(t, isSafeToUseRawMode(device))
|
||||
})
|
||||
|
||||
t.Run("not safe if OSDs per device > 1", func(t *testing.T) {
|
||||
device := baseDisk()
|
||||
device.Config.OSDsPerDevice = 2
|
||||
// we only care about the cases where disks would otherwise be safe
|
||||
assert.False(t, isSafeToUseRawMode(device, cephWithAtariPatch))
|
||||
assert.False(t, isSafeToUseRawMode(device, cephNextMajor))
|
||||
assert.False(t, isSafeToUseRawMode(device))
|
||||
})
|
||||
|
||||
t.Run("not safe if metadata device specified", func(t *testing.T) {
|
||||
device := baseDisk()
|
||||
device.Config.MetadataDevice = "vdb1"
|
||||
// we only care about the cases where disks would otherwise be safe
|
||||
assert.False(t, isSafeToUseRawMode(device, cephWithAtariPatch))
|
||||
assert.False(t, isSafeToUseRawMode(device, cephNextMajor))
|
||||
assert.False(t, isSafeToUseRawMode(device))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -251,13 +251,6 @@ func (c *ClusterController) configureLocalCephCluster(cluster *cluster) error {
|
||||
// Set the value of isUpgrade based on the image discovery done by detectAndValidateCephVersion()
|
||||
cluster.isUpgrade = isUpgrade
|
||||
|
||||
if cluster.Spec.IsStretchCluster() {
|
||||
stretchVersion := cephver.CephVersion{Major: 16, Minor: 2, Build: 5}
|
||||
if !cephVersion.IsAtLeast(stretchVersion) {
|
||||
return errors.Errorf("stretch clusters minimum ceph version is %q, but is running %s", stretchVersion.String(), cephVersion.String())
|
||||
}
|
||||
}
|
||||
|
||||
if cluster.Spec.Network.MultiClusterService.Enabled {
|
||||
serviceExportVersion := cephver.CephVersion{Major: 17, Minor: 2, Extra: 6}
|
||||
if !cephVersion.IsAtLeast(serviceExportVersion) {
|
||||
|
||||
@@ -76,7 +76,7 @@ func createNewCluster(t *testing.T) *Cluster {
|
||||
Client: cl,
|
||||
}
|
||||
ownerInfo := cephclient.NewMinimumOwnerInfo(t)
|
||||
clusterInfo := &cephclient.ClusterInfo{Namespace: "ns", FSID: "myfsid", OwnerInfo: ownerInfo, CephVersion: cephver.CephVersion{Major: 16, Minor: 2, Build: 5}, Context: context.TODO()}
|
||||
clusterInfo := &cephclient.ClusterInfo{Namespace: "ns", FSID: "myfsid", OwnerInfo: ownerInfo, CephVersion: cephver.CephVersion{Major: 17, Minor: 2, Build: 0}, Context: context.TODO()}
|
||||
clusterInfo.SetName("test")
|
||||
clusterSpec := cephv1.ClusterSpec{
|
||||
Annotations: map[cephv1.KeyType]cephv1.Annotations{cephv1.KeyMgr: {"my": "annotation"}},
|
||||
|
||||
@@ -29,7 +29,6 @@ import (
|
||||
cephutil "github.com/rook/rook/pkg/daemon/ceph/util"
|
||||
"github.com/rook/rook/pkg/operator/ceph/config"
|
||||
"github.com/rook/rook/pkg/operator/ceph/controller"
|
||||
"github.com/rook/rook/pkg/operator/ceph/version"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
kerrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
@@ -47,8 +46,6 @@ var (
|
||||
timeZero = time.Duration(0)
|
||||
// Check whether mons are on the same node once per operator restart since it's a rare scheduling condition
|
||||
needToCheckMonsOnSameNode = true
|
||||
// Version of Ceph where the arbiter failover is supported
|
||||
arbiterFailoverSupportedCephVersion = version.CephVersion{Major: 16, Minor: 2, Extra: 7}
|
||||
)
|
||||
|
||||
// HealthChecker aggregates the mon/cluster info needed to check the health of the monitors
|
||||
@@ -551,13 +548,9 @@ func (c *Cluster) allowFailover(name string) error {
|
||||
// failover if it's a non-arbiter
|
||||
return nil
|
||||
}
|
||||
if c.ClusterInfo.CephVersion.IsAtLeast(arbiterFailoverSupportedCephVersion) {
|
||||
// failover the arbiter if at least v16.2.7
|
||||
return nil
|
||||
}
|
||||
|
||||
// Ceph does not support updating the arbiter mon in older versions
|
||||
return errors.Errorf("refusing to failover arbiter mon %q on a stretched cluster until upgrading to ceph version %s", name, arbiterFailoverSupportedCephVersion.String())
|
||||
return errors.Errorf("refusing to failover arbiter mon %q on a stretched cluster", name)
|
||||
}
|
||||
|
||||
func (c *Cluster) removeOrphanMonResources() {
|
||||
|
||||
@@ -30,7 +30,6 @@ import (
|
||||
clienttest "github.com/rook/rook/pkg/daemon/ceph/client/test"
|
||||
"github.com/rook/rook/pkg/operator/ceph/config"
|
||||
opcontroller "github.com/rook/rook/pkg/operator/ceph/controller"
|
||||
"github.com/rook/rook/pkg/operator/ceph/version"
|
||||
testopk8s "github.com/rook/rook/pkg/operator/k8sutil/test"
|
||||
"github.com/rook/rook/pkg/operator/test"
|
||||
exectest "github.com/rook/rook/pkg/util/exec/test"
|
||||
@@ -274,16 +273,6 @@ func TestSkipMonFailover(t *testing.T) {
|
||||
assert.NoError(t, c.allowFailover(monName))
|
||||
})
|
||||
|
||||
t.Run("skip failover for arbiter if an older version of ceph", func(t *testing.T) {
|
||||
c.arbiterMon = monName
|
||||
c.ClusterInfo.CephVersion = version.CephVersion{Major: 16, Minor: 2, Extra: 6}
|
||||
assert.Error(t, c.allowFailover(monName))
|
||||
})
|
||||
|
||||
t.Run("don't skip failover for arbiter if a newer version of ceph", func(t *testing.T) {
|
||||
c.ClusterInfo.CephVersion = version.CephVersion{Major: 16, Minor: 2, Extra: 7}
|
||||
assert.NoError(t, c.allowFailover(monName))
|
||||
})
|
||||
}
|
||||
|
||||
func TestEvictMonOnSameNode(t *testing.T) {
|
||||
|
||||
@@ -358,12 +358,6 @@ func (c *Cluster) ConfigureArbiter() error {
|
||||
if err != nil {
|
||||
logger.Warningf("attempting to enable arbiter after failed to detect if already enabled. %v", err)
|
||||
} else if monDump.StretchMode {
|
||||
// only support arbiter failover if at least v16.2.7
|
||||
if !c.ClusterInfo.CephVersion.IsAtLeast(arbiterFailoverSupportedCephVersion) {
|
||||
logger.Info("stretch mode is already enabled")
|
||||
return nil
|
||||
}
|
||||
|
||||
if monDump.TiebreakerMon == c.arbiterMon {
|
||||
logger.Infof("stretch mode is already enabled with tiebreaker %q", c.arbiterMon)
|
||||
return nil
|
||||
|
||||
@@ -507,23 +507,14 @@ func TestConfigureArbiter(t *testing.T) {
|
||||
c.context = &clusterd.Context{Clientset: test.New(t, 5), Executor: executor}
|
||||
c.ClusterInfo = clienttest.CreateTestClusterInfo(5)
|
||||
|
||||
t.Run("no arbiter failover for old ceph version", func(t *testing.T) {
|
||||
c.arbiterMon = "changed"
|
||||
c.ClusterInfo.CephVersion = cephver.CephVersion{Major: 16, Minor: 2, Extra: 6}
|
||||
err := c.ConfigureArbiter()
|
||||
assert.NoError(t, err)
|
||||
assert.False(t, setNewTiebreaker)
|
||||
})
|
||||
t.Run("stretch mode already configured - new", func(t *testing.T) {
|
||||
c.arbiterMon = currentArbiter
|
||||
c.ClusterInfo.CephVersion = cephver.CephVersion{Major: 16, Minor: 2, Extra: 7}
|
||||
err := c.ConfigureArbiter()
|
||||
assert.NoError(t, err)
|
||||
assert.False(t, setNewTiebreaker)
|
||||
})
|
||||
t.Run("tiebreaker changed", func(t *testing.T) {
|
||||
c.arbiterMon = "changed"
|
||||
c.ClusterInfo.CephVersion = cephver.CephVersion{Major: 16, Minor: 2, Extra: 7}
|
||||
err := c.ConfigureArbiter()
|
||||
assert.NoError(t, err)
|
||||
assert.True(t, setNewTiebreaker)
|
||||
|
||||
@@ -50,7 +50,7 @@ func TestCreateOrUpdateCephCrash(t *testing.T) {
|
||||
}
|
||||
cephCluster.Spec.Labels = cephv1.LabelsSpec{}
|
||||
cephCluster.Spec.PriorityClassNames = cephv1.PriorityClassNamesSpec{}
|
||||
cephVersion := &cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}
|
||||
cephVersion := &cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}
|
||||
ctx := context.TODO()
|
||||
context := &clusterd.Context{
|
||||
Clientset: test.New(t, 1),
|
||||
|
||||
@@ -38,7 +38,7 @@ import (
|
||||
|
||||
func TestCreateOrUpdateCephCron(t *testing.T) {
|
||||
cephCluster := cephv1.CephCluster{ObjectMeta: metav1.ObjectMeta{Namespace: "rook-ceph"}}
|
||||
cephVersion := &cephver.CephVersion{Major: 16, Minor: 2, Extra: 0}
|
||||
cephVersion := &cephver.CephVersion{Major: 17, Minor: 2, Extra: 0}
|
||||
ctx := context.TODO()
|
||||
context := &clusterd.Context{
|
||||
Clientset: test.New(t, 1),
|
||||
|
||||
@@ -31,7 +31,6 @@ import (
|
||||
"github.com/rook/rook/pkg/operator/ceph/cluster/mon"
|
||||
"github.com/rook/rook/pkg/operator/ceph/config"
|
||||
opcontroller "github.com/rook/rook/pkg/operator/ceph/controller"
|
||||
"github.com/rook/rook/pkg/operator/ceph/file/mirror"
|
||||
"github.com/rook/rook/pkg/operator/ceph/reporting"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
appsv1 "k8s.io/api/apps/v1"
|
||||
@@ -341,59 +340,59 @@ func (r *ReconcileCephFilesystem) reconcile(request reconcile.Request) (reconcil
|
||||
statusUpdated := false
|
||||
|
||||
// Enable mirroring if needed
|
||||
if r.clusterInfo.CephVersion.IsAtLeast(mirror.PeerAdditionMinVersion) {
|
||||
if cephFilesystem.Spec.Mirroring != nil {
|
||||
|
||||
// Disable mirroring on that filesystem if needed
|
||||
if cephFilesystem.Spec.Mirroring != nil {
|
||||
if !cephFilesystem.Spec.Mirroring.Enabled {
|
||||
err = cephclient.DisableFilesystemSnapshotMirror(r.context, r.clusterInfo, cephFilesystem.Name)
|
||||
if err != nil {
|
||||
return reconcile.Result{}, *cephFilesystem,
|
||||
errors.Wrapf(err, "failed to disable mirroring on filesystem %q", cephFilesystem.Name)
|
||||
}
|
||||
} else {
|
||||
logger.Info("reconciling cephfs-mirror mirroring configuration")
|
||||
err = r.reconcileMirroring(cephFilesystem, request.NamespacedName)
|
||||
if err != nil {
|
||||
return opcontroller.ImmediateRetryResult, *cephFilesystem,
|
||||
errors.Wrapf(err, "failed to configure mirroring for filesystem %q.", cephFilesystem.Name)
|
||||
}
|
||||
if !cephFilesystem.Spec.Mirroring.Enabled {
|
||||
err = cephclient.DisableFilesystemSnapshotMirror(r.context, r.clusterInfo, cephFilesystem.Name)
|
||||
if err != nil {
|
||||
return reconcile.Result{}, *cephFilesystem,
|
||||
errors.Wrapf(err, "failed to disable mirroring on filesystem %q", cephFilesystem.Name)
|
||||
}
|
||||
} else {
|
||||
logger.Info("reconciling cephfs-mirror mirroring configuration")
|
||||
err = r.reconcileMirroring(cephFilesystem, request.NamespacedName)
|
||||
if err != nil {
|
||||
return opcontroller.ImmediateRetryResult, *cephFilesystem,
|
||||
errors.Wrapf(err, "failed to configure mirroring for filesystem %q.", cephFilesystem.Name)
|
||||
}
|
||||
|
||||
// Always create a bootstrap peer token in case another cluster wants to add us as a peer
|
||||
logger.Info("reconciling create cephfs-mirror peer configuration")
|
||||
reconcileResponse, err = opcontroller.CreateBootstrapPeerSecret(r.context, r.clusterInfo, cephFilesystem, k8sutil.NewOwnerInfo(cephFilesystem, r.scheme))
|
||||
if err != nil {
|
||||
r.updateStatus(k8sutil.ObservedGenerationNotAvailable, request.NamespacedName, cephv1.ConditionFailure, nil)
|
||||
return reconcileResponse, *cephFilesystem,
|
||||
errors.Wrapf(err, "failed to create cephfs-mirror bootstrap peer for filesystem %q.", cephFilesystem.Name)
|
||||
}
|
||||
// Always create a bootstrap peer token in case another cluster wants to add us as a peer
|
||||
logger.Info("reconciling create cephfs-mirror peer configuration")
|
||||
reconcileResponse, err = opcontroller.CreateBootstrapPeerSecret(r.context, r.clusterInfo, cephFilesystem, k8sutil.NewOwnerInfo(cephFilesystem, r.scheme))
|
||||
if err != nil {
|
||||
r.updateStatus(k8sutil.ObservedGenerationNotAvailable, request.NamespacedName, cephv1.ConditionFailure, nil)
|
||||
return reconcileResponse, *cephFilesystem,
|
||||
errors.Wrapf(err, "failed to create cephfs-mirror bootstrap peer for filesystem %q.", cephFilesystem.Name)
|
||||
}
|
||||
|
||||
logger.Info("reconciling add cephfs-mirror peer configuration")
|
||||
err = r.reconcileAddBootstrapPeer(cephFilesystem, request.NamespacedName)
|
||||
if err != nil {
|
||||
return opcontroller.ImmediateRetryResult, *cephFilesystem,
|
||||
errors.Wrapf(err, "failed to configure mirroring for filesystem %q.", cephFilesystem.Name)
|
||||
}
|
||||
logger.Info("reconciling add cephfs-mirror peer configuration")
|
||||
err = r.reconcileAddBootstrapPeer(cephFilesystem, request.NamespacedName)
|
||||
if err != nil {
|
||||
return opcontroller.ImmediateRetryResult, *cephFilesystem,
|
||||
errors.Wrapf(err, "failed to configure mirroring for filesystem %q.", cephFilesystem.Name)
|
||||
}
|
||||
|
||||
// update ObservedGeneration in status at the end of reconcile
|
||||
// Set Ready status, we are done reconciling
|
||||
if r.updateStatus(observedGeneration, request.NamespacedName, cephv1.ConditionReady, opcontroller.GenerateStatusInfo(cephFilesystem)) != nil {
|
||||
statusUpdated = true
|
||||
}
|
||||
// update ObservedGeneration in status at the end of reconcile
|
||||
// Set Ready status, we are done reconciling
|
||||
if r.updateStatus(observedGeneration, request.NamespacedName, cephv1.ConditionReady, opcontroller.GenerateStatusInfo(cephFilesystem)) != nil {
|
||||
statusUpdated = true
|
||||
}
|
||||
|
||||
// Run go routine check for mirroring status
|
||||
if !cephFilesystem.Spec.StatusCheck.Mirror.Disabled {
|
||||
// Start monitoring cephfs-mirror status
|
||||
if r.fsContexts[fsChannelKeyName(cephFilesystem)].started {
|
||||
logger.Debug("ceph filesystem mirror status monitoring go routine already running!")
|
||||
} else {
|
||||
checker := newMirrorChecker(r.context, r.client, r.clusterInfo, request.NamespacedName, &cephFilesystem.Spec, cephFilesystem.Name)
|
||||
go checker.checkMirroring(r.fsContexts[fsChannelKeyName(cephFilesystem)].internalCtx)
|
||||
r.fsContexts[fsChannelKeyName(cephFilesystem)].started = true
|
||||
}
|
||||
// Run go routine check for mirroring status
|
||||
if !cephFilesystem.Spec.StatusCheck.Mirror.Disabled {
|
||||
// Start monitoring cephfs-mirror status
|
||||
if r.fsContexts[fsChannelKeyName(cephFilesystem)].started {
|
||||
logger.Debug("ceph filesystem mirror status monitoring go routine already running!")
|
||||
} else {
|
||||
checker := newMirrorChecker(r.context, r.client, r.clusterInfo, request.NamespacedName, &cephFilesystem.Spec, cephFilesystem.Name)
|
||||
go checker.checkMirroring(r.fsContexts[fsChannelKeyName(cephFilesystem)].internalCtx)
|
||||
r.fsContexts[fsChannelKeyName(cephFilesystem)].started = true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if !statusUpdated {
|
||||
// update ObservedGeneration in status at the end of reconcile
|
||||
// Set Ready status, we are done reconciling$
|
||||
|
||||
@@ -21,7 +21,6 @@ import (
|
||||
|
||||
"github.com/rook/rook/pkg/operator/ceph/config"
|
||||
"github.com/rook/rook/pkg/operator/ceph/config/keyring"
|
||||
"github.com/rook/rook/pkg/operator/ceph/version"
|
||||
"github.com/rook/rook/pkg/operator/k8sutil"
|
||||
)
|
||||
|
||||
@@ -38,11 +37,6 @@ const (
|
||||
userID = "fs-mirror"
|
||||
)
|
||||
|
||||
var (
|
||||
// PeerAdditionMinVersion This version includes a number of fixes for snapshots and mirror status
|
||||
PeerAdditionMinVersion = version.CephVersion{Major: 16, Minor: 2, Extra: 5}
|
||||
)
|
||||
|
||||
// daemonConfig for a single rbd-mirror
|
||||
type daemonConfig struct {
|
||||
ResourceName string // the name rook gives to mirror resources in k8s metadata
|
||||
|
||||
@@ -68,8 +68,7 @@ chown --recursive --verbose ceph:ceph $VAULT_TOKEN_NEW_PATH
|
||||
)
|
||||
|
||||
var (
|
||||
cephVersionMinRGWSSES3 = cephver.CephVersion{Major: 17, Minor: 2, Extra: 3}
|
||||
cephVersionMinRGWSSEKMSTLS = cephver.CephVersion{Major: 16, Minor: 2, Extra: 6}
|
||||
cephVersionMinRGWSSES3 = cephver.CephVersion{Major: 17, Minor: 2, Extra: 3}
|
||||
|
||||
//go:embed rgw-probe.sh
|
||||
rgwProbeScriptTemplate string
|
||||
@@ -392,8 +391,7 @@ func (c *clusterConfig) makeDaemonContainer(rgwConfig *rgwConfig) (v1.Container,
|
||||
if c.store.Spec.Security.KeyManagementService.IsTokenAuthEnabled() {
|
||||
container.Args = append(container.Args, c.sseKMSVaultTokenOptions(kmsEnabled)...)
|
||||
}
|
||||
if c.store.Spec.Security.KeyManagementService.IsTLSEnabled() &&
|
||||
c.clusterInfo.CephVersion.IsAtLeast(cephVersionMinRGWSSEKMSTLS) {
|
||||
if c.store.Spec.Security.KeyManagementService.IsTLSEnabled() {
|
||||
container.Args = append(container.Args, c.sseKMSVaultTLSOptions(kmsEnabled)...)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,27 +162,27 @@ func TestIsInferior(t *testing.T) {
|
||||
|
||||
func TestValidateCephVersionsBetweenLocalAndExternalClusters(t *testing.T) {
|
||||
// TEST 1: versions are identical
|
||||
localCephVersion := CephVersion{Major: 15, Minor: 2, Extra: 1}
|
||||
externalCephVersion := CephVersion{Major: 15, Minor: 2, Extra: 1}
|
||||
localCephVersion := CephVersion{Major: 17, Minor: 2, Extra: 1}
|
||||
externalCephVersion := CephVersion{Major: 17, Minor: 2, Extra: 1}
|
||||
err := ValidateCephVersionsBetweenLocalAndExternalClusters(localCephVersion, externalCephVersion)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// TEST 2: local cluster version major is lower than external cluster version
|
||||
localCephVersion = CephVersion{Major: 15, Minor: 2, Extra: 1}
|
||||
externalCephVersion = CephVersion{Major: 16, Minor: 2, Extra: 1}
|
||||
localCephVersion = CephVersion{Major: 17, Minor: 2, Extra: 1}
|
||||
externalCephVersion = CephVersion{Major: 18, Minor: 2, Extra: 1}
|
||||
err = ValidateCephVersionsBetweenLocalAndExternalClusters(localCephVersion, externalCephVersion)
|
||||
assert.NoError(t, err)
|
||||
|
||||
// TEST 3: local cluster version major is higher than external cluster version
|
||||
localCephVersion = CephVersion{Major: 16, Minor: 2, Extra: 1}
|
||||
externalCephVersion = CephVersion{Major: 15, Minor: 2, Extra: 1}
|
||||
localCephVersion = CephVersion{Major: 17, Minor: 2, Extra: 1}
|
||||
externalCephVersion = CephVersion{Major: 16, Minor: 2, Extra: 1}
|
||||
err = ValidateCephVersionsBetweenLocalAndExternalClusters(localCephVersion, externalCephVersion)
|
||||
assert.Error(t, err)
|
||||
|
||||
// TEST 4: local version is > but from a minor release
|
||||
// local version must never be higher
|
||||
localCephVersion = CephVersion{Major: 15, Minor: 2, Extra: 2}
|
||||
externalCephVersion = CephVersion{Major: 15, Minor: 2, Extra: 1}
|
||||
localCephVersion = CephVersion{Major: 17, Minor: 2, Extra: 2}
|
||||
externalCephVersion = CephVersion{Major: 17, Minor: 2, Extra: 1}
|
||||
err = ValidateCephVersionsBetweenLocalAndExternalClusters(localCephVersion, externalCephVersion)
|
||||
assert.Error(t, err)
|
||||
|
||||
|
||||
Reference in new issue
Block a user