Merge pull request #3811 from SUSE/fix-ceph-volume-outputs-to-stderr-now
Ceph: use combined output from ceph-volume
This commit is contained in:
3 files changed
+12
-8
No files matched your search
@@ -217,6 +217,10 @@ func testOSDAgentWithDevicesHelper(t *testing.T, storeConfig config.StoreConfig,
|
||||
assert.Equal(t, config.Bluestore, storeConfig.StoreType)
|
||||
return `SIZE="1234567890" TYPE="part"`, nil
|
||||
}
|
||||
return "", nil
|
||||
}
|
||||
executor.MockExecuteCommandWithCombinedOutput = func(debug bool, actionName string, command string, args ...string) (string, error) {
|
||||
outputExecCount++
|
||||
if command == "ceph-volume" {
|
||||
if args[1] == "list" {
|
||||
return `{}`, nil
|
||||
@@ -386,7 +390,7 @@ func createTestAgent(t *testing.T, devices, configDir, nodeName string, storeCon
|
||||
logger.Infof("%s %v", command, args)
|
||||
return "{\"key\":\"mysecurekey\", \"osdid\":3.0}", nil
|
||||
},
|
||||
MockExecuteCommandWithOutput: func(debug bool, actionName string, command string, args ...string) (string, error) {
|
||||
MockExecuteCommandWithCombinedOutput: func(debug bool, actionName string, command string, args ...string) (string, error) {
|
||||
logger.Infof("%s %v", command, args)
|
||||
if command == "ceph-volume" {
|
||||
if len(args) == 3 && args[0] == "lvm" && args[1] == "batch" && args[2] == "--prepare" {
|
||||
|
||||
@@ -101,7 +101,7 @@ func (a *OsdAgent) initializeBlockPVC(context *clusterd.Context, devices *Device
|
||||
}...)
|
||||
// execute ceph-volume with the device
|
||||
|
||||
if op, err := context.Executor.ExecuteCommandWithOutput(false, "", baseCommand, immediateExecuteArgs...); err != nil {
|
||||
if op, err := context.Executor.ExecuteCommandWithCombinedOutput(false, "", baseCommand, immediateExecuteArgs...); err != nil {
|
||||
return "", fmt.Errorf("failed ceph-volume. %+v", err) // fail return here as validation provided by ceph-volume
|
||||
} else {
|
||||
logger.Infof("%v", op)
|
||||
@@ -309,7 +309,7 @@ func (a *OsdAgent) initializeDevices(context *clusterd.Context, devices *DeviceO
|
||||
"json",
|
||||
}...)
|
||||
|
||||
cvOut, err := context.Executor.ExecuteCommandWithOutput(false, "", baseCommand, reportArgs...)
|
||||
cvOut, err := context.Executor.ExecuteCommandWithCombinedOutput(false, "", baseCommand, reportArgs...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed ceph-volume json report. %+v", err) // fail return here as validation provided by ceph-volume
|
||||
}
|
||||
@@ -350,7 +350,7 @@ func sanitizeOSDsPerDevice(count int) string {
|
||||
|
||||
func getCephVolumeSupported(context *clusterd.Context) (bool, error) {
|
||||
|
||||
_, err := context.Executor.ExecuteCommandWithOutput(false, "", cephVolumeCmd, "lvm", "batch", "--prepare")
|
||||
_, err := context.Executor.ExecuteCommandWithCombinedOutput(false, "", cephVolumeCmd, "lvm", "batch", "--prepare")
|
||||
|
||||
if err != nil {
|
||||
if cmdErr, ok := err.(*exec.CommandError); ok {
|
||||
@@ -369,7 +369,7 @@ func getCephVolumeSupported(context *clusterd.Context) (bool, error) {
|
||||
|
||||
func getCephVolumeOSDs(context *clusterd.Context, clusterName string, cephfsid string, lv string) ([]oposd.OSDInfo, error) {
|
||||
|
||||
result, err := context.Executor.ExecuteCommandWithOutput(false, "", cephVolumeCmd, "lvm", "list", lv, "--format", "json")
|
||||
result, err := context.Executor.ExecuteCommandWithCombinedOutput(false, "", cephVolumeCmd, "lvm", "list", lv, "--format", "json")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to retrieve ceph-volume results. %+v", err)
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ var cephVolumeTestResultMultiClusterMultiOSD = `{
|
||||
func TestParseCephVolumeResult(t *testing.T) {
|
||||
executor := &exectest.MockExecutor{}
|
||||
// set up a mock function to return "rook owned" partitions on the device and it does not have a filesystem
|
||||
executor.MockExecuteCommandWithOutput = func(debug bool, name string, command string, args ...string) (string, error) {
|
||||
executor.MockExecuteCommandWithCombinedOutput = func(debug bool, name string, command string, args ...string) (string, error) {
|
||||
logger.Infof("%s %+v", command, args)
|
||||
|
||||
if command == "ceph-volume" {
|
||||
@@ -261,7 +261,7 @@ func TestParseCephVolumeResult(t *testing.T) {
|
||||
func TestCephVolumeResultMultiClusterSingleOSD(t *testing.T) {
|
||||
executor := &exectest.MockExecutor{}
|
||||
// set up a mock function to return "rook owned" partitions on the device and it does not have a filesystem
|
||||
executor.MockExecuteCommandWithOutput = func(debug bool, name string, command string, args ...string) (string, error) {
|
||||
executor.MockExecuteCommandWithCombinedOutput = func(debug bool, name string, command string, args ...string) (string, error) {
|
||||
logger.Infof("%s %+v", command, args)
|
||||
|
||||
if command == "ceph-volume" {
|
||||
@@ -282,7 +282,7 @@ func TestCephVolumeResultMultiClusterSingleOSD(t *testing.T) {
|
||||
func TestCephVolumeResultMultiClusterMultiOSD(t *testing.T) {
|
||||
executor := &exectest.MockExecutor{}
|
||||
// set up a mock function to return "rook owned" partitions on the device and it does not have a filesystem
|
||||
executor.MockExecuteCommandWithOutput = func(debug bool, name string, command string, args ...string) (string, error) {
|
||||
executor.MockExecuteCommandWithCombinedOutput = func(debug bool, name string, command string, args ...string) (string, error) {
|
||||
logger.Infof("%s %+v", command, args)
|
||||
|
||||
if command == "ceph-volume" {
|
||||
|
||||
Reference in new issue
Block a user