Merge pull request #6060 from leseb/fix-6057

ceph: use different command for lvm2 presence
This commit is contained in:
Sébastien Han authored and GitHub committed 2020-08-13 16:30:30 +02:00
commit b3e7971953
2 files changed
+5 -5

No files matched your search

+1 -1
View File
@@ -173,7 +173,7 @@ func Provision(context *clusterd.Context, agent *OsdAgent, crushLocation string)
// Check for the presence of LVM on the host when NOT running on PVC
// since this scenario is still using LVM
if !agent.pvcBacked {
ne := NewNsenter(context, lvmCommandToCheck, []string{"--help"})
ne := NewNsenter(context, lvmCommandToCheck, []string{"help"})
err := ne.checkIfBinaryExistsOnHost()
if err != nil {
return errors.Wrapf(err, "binary %q does not exist on the host, make sure lvm2 package is installed", lvmCommandToCheck)
+4 -4
View File
@@ -27,9 +27,9 @@ import (
)
func TestBuildNsEnterCLI(t *testing.T) {
ne := NewNsenter(&clusterd.Context{}, lvmCommandToCheck, []string{"--help"})
ne := NewNsenter(&clusterd.Context{}, lvmCommandToCheck, []string{"help"})
args := ne.buildNsEnterCLI(filepath.Join("/sbin/", ne.binary))
expectedCLI := []string{"--mount=/rootfs/proc/1/ns/mnt", "--", "/sbin/lvm", "--help"}
expectedCLI := []string{"--mount=/rootfs/proc/1/ns/mnt", "--", "/sbin/lvm", "help"}
assert.Equal(t, expectedCLI, args)
}
@@ -38,7 +38,7 @@ func TestCheckIfBinaryExistsOnHost(t *testing.T) {
executor := &exectest.MockExecutor{}
executor.MockExecuteCommandWithCombinedOutput = func(command string, args ...string) (string, error) {
logger.Infof("%s %v", command, args)
if command == "nsenter" && args[0] == "--mount=/rootfs/proc/1/ns/mnt" && args[1] == "--" && args[3] == "--help" {
if command == "nsenter" && args[0] == "--mount=/rootfs/proc/1/ns/mnt" && args[1] == "--" && args[3] == "help" {
if args[2] == "/usr/sbin/lvm" || args[2] == "/sbin/lvm" {
return "success", nil
}
@@ -48,7 +48,7 @@ func TestCheckIfBinaryExistsOnHost(t *testing.T) {
}
context := &clusterd.Context{Executor: executor}
ne := NewNsenter(context, lvmCommandToCheck, []string{"--help"})
ne := NewNsenter(context, lvmCommandToCheck, []string{"help"})
err := ne.checkIfBinaryExistsOnHost()
assert.NoError(t, err)
}