ceph: do not fail prepareOSD job if devices are not passed
If devices are not specified for node return empty desired devices list and do not fail prepareOSD job. Closes: #8097 Signed-off-by: Denis Egorenko <degorenko@mirantis.com>
This commit is contained in:
1 parent
21db07bc04
commit
fa2c276cc1
2 files changed
+9
No files matched your search
@@ -290,6 +290,10 @@ func getLocation(clientset kubernetes.Interface) (string, string, error) {
|
||||
|
||||
// Parse the devices, which are sent as a JSON-marshalled list of device IDs with a StorageConfig spec
|
||||
func parseDevices(devices string) ([]osddaemon.DesiredDevice, error) {
|
||||
if devices == "" {
|
||||
return []osddaemon.DesiredDevice{}, nil
|
||||
}
|
||||
|
||||
configuredDevices := []osdcfg.ConfiguredDevice{}
|
||||
err := json.Unmarshal([]byte(devices), &configuredDevices)
|
||||
if err != nil {
|
||||
|
||||
@@ -20,6 +20,7 @@ import (
|
||||
"encoding/json"
|
||||
"testing"
|
||||
|
||||
osddaemon "github.com/rook/rook/pkg/daemon/ceph/osd"
|
||||
osdcfg "github.com/rook/rook/pkg/operator/ceph/cluster/osd/config"
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -167,4 +168,8 @@ func TestParseDesiredDevices(t *testing.T) {
|
||||
assert.False(t, result[2].IsDevicePathFilter)
|
||||
assert.False(t, result[3].IsDevicePathFilter)
|
||||
|
||||
// check empty devices list
|
||||
result, err = parseDevices("")
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, []osddaemon.DesiredDevice{}, result)
|
||||
}
|
||||
Reference in new issue
Block a user