Skip to content

Commit 53ca297

Browse files
committed
Drop DiskWiper and toy usage in StorageControllerAction
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.
1 parent 41022f4 commit 53ca297

File tree

3 files changed

+0
-63
lines changed

3 files changed

+0
-63
lines changed

actions/interface.go

-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"github.com/bmc-toolbox/common"
77
"github.com/metal-toolbox/ironlib/model"
88
"github.com/metal-toolbox/ironlib/utils"
9-
"github.com/sirupsen/logrus"
109
)
1110

1211
// DeviceManager interface is returned to the caller when calling ironlib.New()
@@ -200,8 +199,3 @@ type VirtualDiskManager interface {
200199
VirtualDiskDestroyer
201200
VirtualDisks(ctx context.Context) ([]*utils.MvcliDevice, error)
202201
}
203-
204-
// DiskWiper defines an interface to override disk data
205-
type DiskWiper interface {
206-
WipeDisk(ctx context.Context, log *logrus.Logger, logicalName string) error
207-
}

actions/storage_controller.go

-30
Original file line numberDiff line numberDiff line change
@@ -76,33 +76,3 @@ func (s *StorageControllerAction) GetControllerUtility(vendorName, modelName str
7676

7777
return nil, errors.Wrap(ErrVirtualDiskManagerUtilNotIdentified, "vendor: "+vendorName+" model: "+modelName)
7878
}
79-
80-
// GetWipeUtility returns the wipe utility based on the disk wipping features
81-
func (s *StorageControllerAction) GetWipeUtility(logicalName string) (DiskWiper, error) {
82-
s.Logger.Tracef("%s | Detecting wipe utility", logicalName)
83-
// TODO: use disk wipping features to return the best wipe utility, currently only one available
84-
85-
return utils.NewFillZeroCmd(s.trace), nil
86-
}
87-
88-
func (s *StorageControllerAction) WipeDisk(ctx context.Context, log *logrus.Logger, logicalName string) error {
89-
util, err := s.GetWipeUtility(logicalName)
90-
if err != nil {
91-
return err
92-
}
93-
94-
// Watermark disk
95-
// Before wiping the disk, we apply watermarks to later verify successful deletion
96-
check, err := utils.ApplyWatermarks(logicalName)
97-
if err != nil {
98-
return err
99-
}
100-
101-
// Wipe the disk
102-
err = util.WipeDisk(ctx, log, logicalName)
103-
if err != nil {
104-
return err
105-
}
106-
107-
return check()
108-
}

examples/diskwipe/main.go

-27
This file was deleted.

0 commit comments

Comments
 (0)