Documentation ¶
Overview ¶
The inventory package ties together the various collectors under utils through its InventoryCollectorAction type.
Index ¶
- Variables
- func Update(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 UpdateDrive(ctx context.Context, drives []*common.Drive, options *model.UpdateOptions) error
- func UpdateNIC(ctx context.Context, nics []*common.NIC, options *model.UpdateOptions) 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 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) error
- func (a *InventoryCollectorAction) CollectBMC(ctx context.Context) error
- func (a *InventoryCollectorAction) CollectCPLDs(ctx context.Context) error
- func (a *InventoryCollectorAction) CollectDriveCapabilities(ctx context.Context) error
- func (a *InventoryCollectorAction) CollectDrives(ctx context.Context) error
- func (a *InventoryCollectorAction) CollectFirmwareChecksums(ctx context.Context) error
- func (a *InventoryCollectorAction) CollectNICs(ctx context.Context) error
- func (a *InventoryCollectorAction) CollectStorageControllers(ctx context.Context) error
- func (a *InventoryCollectorAction) CollectTPMs(ctx context.Context) error
- func (a *InventoryCollectorAction) CollectUEFIVariables(ctx context.Context) 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) ListVirtualDisks(ctx context.Context, hba *common.StorageController) ([]*common.VirtualDisk, error)
- type StorageControllerCollector
- type StorageControllerUpdater
- type TPMCollector
- type UEFIVarsCollector
- 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 UpdateDrive ¶
UpdateDrive identifies the drive eligible for update from the inventory and runs the firmware update utility based on the drive vendor
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
func (*Collectors) Empty ¶ added in v0.2.4
func (c *Collectors) Empty() bool
Empty returns a bool value
type DeviceManager ¶ added in v0.2.4
DeviceManager interface is returned to the caller when calling ironlib.New()
type DriveCapabilityCollector ¶ added in v0.2.0
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 ¶ added in v0.2.0
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 FirmwareChecksumCollector ¶ added in v0.2.15
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 ¶ added in v0.2.4
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) }
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 ¶ added in v0.2.4
type InventoryCollectorAction struct {
// contains filtered or unexported fields
}
InventoryCollectorAction provides methods to collect hardware, firmware inventory.
func NewInventoryCollectorAction ¶ added in v0.2.4
func NewInventoryCollectorAction(options ...Option) *InventoryCollectorAction
NewActionrunner returns an Actions runner that is capable of collecting inventory.
func (*InventoryCollectorAction) Collect ¶ added in v0.2.4
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 ¶ added in v0.2.4
func (a *InventoryCollectorAction) CollectBIOS(ctx context.Context) error
CollectBIOS executes the bios collector and updates device bios information
func (*InventoryCollectorAction) CollectBMC ¶ added in v0.2.4
func (a *InventoryCollectorAction) CollectBMC(ctx context.Context) error
CollectBMC executes the bmc collector and updates device bmc information
func (*InventoryCollectorAction) CollectCPLDs ¶ added in v0.2.4
func (a *InventoryCollectorAction) CollectCPLDs(ctx context.Context) error
CollectCPLDs executes the bmc collector and updates device cpld information
func (*InventoryCollectorAction) CollectDriveCapabilities ¶ added in v0.2.4
func (a *InventoryCollectorAction) CollectDriveCapabilities(ctx context.Context) error
CollectDriveCapabilities executes drive capability collectors
The capability collector is identified based on the drive logical name.
func (*InventoryCollectorAction) CollectDrives ¶ added in v0.2.4
func (a *InventoryCollectorAction) CollectDrives(ctx context.Context) 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 ¶ added in v0.2.15
func (a *InventoryCollectorAction) CollectFirmwareChecksums(ctx context.Context) error
CollectFirmwareChecksums executes the Firmware checksum collector and updates the component metadata.
func (*InventoryCollectorAction) CollectNICs ¶ added in v0.2.4
func (a *InventoryCollectorAction) CollectNICs(ctx context.Context) error
CollectNICs executes nic collectors and merges the nic data into device.[]*NIC
nolint:gocyclo // this is fine for now.
func (*InventoryCollectorAction) CollectStorageControllers ¶ added in v0.2.4
func (a *InventoryCollectorAction) CollectStorageControllers(ctx context.Context) error
CollectStorageControllers executes the StorageControllers collectors and updates device storage controller data
nolint:gocyclo // this is fine for now
func (*InventoryCollectorAction) CollectTPMs ¶ added in v0.2.4
func (a *InventoryCollectorAction) CollectTPMs(ctx context.Context) error
CollectTPMs executes the TPM collector and updates device TPM information
func (*InventoryCollectorAction) CollectUEFIVariables ¶ added in v0.2.15
func (a *InventoryCollectorAction) CollectUEFIVariables(ctx context.Context) 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 UpdateNIC(ctx context.Context, updateFile, modelNumber string) 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 ¶ added in v0.2.4
type Option func(*InventoryCollectorAction)
Option returns a function that sets a InventoryCollectorAction parameter
func WithCollectors ¶ added in v0.2.4
func WithCollectors(collectors *Collectors) Option
WithCollectors sets collectors to the ones passed in as a parameter.
func WithDisabledCollectorUtilities ¶ added in v0.2.4
func WithDisabledCollectorUtilities(utilityNames []model.CollectorUtility) Option
WithDisabledCollectorUtilities disables the given collector utilities.
func WithDynamicCollection ¶ added in v0.2.4
func WithDynamicCollection() Option
DynamicCollection when enabled will cause ironlib to identify collectors based on the detected component vendor.
func WithFailOnError ¶ added in v0.2.4
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 ¶ added in v0.2.4
func WithTraceLevel() Option
WithTraceLevel sets trace level logging on the action runner.
type RaidController ¶ added in v0.2.4
type RaidController interface { VirtualDiskCreator VirtualDiskDestroyer }
RaidController interface declares methods to manage virtual disks.
type StorageControllerAction ¶ added in v0.2.3
func NewStorageControllerAction ¶ added in v0.2.3
func NewStorageControllerAction(logger *logrus.Logger) *StorageControllerAction
func (*StorageControllerAction) CreateVirtualDisk ¶ added in v0.2.3
func (s *StorageControllerAction) CreateVirtualDisk(ctx context.Context, hba *common.StorageController, options *model.CreateVirtualDiskOptions) error
func (*StorageControllerAction) DestroyVirtualDisk ¶ added in v0.2.3
func (s *StorageControllerAction) DestroyVirtualDisk(ctx context.Context, hba *common.StorageController, options *model.DestroyVirtualDiskOptions) error
func (*StorageControllerAction) GetControllerUtility ¶ added in v0.2.3
func (s *StorageControllerAction) GetControllerUtility(vendorName, modelName string) (VirtualDiskManager, error)
GetControllerUtility returns the utility command for the given vendor
func (*StorageControllerAction) ListVirtualDisks ¶ added in v0.2.3
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 ¶ added in v0.2.0
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 ¶ added in v0.2.15
type UEFIVarsCollector interface { UtilAttributeGetter GetUEFIVars(ctx context.Context) (utils.UEFIVars, error) }
UEFIVarsCollector defines an interface to collect EFI variables
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 ¶ added in v0.2.2
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 ¶ added in v0.2.0
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 ¶ added in v0.2.0
type VirtualDiskDestroyer interface {
DestroyVirtualDisk(ctx context.Context, virtualDiskID int) error
}
VirtualDiskCreator defines an interface to destroy virtual disks, generally via a StorageController
type VirtualDiskManager ¶ added in v0.2.0
type VirtualDiskManager interface { VirtualDiskCreator VirtualDiskDestroyer VirtualDisks(ctx context.Context) ([]*utils.MvcliDevice, error) }