diff --git a/pkg/controller.go b/pkg/controller.go index a016f7b..b9e5937 100644 --- a/pkg/controller.go +++ b/pkg/controller.go @@ -1,5 +1,5 @@ /* - * Copyright 2020, 2021, 2022 Hewlett Packard Enterprise Development LP + * Copyright 2020-2024 Hewlett Packard Enterprise Development LP * Other additional copyright holders may be indicated within. * * The entirety of this work is licensed under the Apache License, @@ -52,12 +52,13 @@ const ( ) type Options struct { - mock bool // Enable mock interfaces for Switches, NVMe, and NNF - cli bool // Enable CLI commands instead of binary - persistence bool // Enable persistent object storage; used during crash/reboot recovery - json string // Initialize the element controller with the provided json file - direct string // Enable direct management of NVMe devices matching this regexp pattern - InitializeAndExit bool // Initialize all controllers then exit without starting the http server (mfg use) + mock bool // Enable mock interfaces for Switches, NVMe, and NNF + cli bool // Enable CLI commands instead of binary + persistence bool // Enable persistent object storage; used during crash/reboot recovery + json string // Initialize the element controller with the provided json file + direct string // Enable direct management of NVMe devices matching this regexp pattern + InitializeAndExit bool // Initialize all controllers then exit without starting the http server (mfg use) + DeleteUnknownVolumes bool // Delete volumes not represented by a storage pool at the end of initialization } func newDefaultOptions() *Options { @@ -77,6 +78,7 @@ func BindFlags(fs *flag.FlagSet) *Options { fs.StringVar(&opts.json, "json", "", "Initialize database with provided json file") fs.StringVar(&opts.direct, "direct", opts.direct, "Enable direct management of NVMe block devices matching this regexp pattern. Implies Mock.") fs.BoolVar(&opts.InitializeAndExit, "initializeAndExit", opts.InitializeAndExit, "Initialize all hardware controllers, then exit without starting the http server. Useful in hardware bringup") + fs.BoolVar(&opts.DeleteUnknownVolumes, "deleteUnknownVolumes", opts.DeleteUnknownVolumes, "Delete volumes not represented by storage pools") nvme.BindFlags(fs) diff --git a/pkg/ec/ec.go b/pkg/ec/ec.go index 4c947f7..6286c0c 100644 --- a/pkg/ec/ec.go +++ b/pkg/ec/ec.go @@ -1,5 +1,5 @@ /* - * Copyright 2020, 2021, 2022 Hewlett Packard Enterprise Development LP + * Copyright 2020-2024 Hewlett Packard Enterprise Development LP * Other additional copyright holders may be indicated within. * * The entirety of this work is licensed under the Apache License, @@ -322,7 +322,7 @@ func (c *Controller) Init(opts *Options) error { // Run - Run a controller with standard behavior - that is with GRPC server and // request handling that operates by unpacking the GRPC request and -// forwardining it to the element controller's handlers. +// forwarding it to the element controller's handlers. func (c *Controller) Run() error { if c.processor == nil { return fmt.Errorf("controller processor uninitialized") diff --git a/pkg/manager-nnf/allocation_policy.go b/pkg/manager-nnf/allocation_policy.go index 11ce685..aae9379 100644 --- a/pkg/manager-nnf/allocation_policy.go +++ b/pkg/manager-nnf/allocation_policy.go @@ -1,5 +1,5 @@ /* - * Copyright 2020, 2021, 2022 Hewlett Packard Enterprise Development LP + * Copyright 2020-2024 Hewlett Packard Enterprise Development LP * Other additional copyright holders may be indicated within. * * The entirety of this work is licensed under the Apache License, @@ -210,7 +210,7 @@ func (p *SpareAllocationPolicy) Allocate(pid uuid.UUID) ([]nvme.ProvidingVolume, return volumes, fmt.Errorf("Create Volume Failure: %s", err) } - remainingCapacityBytes = remainingCapacityBytes - volume.GetCapaityBytes() + remainingCapacityBytes = remainingCapacityBytes - volume.GetCapacityBytes() volumes = append(volumes, nvme.ProvidingVolume{Storage: storage, VolumeId: volume.Id()}) } diff --git a/pkg/manager-nnf/manager.go b/pkg/manager-nnf/manager.go index 58d282e..f08641e 100644 --- a/pkg/manager-nnf/manager.go +++ b/pkg/manager-nnf/manager.go @@ -1,5 +1,5 @@ /* - * Copyright 2020, 2021, 2022 Hewlett Packard Enterprise Development LP + * Copyright 2020-2024 Hewlett Packard Enterprise Development LP * Other additional copyright holders may be indicated within. * * The entirety of this work is licensed under the Apache License, @@ -528,8 +528,8 @@ func (s *StorageService) EventHandler(e event.Event) error { return nil } - // Check if the fabric is ready; that is all devices are enumerated and discovery - // is complete. + // Check if the fabric is ready; + // that is all devices are enumerated and discovery is complete. if e.Is(msgreg.FabricReadyNnf("")) { log.V(1).Info("Fabric ready") @@ -539,7 +539,7 @@ func (s *StorageService) EventHandler(e event.Event) error { } // Remove any namespaces that are not part of a Storage Pool - log.V(2).Info("Cleanup obsolete volumes") + log.V(2).Info("Cleanup unknown volumes") s.cleanupVolumes() s.state = sf.ENABLED_RST diff --git a/pkg/manager-nnf/storage_pool.go b/pkg/manager-nnf/storage_pool.go index f091cf6..cf68446 100644 --- a/pkg/manager-nnf/storage_pool.go +++ b/pkg/manager-nnf/storage_pool.go @@ -1,5 +1,5 @@ /* - * Copyright 2020, 2021, 2022 Hewlett Packard Enterprise Development LP + * Copyright 2020-2024 Hewlett Packard Enterprise Development LP * Other additional copyright holders may be indicated within. * * The entirety of this work is licensed under the Apache License, @@ -55,7 +55,7 @@ type AllocatedVolume struct { func (p *StoragePool) GetCapacityBytes() (capacityBytes uint64) { for _, pv := range p.providingVolumes { - capacityBytes += pv.Storage.FindVolume(pv.VolumeId).GetCapaityBytes() + capacityBytes += pv.Storage.FindVolume(pv.VolumeId).GetCapacityBytes() } return capacityBytes } diff --git a/pkg/manager-nvme/manager.go b/pkg/manager-nvme/manager.go index 3c91c94..c9cbfa5 100644 --- a/pkg/manager-nvme/manager.go +++ b/pkg/manager-nvme/manager.go @@ -1,5 +1,5 @@ /* - * Copyright 2020, 2021, 2022 Hewlett Packard Enterprise Development LP + * Copyright 2020-2024 Hewlett Packard Enterprise Development LP * Other additional copyright holders may be indicated within. * * The entirety of this work is licensed under the Apache License, @@ -82,7 +82,7 @@ type Manager struct { // Command-Line Options purge bool // Purge existing namespaces on storage controllers - purgeMockDb bool // Purge the persistent mock databse + purgeMockDb bool // Purge the persistent mock database log ec.Logger } @@ -635,7 +635,7 @@ func (s *Storage) findVolume(volumeId string) *Volume { func (v *Volume) Id() string { return v.id } func (v *Volume) GetOdataId() string { return v.storage.OdataId() + "/Volumes/" + v.id } -func (v *Volume) GetCapaityBytes() uint64 { return uint64(v.capacityBytes) } +func (v *Volume) GetCapacityBytes() uint64 { return uint64(v.capacityBytes) } func (v *Volume) GetNamespaceId() nvme.NamespaceIdentifier { return v.namespaceId } func (v *Volume) GetGloballyUniqueIdentifier() nvme.NamespaceGloballyUniqueIdentifier {