Skip to content

Commit

Permalink
Merge pull request #14218 from rook/mergify/bp/release-1.14/pr-14210
Browse files Browse the repository at this point in the history
core: remove pacific specific code (backport #14210)
  • Loading branch information
mergify[bot] committed May 16, 2024
2 parents bc1d7f4 + d50517a commit 632dbef
Show file tree
Hide file tree
Showing 16 changed files with 141 additions and 273 deletions.
7 changes: 1 addition & 6 deletions pkg/daemon/ceph/client/filesystem_mirror.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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
Expand Down
28 changes: 1 addition & 27 deletions pkg/daemon/ceph/client/filesystem_mirror_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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": []}]}]`
)
Expand Down Expand Up @@ -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])
Expand All @@ -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)
Expand Down
20 changes: 4 additions & 16 deletions pkg/daemon/ceph/osd/volume.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 632dbef

Please sign in to comment.