Documentation
¶
Index ¶
- Constants
- func BindFlags(fs *flag.FlagSet)
- func CleanupVolumes(providingVolumes []ProvidingVolume)
- func Close() error
- func ConvertRelativePortIndexToControllerIndex(index uint32) (uint16, error)
- func EnumerateStorage(...) error
- func GetWearLevelAsPercentageUsed(dev NvmeDeviceApi) (uint8, error)
- func Initialize(log ec.Logger, ctrl NvmeController) error
- func NewDefaultApiRouter(s Api, c NvmeController) ec.Router
- func StartNVMeMonitor(log ec.Logger)
- type Api
- type ConfigFile
- type ControllerConfig
- type DefaultApiRouter
- type DefaultApiService
- func (s *DefaultApiService) RedfishV1StorageGet(w http.ResponseWriter, r *http.Request)
- func (s *DefaultApiService) RedfishV1StorageStorageIdControllersControllerIdGet(w http.ResponseWriter, r *http.Request)
- func (s *DefaultApiService) RedfishV1StorageStorageIdControllersGet(w http.ResponseWriter, r *http.Request)
- func (s *DefaultApiService) RedfishV1StorageStorageIdGet(w http.ResponseWriter, r *http.Request)
- func (s *DefaultApiService) RedfishV1StorageStorageIdStoragePoolsGet(w http.ResponseWriter, r *http.Request)
- func (s *DefaultApiService) RedfishV1StorageStorageIdStoragePoolsStoragePoolIdGet(w http.ResponseWriter, r *http.Request)
- func (s *DefaultApiService) RedfishV1StorageStorageIdVolumesGet(w http.ResponseWriter, r *http.Request)
- func (s *DefaultApiService) RedfishV1StorageStorageIdVolumesPost(w http.ResponseWriter, r *http.Request)
- func (s *DefaultApiService) RedfishV1StorageStorageIdVolumesVolumeIdDelete(w http.ResponseWriter, r *http.Request)
- func (s *DefaultApiService) RedfishV1StorageStorageIdVolumesVolumeIdGet(w http.ResponseWriter, r *http.Request)
- type DirectNvmeController
- type DirectNvmeDeviceController
- type Manager
- func (m *Manager) EventHandler(e event.Event) error
- func (mgr *Manager) Get(model *sf.StorageCollectionStorageCollection) error
- func (m *Manager) GetVolumes(controllerId string) ([]string, error)
- func (mgr *Manager) StorageIdControllersControllerIdGet(storageId, controllerId string, ...) error
- func (mgr *Manager) StorageIdControllersGet(storageId string, ...) error
- func (mgr *Manager) StorageIdGet(storageId string, model *sf.StorageV190Storage) error
- func (mgr *Manager) StorageIdStoragePoolsGet(storageId string, model *sf.StoragePoolCollectionStoragePoolCollection) error
- func (mgr *Manager) StorageIdStoragePoolsStoragePoolIdGet(storageId, storagePoolId string, model *sf.StoragePoolV150StoragePool) error
- func (mgr *Manager) StorageIdVolumeIdDelete(storageId, volumeId string) error
- func (mgr *Manager) StorageIdVolumeIdGet(storageId, volumeId string, model *sf.VolumeV161Volume) error
- func (mgr *Manager) StorageIdVolumesGet(storageId string, model *sf.VolumeCollectionVolumeCollection) error
- func (mgr *Manager) StorageIdVolumesPost(storageId string, model *sf.VolumeV161Volume) error
- type MockNvmeController
- type MockNvmeDeviceController
- type MockNvmePersistenceManager
- type Monitor
- type NvmeController
- type NvmeDeviceApi
- type NvmeDeviceController
- type ProvidingVolume
- type SecondaryControllerHandlerFunc
- type SecondaryControllerResourceType
- type SecondaryControllersInitFunc
- type Storage
- func (s *Storage) FindVolume(id string) *Volume
- func (s *Storage) FindVolumeByNamespaceId(namespaceId nvme.NamespaceIdentifier) (*Volume, error)
- func (s *Storage) IsEnabled() bool
- func (s *Storage) IsKioxiaDualPortConfiguration() bool
- func (s *Storage) LinkDroppedEventHandler() error
- func (s *Storage) LinkEstablishedEventHandler(switchId, portId string) error
- func (s *Storage) OdataId() string
- func (s *Storage) OdataIdRef(ref string) sf.OdataV4IdRef
- func (s *Storage) Rescan() error
- func (s *Storage) SerialNumber() string
- func (s *Storage) Slot() int64
- func (s *Storage) UnallocatedBytes() uint64
- type StorageApi
- type StorageConfig
- type StorageController
- type SwitchtecNvmeController
- type SwitchtecNvmeDeviceController
- type Volume
- func (v *Volume) AttachController(controllerId uint16) error
- func (v *Volume) AttachControllerIfUnattached(controllerIndex uint16) error
- func (v *Volume) Delete() error
- func (v *Volume) DetachController(controllerId uint16) error
- func (v *Volume) Format() error
- func (v *Volume) GetCapacityBytes() uint64
- func (v *Volume) GetGloballyUniqueIdentifier() nvme.NamespaceGloballyUniqueIdentifier
- func (v *Volume) GetNamespaceId() nvme.NamespaceIdentifier
- func (v *Volume) GetOdataId() string
- func (v *Volume) Id() string
- func (v *Volume) SetFeature(data []byte) error
- func (v *Volume) WaitFormatComplete() error
Constants ¶
const ( ResourceBlockId = "Rabbit" // TODO: The ALL_CAPS name in nvme package should be renamed to a valid Go name CommonNamespaceIdentifier = nvme.COMMON_NAMESPACE_IDENTIFIER // Physical Function controller index PhysicalFunctionControllerIndex = 0 )
const (
DefaultFeatureType = 1
)
const (
DefaultStoragePoolId = "0"
)
Variables ¶
This section is empty.
Functions ¶
func CleanupVolumes ¶
func CleanupVolumes(providingVolumes []ProvidingVolume)
CleanupVolumes - remove all volumes other than the list of providingVolumes
func EnumerateStorage ¶
func GetWearLevelAsPercentageUsed ¶ added in v0.1.10
func GetWearLevelAsPercentageUsed(dev NvmeDeviceApi) (uint8, error)
GetWearLevelAsPercentageUsed returns the PercentageUsed field from the SMART log page.
func Initialize ¶
func Initialize(log ec.Logger, ctrl NvmeController) error
Initialize the controller
func NewDefaultApiRouter ¶
func NewDefaultApiRouter(s Api, c NvmeController) ec.Router
NewDefaultApiRouter -
func StartNVMeMonitor ¶ added in v0.1.10
StartNVMeMonitor starts a background goroutine that periodically queries all NVMe devices for their SMART log.
Types ¶
type Api ¶
type Api interface {
RedfishV1StorageGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdStoragePoolsGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdStoragePoolsStoragePoolIdGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdControllersGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdControllersControllerIdGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdVolumesGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdVolumesPost(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdVolumesVolumeIdGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdVolumesVolumeIdDelete(w http.ResponseWriter, r *http.Request)
}
Api - defines an interface for Near-Node Flash related methods
type ConfigFile ¶
type ConfigFile struct {
Version string
Metadata struct {
Name string
}
Storage StorageConfig
}
type ControllerConfig ¶
type DefaultApiRouter ¶
type DefaultApiRouter struct {
// contains filtered or unexported fields
}
DefaultApiRouter -
type DefaultApiService ¶
type DefaultApiService struct {
// contains filtered or unexported fields
}
DefaultApiService -
func (*DefaultApiService) RedfishV1StorageGet ¶
func (s *DefaultApiService) RedfishV1StorageGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageGet
func (*DefaultApiService) RedfishV1StorageStorageIdControllersControllerIdGet ¶
func (s *DefaultApiService) RedfishV1StorageStorageIdControllersControllerIdGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdControllersControllerIdGet
func (*DefaultApiService) RedfishV1StorageStorageIdControllersGet ¶
func (s *DefaultApiService) RedfishV1StorageStorageIdControllersGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdControllersGet
func (*DefaultApiService) RedfishV1StorageStorageIdGet ¶
func (s *DefaultApiService) RedfishV1StorageStorageIdGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdGet
func (*DefaultApiService) RedfishV1StorageStorageIdStoragePoolsGet ¶
func (s *DefaultApiService) RedfishV1StorageStorageIdStoragePoolsGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdStoragePoolsGet
func (*DefaultApiService) RedfishV1StorageStorageIdStoragePoolsStoragePoolIdGet ¶
func (s *DefaultApiService) RedfishV1StorageStorageIdStoragePoolsStoragePoolIdGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdStoragePoolsStoragePoolIdGet
func (*DefaultApiService) RedfishV1StorageStorageIdVolumesGet ¶
func (s *DefaultApiService) RedfishV1StorageStorageIdVolumesGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdVolumesGet
func (*DefaultApiService) RedfishV1StorageStorageIdVolumesPost ¶
func (s *DefaultApiService) RedfishV1StorageStorageIdVolumesPost(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdVolumesPost
func (*DefaultApiService) RedfishV1StorageStorageIdVolumesVolumeIdDelete ¶
func (s *DefaultApiService) RedfishV1StorageStorageIdVolumesVolumeIdDelete(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdVolumesVolumeIdDelete -
func (*DefaultApiService) RedfishV1StorageStorageIdVolumesVolumeIdGet ¶
func (s *DefaultApiService) RedfishV1StorageStorageIdVolumesVolumeIdGet(w http.ResponseWriter, r *http.Request)
RedfishV1StorageStorageIdVolumesVolumeIdGet -
type DirectNvmeController ¶
type DirectNvmeController struct {
// contains filtered or unexported fields
}
func (*DirectNvmeController) NewNvmeDeviceController ¶
func (c *DirectNvmeController) NewNvmeDeviceController() NvmeDeviceController
type DirectNvmeDeviceController ¶
type DirectNvmeDeviceController struct {
// contains filtered or unexported fields
}
func (*DirectNvmeDeviceController) Close ¶
func (c *DirectNvmeDeviceController) Close() error
func (*DirectNvmeDeviceController) Initialize ¶
func (c *DirectNvmeDeviceController) Initialize() error
func (*DirectNvmeDeviceController) NewNvmeDevice ¶
func (c *DirectNvmeDeviceController) NewNvmeDevice(fabricId string, switchId string, portId string) (NvmeDeviceApi, error)
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager -
func (*Manager) Get ¶
func (mgr *Manager) Get(model *sf.StorageCollectionStorageCollection) error
Get -
func (*Manager) GetVolumes ¶
GetVolumes -
func (*Manager) StorageIdControllersControllerIdGet ¶
func (mgr *Manager) StorageIdControllersControllerIdGet(storageId, controllerId string, model *sf.StorageControllerV100StorageController) error
StorageIdControllersControllerIdGet -
func (*Manager) StorageIdControllersGet ¶
func (mgr *Manager) StorageIdControllersGet(storageId string, model *sf.StorageControllerCollectionStorageControllerCollection) error
StorageIdControllersGet -
func (*Manager) StorageIdGet ¶
func (mgr *Manager) StorageIdGet(storageId string, model *sf.StorageV190Storage) error
StorageIdGet -
func (*Manager) StorageIdStoragePoolsGet ¶
func (mgr *Manager) StorageIdStoragePoolsGet(storageId string, model *sf.StoragePoolCollectionStoragePoolCollection) error
StorageIdStoragePoolsGet -
func (*Manager) StorageIdStoragePoolsStoragePoolIdGet ¶
func (mgr *Manager) StorageIdStoragePoolsStoragePoolIdGet(storageId, storagePoolId string, model *sf.StoragePoolV150StoragePool) error
StorageIdStoragePoolsStoragePoolIdGet -
func (*Manager) StorageIdVolumeIdDelete ¶
StorageIdVolumeIdDelete -
func (*Manager) StorageIdVolumeIdGet ¶
func (mgr *Manager) StorageIdVolumeIdGet(storageId, volumeId string, model *sf.VolumeV161Volume) error
StorageIdVolumeIdGet -
func (*Manager) StorageIdVolumesGet ¶
func (mgr *Manager) StorageIdVolumesGet(storageId string, model *sf.VolumeCollectionVolumeCollection) error
StorageIdVolumesGet -
func (*Manager) StorageIdVolumesPost ¶
func (mgr *Manager) StorageIdVolumesPost(storageId string, model *sf.VolumeV161Volume) error
StorageIdVolumesPost -
type MockNvmeController ¶
type MockNvmeController struct {
// contains filtered or unexported fields
}
func (MockNvmeController) NewNvmeDeviceController ¶
func (ctrl MockNvmeController) NewNvmeDeviceController() NvmeDeviceController
type MockNvmeDeviceController ¶
type MockNvmeDeviceController struct {
// contains filtered or unexported fields
}
func (*MockNvmeDeviceController) Close ¶
func (ctrl *MockNvmeDeviceController) Close() error
func (*MockNvmeDeviceController) Initialize ¶
func (ctrl *MockNvmeDeviceController) Initialize() error
func (MockNvmeDeviceController) NewNvmeDevice ¶
func (ctrl MockNvmeDeviceController) NewNvmeDevice(fabricId, switchId, portId string) (NvmeDeviceApi, error)
type MockNvmePersistenceManager ¶
type MockNvmePersistenceManager struct {
// contains filtered or unexported fields
}
type Monitor ¶ added in v0.1.10
type Monitor struct {
Log ec.Logger
Interval time.Duration
GetDevices func() []*nvme.Device // Function to return all NVMe devices
}
Monitor periodically queries all NVMe devices for their SMART log and can be started as a background goroutine.
func NewMonitor ¶ added in v0.1.10
NewMonitor creates a new NVMe monitor with the given polling interval and device getter.
type NvmeController ¶
type NvmeController interface {
NewNvmeDeviceController() NvmeDeviceController
}
func NewCliNvmeController ¶
func NewCliNvmeController() NvmeController
func NewDirectDeviceNvmeController ¶
func NewDirectDeviceNvmeController(deviceRegexp string) NvmeController
func NewMockNvmeController ¶
func NewMockNvmeController(persistence bool) NvmeController
func NewSwitchtecNvmeController ¶
func NewSwitchtecNvmeController() NvmeController
type NvmeDeviceApi ¶
type NvmeDeviceApi interface {
IsDirectDevice() bool
IdentifyController(controllerId uint16) (*nvme.IdCtrl, error)
IdentifyNamespace(namespaceId nvme.NamespaceIdentifier) (*nvme.IdNs, error)
ListSecondary() (*nvme.SecondaryControllerList, error)
AssignControllerResources(
controllerId uint16,
resourceType SecondaryControllerResourceType,
numResources uint32) error
OnlineController(controllerId uint16) error
ListNamespaces(controllerId uint16) ([]nvme.NamespaceIdentifier, error)
ListAttachedControllers(namespaceId nvme.NamespaceIdentifier) ([]uint16, error)
CreateNamespace(sizeInSectors uint64, sectorSizeIndex uint8) (nvme.NamespaceIdentifier, nvme.NamespaceGloballyUniqueIdentifier, error)
DeleteNamespace(namespaceId nvme.NamespaceIdentifier) error
FormatNamespace(namespaceID nvme.NamespaceIdentifier) error
AttachNamespace(namespaceId nvme.NamespaceIdentifier, controllers []uint16) error
DetachNamespace(namespaceId nvme.NamespaceIdentifier, controllers []uint16) error
SetNamespaceFeature(namespaceId nvme.NamespaceIdentifier, data []byte) error
GetNamespaceFeature(namespaceId nvme.NamespaceIdentifier) ([]byte, error)
// GetSmartLog returns the raw SMART log page data
GetSmartLog() (*nvme.SmartLog, error)
}
NvmeDeviceApi -
type NvmeDeviceController ¶
type NvmeDeviceController interface {
Initialize() error
Close() error
NewNvmeDevice(fabricId, switchId, portId string) (NvmeDeviceApi, error)
}
type ProvidingVolume ¶
ProvidingVolume - volume as part of a storage pool
type SecondaryControllerHandlerFunc ¶
type SecondaryControllerHandlerFunc func(controllerId uint16, controllerOnline bool, virtualFunctionNumber uint16, numVQResourcesAssinged, numVIResourcesAssigned uint32) error
SecondaryControllerHandlerFunc -
type SecondaryControllerResourceType ¶
type SecondaryControllerResourceType int
SecondaryControllerResourceType -
const ( VQResourceType SecondaryControllerResourceType = iota VIResourceType )
type SecondaryControllersInitFunc ¶
type SecondaryControllersInitFunc func(count uint8)
SecondaryControllersInitFunc -
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage - Storage defines a generic storage device in the Redfish / Swordfish specification. In the NNF implementation
func GetStorage ¶
func GetStorage() []*Storage
func (*Storage) FindVolume ¶
func (*Storage) FindVolumeByNamespaceId ¶
func (s *Storage) FindVolumeByNamespaceId(namespaceId nvme.NamespaceIdentifier) (*Volume, error)
func (*Storage) IsKioxiaDualPortConfiguration ¶
func (*Storage) LinkDroppedEventHandler ¶
func (*Storage) LinkEstablishedEventHandler ¶
func (*Storage) OdataIdRef ¶
func (s *Storage) OdataIdRef(ref string) sf.OdataV4IdRef
func (*Storage) SerialNumber ¶
func (*Storage) UnallocatedBytes ¶
type StorageApi ¶
type StorageApi interface {
Get(*sf.StorageCollectionStorageCollection) error
StorageIdGet(string, *sf.StorageV190Storage) error
StorageIdStoragePoolsGet(string, *sf.StoragePoolCollectionStoragePoolCollection) error
StorageIdStoragePoolsStoragePoolIdGet(string, string, *sf.StoragePoolV150StoragePool) error
StorageIdControllersGet(string, *sf.StorageControllerCollectionStorageControllerCollection) error
StorageIdControllersControllerIdGet(string, string, *sf.StorageControllerV100StorageController) error
StorageIdVolumesGet(string, *sf.VolumeCollectionVolumeCollection) error
StorageIdVolumesPost(string, *sf.VolumeV161Volume) error
StorageIdVolumeIdGet(string, string, *sf.VolumeV161Volume) error
StorageIdVolumeIdDelete(string, string) error
}
func NewDefaultStorageService ¶
func NewDefaultStorageService() StorageApi
type StorageConfig ¶
type StorageConfig struct {
Controller ControllerConfig
Devices []string `yaml:",flow"`
}
type StorageController ¶
type StorageController struct {
// contains filtered or unexported fields
}
StorageController -
type SwitchtecNvmeController ¶
type SwitchtecNvmeController struct{}
func (SwitchtecNvmeController) NewNvmeDeviceController ¶
func (SwitchtecNvmeController) NewNvmeDeviceController() NvmeDeviceController
type SwitchtecNvmeDeviceController ¶
type SwitchtecNvmeDeviceController struct{}
func (SwitchtecNvmeDeviceController) Close ¶
func (SwitchtecNvmeDeviceController) Close() error
func (SwitchtecNvmeDeviceController) Initialize ¶
func (SwitchtecNvmeDeviceController) Initialize() error
func (SwitchtecNvmeDeviceController) NewNvmeDevice ¶
func (SwitchtecNvmeDeviceController) NewNvmeDevice(fabricId, switchId, portId string) (NvmeDeviceApi, error)
type Volume ¶
type Volume struct {
// contains filtered or unexported fields
}
Volumes -
func (*Volume) AttachController ¶
func (*Volume) AttachControllerIfUnattached ¶ added in v0.1.7
AttachControllerIfUnattached ensures that a specified controller is attached to the volume. If the controller is not already attached, it attempts to attach it.
Parameters:
- controllerIndex: The index of the controller to check and attach if necessary.
Returns:
- error: An error if the operation to list or attach controllers fails, otherwise nil.
This function logs detailed information about the operation, including the storage ID, volume ID, controller index, and controller ID. It also logs the list of currently attached controllers and whether a reattachment is performed.
func (*Volume) DetachController ¶
func (*Volume) GetCapacityBytes ¶ added in v0.1.2
func (*Volume) GetGloballyUniqueIdentifier ¶
func (v *Volume) GetGloballyUniqueIdentifier() nvme.NamespaceGloballyUniqueIdentifier
func (*Volume) GetNamespaceId ¶
func (v *Volume) GetNamespaceId() nvme.NamespaceIdentifier
func (*Volume) GetOdataId ¶
func (*Volume) SetFeature ¶
func (*Volume) WaitFormatComplete ¶
WaitFormatComplete waits for Format Completion by polling until the namespace Utilization reaches zero.