Skip to content

Commit

Permalink
Drop DiskWiper and toy usage in StorageControllerAction
Browse files Browse the repository at this point in the history
This isn't a very useful interface/api and I intend for Wiper to be
easier to use. The DiskWipe in StorageControllerAction was mostly
serving as an example but we already have multiple in examples/, so we
can drop this usage too.
  • Loading branch information
mmlb committed Jun 3, 2024
1 parent 41022f4 commit 53ca297
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 63 deletions.
6 changes: 0 additions & 6 deletions actions/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"github.com/bmc-toolbox/common"
"github.com/metal-toolbox/ironlib/model"
"github.com/metal-toolbox/ironlib/utils"
"github.com/sirupsen/logrus"
)

// DeviceManager interface is returned to the caller when calling ironlib.New()
Expand Down Expand Up @@ -200,8 +199,3 @@ type VirtualDiskManager interface {
VirtualDiskDestroyer
VirtualDisks(ctx context.Context) ([]*utils.MvcliDevice, error)
}

// DiskWiper defines an interface to override disk data
type DiskWiper interface {
WipeDisk(ctx context.Context, log *logrus.Logger, logicalName string) error
}
30 changes: 0 additions & 30 deletions actions/storage_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,33 +76,3 @@ func (s *StorageControllerAction) GetControllerUtility(vendorName, modelName str

return nil, errors.Wrap(ErrVirtualDiskManagerUtilNotIdentified, "vendor: "+vendorName+" model: "+modelName)
}

// GetWipeUtility returns the wipe utility based on the disk wipping features
func (s *StorageControllerAction) GetWipeUtility(logicalName string) (DiskWiper, error) {
s.Logger.Tracef("%s | Detecting wipe utility", logicalName)
// TODO: use disk wipping features to return the best wipe utility, currently only one available

return utils.NewFillZeroCmd(s.trace), nil
}

func (s *StorageControllerAction) WipeDisk(ctx context.Context, log *logrus.Logger, logicalName string) error {
util, err := s.GetWipeUtility(logicalName)
if err != nil {
return err
}

// Watermark disk
// Before wiping the disk, we apply watermarks to later verify successful deletion
check, err := utils.ApplyWatermarks(logicalName)
if err != nil {
return err
}

// Wipe the disk
err = util.WipeDisk(ctx, log, logicalName)
if err != nil {
return err
}

return check()
}
27 changes: 0 additions & 27 deletions examples/diskwipe/main.go

This file was deleted.

0 comments on commit 53ca297

Please sign in to comment.