func (discovery *DeviceDiscovery) discoverDevices() error {
	// List all the valid block devices on the node
	validDevices, err := getValidBlockDevices()
	if err != nil {
		message := "failed to discover devices"
		e := diskmaker.NewEvent(diskmaker.ErrorListingBlockDevices, fmt.Sprintf("%s. Error: %+v", message, err), "")
		discovery.eventSync.Report(e, discovery.localVolumeDiscovery)
		return errors.Wrapf(err, message)
	}

	klog.Infof("valid block devices: %+v", validDevices)

	discoveredDisks := getDiscoverdDevices(validDevices)
	klog.Infof("discovered devices: %+v", discoveredDisks)

	// Update discovered devices in the  LocalVolumeDiscoveryResult resource
	if !reflect.DeepEqual(discovery.disks, discoveredDisks) {
		klog.Info("device list updated. Updating LocalVolumeDiscoveryResult status...")
		discovery.disks = discoveredDisks
		err = discovery.updateStatus()
		if err != nil {
			message := "failed to update LocalVolumeDiscoveryResult status"
			e := diskmaker.NewEvent(diskmaker.ErrorUpdatingDiscoveryResultObject, fmt.Sprintf("%s. Error: %+v", message, err), "")
			discovery.eventSync.Report(e, discovery.localVolumeDiscovery)
			return errors.Wrapf(err, message)
		}
		message := "successfully updated discovered device details in the LocalVolumeDiscoveryResult resource"
		e := diskmaker.NewSuccessEvent(diskmaker.UpdatedDiscoveredDeviceList, message, "")
		discovery.eventSync.Report(e, discovery.localVolumeDiscovery)
	}

	return nil
}
// discoverDevices identifies the list of usable disks on the current node
discoverDevices identifies the list of usable disks on the current node
// discoverDevices identifies the list of usable disks on the current node
func (discovery *DeviceDiscovery) discoverDevices() error {
	validDevices, err := getValidBlockDevices()
	if err != nil {
		message := "failed to discover devices"
		e := diskmaker.NewEvent(diskmaker.ErrorListingBlockDevices, fmt.Sprintf("%s. Error: %+v", message, err), "")
		discovery.eventSync.Report(e, discovery.localVolumeDiscovery)
		return errors.Wrapf(err, message)
	}
	klog.Infof("valid block devices: %+v", validDevices)
	discoveredDisks := getDiscoverdDevices(validDevices)
	klog.Infof("discovered devices: %+v", discoveredDisks)
	if !reflect.DeepEqual(discovery.disks, discoveredDisks) {
		klog.Info("device list updated. Updating LocalVolumeDiscoveryResult status...")
		discovery.disks = discoveredDisks
		err = discovery.updateStatus()
		if err != nil {
			message := "failed to update LocalVolumeDiscoveryResult status"
			e := diskmaker.NewEvent(diskmaker.ErrorUpdatingDiscoveryResultObject, fmt.Sprintf("%s. Error: %+v", message, err), "")
			discovery.eventSync.Report(e, discovery.localVolumeDiscovery)
			return errors.Wrapf(err, message)
		}
		message := "successfully updated discovered device details in the LocalVolumeDiscoveryResult resource"
		e := diskmaker.NewSuccessEvent(diskmaker.UpdatedDiscoveredDeviceList, message, "")
		discovery.eventSync.Report(e, discovery.localVolumeDiscovery)
	}
	return nil
}
func ( discovery * DeviceDiscovery ) discoverDevices ( ) error { validDevices , err := getValidBlockDevices ( ) if err != nil { message := " " e := diskmaker . NewEvent ( diskmaker . ErrorListingBlockDevices , fmt . Sprintf ( " " , message , err ) , " " ) discovery . eventSync . Report ( e , discovery . localVolumeDiscovery ) return errors . Wrapf ( err , message ) } klog . Infof ( " " , validDevices ) discoveredDisks := getDiscoverdDevices ( validDevices ) klog . Infof ( " " , discoveredDisks ) if ! reflect . DeepEqual ( discovery . disks , discoveredDisks ) { klog . Info ( " " ) discovery . disks = discoveredDisks err = discovery . updateStatus ( ) if err != nil { message := " " e := diskmaker . NewEvent ( diskmaker . ErrorUpdatingDiscoveryResultObject , fmt . Sprintf ( " " , message , err ) , " " ) discovery . eventSync . Report ( e , discovery . localVolumeDiscovery ) return errors . Wrapf ( err , message ) } message := " " e := diskmaker . NewSuccessEvent ( diskmaker . UpdatedDiscoveredDeviceList , message , " " ) discovery . eventSync . Report ( e , discovery . localVolumeDiscovery ) } return nil }
discoverDevices identifies the list of usable disks on the current node
discoverDevices identifies the list of usable disks on the current node
// List all the valid block devices on the node // Update discovered devices in the  LocalVolumeDiscoveryResult resource