Skip to content

Commit

Permalink
add todo to protect storage cap data
Browse files Browse the repository at this point in the history
  • Loading branch information
CMGS committed Feb 3, 2023
1 parent 2de4977 commit ba89945
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
1 change: 1 addition & 0 deletions storage/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ func (p Plugin) GetNodesDeployCapacity(ctx context.Context, nodenames []string,
}

func (p Plugin) SetNodeResourceCapacity(ctx context.Context, nodename string, resource plugintypes.NodeResource, resourceRequest plugintypes.NodeResourceRequest, delta bool, incr bool) (resourcetypes.RawParams, error) {
// TODO both nil should do nothing
logger := log.WithFunc("resource.storage.SetNodeResourceCapacity").WithField("node", "nodename")
req, nodeResource, _, nodeResourceInfo, err := p.parseNodeResourceInfos(ctx, nodename, resource, resourceRequest, nil)
if err != nil {
Expand Down
12 changes: 5 additions & 7 deletions storage/types/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,11 @@ func (n *NodeResourceInfo) Validate() error {
return n.Capacity.Disks[i].Device < n.Capacity.Disks[j].Device
})

if err := n.validateVolume(); err != nil {
return err
}
if err := n.validateStorage(); err != nil {
return err
}
return n.validateDisks()
return errors.CombineErrors(
errors.CombineErrors(
n.validateVolume(),
n.validateStorage()),
n.validateDisks())
}

// GetAvailableResource .
Expand Down

0 comments on commit ba89945

Please sign in to comment.