From 1a072be6779277f5d1ae72118bfd2bf58c4ddbed Mon Sep 17 00:00:00 2001 From: Alexander Trost Date: Tue, 9 Jun 2020 17:59:51 +0200 Subject: [PATCH] core: fix info log for discovered devices Fix the info log statement to log the discovered devices as their string representation instead of pointers. This changes the info log to only be the device names and the debug log to be the whole disk struct as well. Resolves #5625 Signed-off-by: Alexander Trost --- pkg/daemon/discover/discover.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/daemon/discover/discover.go b/pkg/daemon/discover/discover.go index 8b43942b3..a7d0c8424 100644 --- a/pkg/daemon/discover/discover.go +++ b/pkg/daemon/discover/discover.go @@ -395,14 +395,24 @@ func updateDeviceCM(context *clusterd.Context) error { return nil } +func logDevices(devices []*sys.LocalDisk) { + var devicesList []string + for _, device := range devices { + logger.Debugf("localdevice %q: %+v", device.Name, device) + devicesList = append(devicesList, device.Name) + } + logger.Infof("localdevices: %q", strings.Join(devicesList, ", ")) +} + func probeDevices(context *clusterd.Context) ([]sys.LocalDisk, error) { devices := make([]sys.LocalDisk, 0) localDevices, err := clusterd.DiscoverDevices(context.Executor) - logger.Infof("localdevices: %+v", localDevices) if err != nil { return devices, fmt.Errorf("failed initial hardware discovery. %+v", err) } + logDevices(localDevices) + // ceph-volume inventory command takes a little time to complete. // Get this data only if it is needed and once by function execution var cvInventory *map[string]string = nil