Merge pull request #6060 from leseb/fix-6057
ceph: use different command for lvm2 presence
This commit is contained in:
2 files changed
+5
-5
No files matched your search
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
Reference in new issue
Block a user