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 <galexrt@googlemail.com>
This commit is contained in:
Alexander Trost committed 2020-06-16 09:37:33 +02:00
1 parent c0ed19aa4b
commit 1a072be677
1 file changed
+11 -1
+11 -1
View File
@@ -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