ceph: do not list on empty device

If the device is empty let's not use an empty space as an argument for
the c-v call.

Signed-off-by: Sébastien Han <seb@redhat.com>
This commit is contained in:
Sébastien Han committed 2020-08-12 22:24:14 +02:00
1 parent 9738c2ba21
commit f75a6e9d93
1 file changed
+6 -1
+6 -1
View File
@@ -722,7 +722,12 @@ func GetCephVolumeRawOSDs(context *clusterd.Context, clusterInfo *client.Cluster
// lv can be a block device if raw mode is used
cvMode := "raw"
result, err := callCephVolume(context, cvMode, "list", block, "--format", "json")
args := []string{cvMode, "list", block, "--format", "json"}
if block == "" {
args = []string{cvMode, "list", "--format", "json"}
}
result, err := callCephVolume(context, args...)
if err != nil {
return nil, errors.Wrapf(err, "failed to retrieve ceph-volume %s list results", cvMode)
}