Documentation ¶
Overview ¶
The inventory package ties together the various collectors under utils through its InventoryCollectorAction type.
Index ¶
- Variables
- func UpdateAll(ctx context.Context, device *common.Device, options []*model.UpdateOptions) error
- func UpdateBIOS(ctx context.Context, bios *common.BIOS, options *model.UpdateOptions) error
- func UpdateBMC(ctx context.Context, bmc *common.BMC, options *model.UpdateOptions) error
- func UpdateComponent(ctx context.Context, device *common.Device, option *model.UpdateOptions) error
- func UpdateDrive(ctx context.Context, drives []*common.Drive, options *model.UpdateOptions) error
- func UpdateNIC(ctx context.Context, nics []*common.NIC, options *model.UpdateOptions) error
- func UpdateRequirements(componentSlug, componentVendor, componentModel string) (*model.UpdateRequirements, error)
- type BIOSCollector
- type BIOSConfiguror
- type BIOSUpdater
- type BMCCollector
- type BMCUpdater
- type CPLDCollector
- type CPLDUpdater
- type Collectors
- type DeviceManager
- type DriveCapabilityCollector
- type DriveCollector
- type DriveUpdater
- type DriveWiper
- type FirmwareChecksumCollector
- type Getter
- type InventoryCollector
- type InventoryCollectorAction
- func (a *InventoryCollectorAction) Collect(ctx context.Context, device *common.Device) error
- func (a *InventoryCollectorAction) CollectBIOS(ctx context.Context) (err error)
- func (a *InventoryCollectorAction) CollectBMC(ctx context.Context) (err error)
- func (a *InventoryCollectorAction) CollectCPLDs(ctx context.Context) (err error)
- func (a *InventoryCollectorAction) CollectDriveCapabilities(ctx context.Context) (err error)
- func (a *InventoryCollectorAction) CollectDrives(ctx context.Context) (err error)
- func (a *InventoryCollectorAction) CollectFirmwareChecksums(ctx context.Context) (err error)
- func (a *InventoryCollectorAction) CollectNICs(ctx context.Context) (err error)
- func (a *InventoryCollectorAction) CollectStorageControllers(ctx context.Context) (err error)
- func (a *InventoryCollectorAction) CollectTPMs(ctx context.Context) (err error)
- func (a *InventoryCollectorAction) CollectUEFIVariables(ctx context.Context) (err error)
- type NICCollector
- type NICUpdater
- type Option
- type RaidController
- type Setter
- type StorageControllerAction
- func (s *StorageControllerAction) CreateVirtualDisk(ctx context.Context, hba *common.StorageController, ...) error
- func (s *StorageControllerAction) DestroyVirtualDisk(ctx context.Context, hba *common.StorageController, ...) error
- func (s *StorageControllerAction) GetControllerUtility(vendorName, modelName string) (VirtualDiskManager, error)
- func (s *StorageControllerAction) GetWipeUtility(drive *common.Drive) (DriveWiper, error)
- func (s *StorageControllerAction) ListVirtualDisks(ctx context.Context, hba *common.StorageController) ([]*common.VirtualDisk, error)
- func (s *StorageControllerAction) WipeDrive(ctx context.Context, log *logrus.Logger, drive *common.Drive) error
- type StorageControllerCollector
- type StorageControllerUpdater
- type TPMCollector
- type UEFIVarsCollector
- type UpdateRequirementsGetter
- type Updater
- type Updaters
- type UtilAttributeGetter
- type Utility
- type VirtualDiskCreator
- type VirtualDiskDestroyer
- type VirtualDiskManager
Constants ¶
This section is empty.
Variables ¶
var ( ErrInventoryDeviceObjNil = errors.New("method Inventory() expects a valid device object, got nil") ErrPanic = errors.New("recovered from panic") )
var ( ErrUpdaterUtilNotIdentified = errors.New("updater utility not identifed") ErrVendorComponentOptions = errors.New("component vendor does not match update options vendor attribute") )
var ErrVirtualDiskManagerUtilNotIdentified = errors.New("virtual disk management utility not identifed")
Functions ¶
func UpdateBIOS ¶
UpdateBIOS identifies the bios eligible for update from the inventory and runs the firmware update utility based on the bios vendor
func UpdateBMC ¶
UpdateBMC identifies the bios eligible for update from the inventory and runs the firmware update utility based on the bmc vendor
func UpdateComponent ¶
func UpdateDrive ¶
UpdateDrive identifies the drive eligible for update from the inventory and runs the firmware update utility based on the drive vendor
func UpdateNIC ¶
UpdateNIC identifies the nic eligible for update from the inventory and runs the firmware update utility based on the nic vendor
func UpdateRequirements ¶
func UpdateRequirements(componentSlug, componentVendor, componentModel string) (*model.UpdateRequirements, error)
UpdateRequirements returns requirements to be met before and after a firmware install, the caller may use the information to determine if a powercycle, reconfiguration or other actions are required on the component.
Types ¶
type BIOSCollector ¶
type BIOSCollector interface { UtilAttributeGetter BIOS(ctx context.Context) (*common.BIOS, error) }
BIOSCollector defines an interface to return BIOS inventory
type BIOSConfiguror ¶
type BIOSConfiguror interface { // GetBIOSConfiguration returns the BIOS configuration for the device // deviceModel is an optional parameter depending on the hardware variants GetBIOSConfiguration(ctx context.Context, deviceModel string) (map[string]string, error) }
BIOSConfiguror defines an interface to collect BIOS configuration
type BIOSUpdater ¶
type BIOSUpdater interface { UtilAttributeGetter UpdateBIOS(ctx context.Context, updateFile, modelNumber string) error }
BIOSUpdater defines an interface to update BIOS firmware
func GetBIOSUpdater ¶
func GetBIOSUpdater(vendor string) (BIOSUpdater, error)
GetBIOSUpdater returns the updater for the given vendor
type BMCCollector ¶
BMCCollector defines an interface to return BMC inventory
type BMCUpdater ¶
type BMCUpdater interface { UtilAttributeGetter UpdateBMC(ctx context.Context, updateFile, modelNumber string) error }
BMCUpdater defines an interface to update BMC firmware
func GetBMCUpdater ¶
func GetBMCUpdater(vendor string) (BMCUpdater, error)
GetBMCUpdater returns the updater for the given vendor
type CPLDCollector ¶
type CPLDCollector interface { UtilAttributeGetter CPLDs(ctx context.Context) ([]*common.CPLD, error) }
CPLDCollector defines an interface to return CPLD inventory
type CPLDUpdater ¶
type CPLDUpdater interface { UtilAttributeGetter UpdateCPLD() error }
CPLDUpdater defines an interface to update CPLD firmware
type Collectors ¶
type Collectors struct { InventoryCollector NICCollector BMCCollector CPLDCollector BIOSCollector TPMCollector FirmwareChecksumCollector UEFIVarsCollector StorageControllerCollectors []StorageControllerCollector DriveCollectors []DriveCollector DriveCapabilitiesCollectors []DriveCapabilityCollector }
Collectors is a struct acting as a registry of various inventory collectors
type DeviceManager ¶
DeviceManager interface is returned to the caller when calling ironlib.New()
type DriveCapabilityCollector ¶
type DriveCapabilityCollector interface { UtilAttributeGetter DriveCapabilities(ctx context.Context, logicalName string) ([]*common.Capability, error) }
DriveCapabilityCollector defines an interface to collect disk drive capability attributes
The logicalName is the kernel/OS assigned drive name - /dev/sdX or /dev/nvmeX
type DriveCollector ¶
type DriveCollector interface { UtilAttributeGetter Drives(ctx context.Context) ([]*common.Drive, error) }
DriveCollector defines an interface to return disk drive inventory
func DriveCollectorByStorageControllerVendor ¶
func DriveCollectorByStorageControllerVendor(vendor string, trace bool) DriveCollector
type DriveUpdater ¶
type DriveUpdater interface { UtilAttributeGetter UpdateDrive(ctx context.Context, updateFile, modelNumber, serialNumber string) error }
DriveUpdater defines an interface to update drive firmware
func GetDriveUpdater ¶
func GetDriveUpdater(vendor string) (DriveUpdater, error)
GetDriveUpdater returns the updater for the given vendor
type DriveWiper ¶
type DriveWiper interface { // WipeDrive wipes away all data from the drive, wipe is always verified to have succeeded WipeDrive(context.Context, *logrus.Logger, *common.Drive) error }
DriveWiper defines an interface to override disk data
type FirmwareChecksumCollector ¶
type FirmwareChecksumCollector interface { UtilAttributeGetter // return the sha-256 of the BIOS logo as a string, or the associated error BIOSLogoChecksum(ctx context.Context) (string, error) }
FirmwareChecksumCollector defines an interface to collect firmware checksums
type Getter ¶
type Getter interface { // Get device model GetModel() string // Get device vendor GetVendor() string // Check the device reboot required flag RebootRequired() bool // Check if any updates were applied UpdatesApplied() bool // Retrieve inventory for the device GetInventory(ctx context.Context, options ...Option) (*common.Device, error) // Retrieve inventory using the OEM tooling for the device, GetInventoryOEM(ctx context.Context, device *common.Device, options *model.UpdateOptions) error // List updates identifed by the vendor tooling (DSU for dells) ListAvailableUpdates(ctx context.Context, options *model.UpdateOptions) (*common.Device, error) // Retrieve BIOS configuration for device GetBIOSConfiguration(ctx context.Context) (map[string]string, error) // UpdateRequirements returns requirements to be met before and after a firmware install UpdateRequirements(ctx context.Context, componentSlug, componentVendor, componentModel string) (*model.UpdateRequirements, error) }
Getter interface declares methods implemented by providers to return various attributes.
type InventoryCollector ¶
type InventoryCollector interface { UtilAttributeGetter Collect(ctx context.Context, device *common.Device) error }
InventoryCollector defines an interface to collect all device inventory
type InventoryCollectorAction ¶
type InventoryCollectorAction struct {
// contains filtered or unexported fields
}
InventoryCollectorAction provides methods to collect hardware, firmware inventory.
func NewInventoryCollectorAction ¶
func NewInventoryCollectorAction(ll *logrus.Logger, options ...Option) *InventoryCollectorAction
NewActionrunner returns an Actions runner that is capable of collecting inventory.
func (*InventoryCollectorAction) Collect ¶
Collect collects device inventory data based on the given collectors, the device object fields are updated based on the collected inventory
Inventory expects a device object and optionally a collectors object, when the collectors object provided is nil, the default collectors are added - lshw, smartctl
The lshw collector always executes first and is included by default. nolint:gocyclo //since we're collecting inventory for each type, this is cyclomatic
func (*InventoryCollectorAction) CollectBIOS ¶
func (a *InventoryCollectorAction) CollectBIOS(ctx context.Context) (err error)
CollectBIOS executes the bios collector and updates device bios information
func (*InventoryCollectorAction) CollectBMC ¶
func (a *InventoryCollectorAction) CollectBMC(ctx context.Context) (err error)
CollectBMC executes the bmc collector and updates device bmc information
func (*InventoryCollectorAction) CollectCPLDs ¶
func (a *InventoryCollectorAction) CollectCPLDs(ctx context.Context) (err error)
CollectCPLDs executes the bmc collector and updates device cpld information
func (*InventoryCollectorAction) CollectDriveCapabilities ¶
func (a *InventoryCollectorAction) CollectDriveCapabilities(ctx context.Context) (err error)
CollectDriveCapabilities executes drive capability collectors
The capability collector is identified based on the drive logical name.
func (*InventoryCollectorAction) CollectDrives ¶
func (a *InventoryCollectorAction) CollectDrives(ctx context.Context) (err error)
CollectDrives executes drive collectors and merges the data into device.[]*Drive nolint:gocyclo // TODO(joel) if theres more conditionals to be added in here, the method is to be split up.
func (*InventoryCollectorAction) CollectFirmwareChecksums ¶
func (a *InventoryCollectorAction) CollectFirmwareChecksums(ctx context.Context) (err error)
CollectFirmwareChecksums executes the Firmware checksum collector and updates the component metadata.
func (*InventoryCollectorAction) CollectNICs ¶
func (a *InventoryCollectorAction) CollectNICs(ctx context.Context) (err error)
CollectNICs executes nic collectors and merges the nic data into device.[]*NIC
func (*InventoryCollectorAction) CollectStorageControllers ¶
func (a *InventoryCollectorAction) CollectStorageControllers(ctx context.Context) (err error)
CollectStorageControllers executes the StorageControllers collectors and updates device storage controller data
func (*InventoryCollectorAction) CollectTPMs ¶
func (a *InventoryCollectorAction) CollectTPMs(ctx context.Context) (err error)
CollectTPMs executes the TPM collector and updates device TPM information
func (*InventoryCollectorAction) CollectUEFIVariables ¶
func (a *InventoryCollectorAction) CollectUEFIVariables(ctx context.Context) (err error)
CollectUEFIVariables executes the UEFI variable collector and stores them on the device object
type NICCollector ¶
type NICCollector interface { UtilAttributeGetter NICs(ctx context.Context) ([]*common.NIC, error) }
NICCollector defines an interface to returns NIC inventory
type NICUpdater ¶
type NICUpdater interface { UtilAttributeGetter UpdateRequirementsGetter UpdateNIC(ctx context.Context, updateFile, modelNumber string, force bool) error }
NICUpdater defines an interface to update NIC firmware
func GetNICUpdater ¶
func GetNICUpdater(vendor string) (NICUpdater, error)
GetNICUpdater returns the updater for the given vendor
type Option ¶
type Option func(*InventoryCollectorAction)
Option returns a function that sets a InventoryCollectorAction parameter
func WithCollectors ¶
func WithCollectors(collectors *Collectors) Option
WithCollectors sets collectors to the ones passed in as a parameter.
func WithDisabledCollectorUtilities ¶
func WithDisabledCollectorUtilities(utilityNames []model.CollectorUtility) Option
WithDisabledCollectorUtilities disables the given collector utilities.
func WithDynamicCollection ¶
func WithDynamicCollection() Option
DynamicCollection when enabled will cause ironlib to identify collectors based on the detected component vendor.
func WithFailOnError ¶
func WithFailOnError() Option
WithFailOnError sets the InventoryCollectorAction to return on any error that may occur when collecting inventory.
By default the InventoryCollectorAction continues to collect inventory even if one or more collectors fail.
func WithTraceLevel ¶
func WithTraceLevel() Option
WithTraceLevel sets trace level logging on the action runner.
type RaidController ¶
type RaidController interface { VirtualDiskCreator VirtualDiskDestroyer }
RaidController interface declares methods to manage virtual disks.
type StorageControllerAction ¶
type StorageControllerAction struct { Logger *logrus.Logger // contains filtered or unexported fields }
func NewStorageControllerAction ¶
func NewStorageControllerAction(logger *logrus.Logger) *StorageControllerAction
func (*StorageControllerAction) CreateVirtualDisk ¶
func (s *StorageControllerAction) CreateVirtualDisk(ctx context.Context, hba *common.StorageController, options *model.CreateVirtualDiskOptions) error
func (*StorageControllerAction) DestroyVirtualDisk ¶
func (s *StorageControllerAction) DestroyVirtualDisk(ctx context.Context, hba *common.StorageController, options *model.DestroyVirtualDiskOptions) error
func (*StorageControllerAction) GetControllerUtility ¶
func (s *StorageControllerAction) GetControllerUtility(vendorName, modelName string) (VirtualDiskManager, error)
GetControllerUtility returns the utility command for the given vendor
func (*StorageControllerAction) GetWipeUtility ¶
func (s *StorageControllerAction) GetWipeUtility(drive *common.Drive) (DriveWiper, error)
GetWipeUtility returns the wipe utility based on the disk wipping features
func (*StorageControllerAction) ListVirtualDisks ¶
func (s *StorageControllerAction) ListVirtualDisks(ctx context.Context, hba *common.StorageController) ([]*common.VirtualDisk, error)
type StorageControllerCollector ¶
type StorageControllerCollector interface { UtilAttributeGetter StorageControllers(ctx context.Context) ([]*common.StorageController, error) }
StorageControllerCollector defines an interface to returns storage controllers inventory
func StorageControllerCollectorByVendor ¶
func StorageControllerCollectorByVendor(vendor string, trace bool) StorageControllerCollector
type StorageControllerUpdater ¶
type StorageControllerUpdater interface { UtilAttributeGetter UpdateStorageController() error }
StorageControllerUpdater defines an interface to update storage controller firmware
type TPMCollector ¶
type TPMCollector interface { UtilAttributeGetter TPMs(ctx context.Context) ([]*common.TPM, error) }
TPMCollector defines an interface to collect TPM device inventory
type UEFIVarsCollector ¶
type UEFIVarsCollector interface { UtilAttributeGetter GetUEFIVars(ctx context.Context) (utils.UEFIVars, error) }
UEFIVarsCollector defines an interface to collect EFI variables
type UpdateRequirementsGetter ¶
type UpdateRequirementsGetter interface {
UpdateRequirements(componentModel string) *model.UpdateRequirements
}
UpdateRequirements returns requirements to be met before and after a firmware install, the caller may use the information to determine if a powercycle, reconfiguration or other actions are required on the component.
type Updater ¶
type Updater interface { // ApplyUpdate is to be deprecated in favor of InstallUpdates, its implementations are to be moved // to use InstallUpdates. ApplyUpdate(ctx context.Context, updateFile, component string) error // InstallUpdates installs updates based on the update options InstallUpdates(ctx context.Context, options *model.UpdateOptions) error }
Updater defines an interface to install an update file
type Updaters ¶
type Updaters struct { Drives DriveUpdater NICs NICUpdater BMC BMCUpdater BIOS BIOSUpdater StorageControllers StorageControllerUpdater }
Updaters is a struct acting as a registry of various hardware component updaters
type UtilAttributeGetter ¶
type UtilAttributeGetter interface {
Attributes() (utilName model.CollectorUtility, absolutePath string, err error)
}
UtilAttributeGetter defines methods to retrieve utility attributes.
type Utility ¶
type Utility interface { BIOSConfiguror InventoryCollector Updater }
Utility interface couples the configuration, collection and update interfaces
type VirtualDiskCreator ¶
type VirtualDiskCreator interface {
CreateVirtualDisk(ctx context.Context, raidMode string, physicalDisks []uint, name string, blockSize uint) error
}
VirtualDiskCreator defines an interface to create virtual disks, generally via a StorageController
type VirtualDiskDestroyer ¶
type VirtualDiskDestroyer interface {
DestroyVirtualDisk(ctx context.Context, virtualDiskID int) error
}
VirtualDiskCreator defines an interface to destroy virtual disks, generally via a StorageController
type VirtualDiskManager ¶
type VirtualDiskManager interface { VirtualDiskCreator VirtualDiskDestroyer VirtualDisks(ctx context.Context) ([]*utils.MvcliDevice, error) }