Skip to content

Commit

Permalink
cover the case of ac without labels in selectACForVolume
Browse files Browse the repository at this point in the history
Signed-off-by: Shi, Crane <crane.shi@emc.com>
  • Loading branch information
CraneShiEMC committed Jun 23, 2023
1 parent cba700d commit b953f24
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/base/capacityplanner/node_capacity.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ func (nc *nodeCapacity) selectACForVolume(vol *genV1.Volume) *accrd.AvailableCap
}

for _, ac := range nc.acsOrder[vol.StorageClass] {
if requiredSize <= nc.acs[ac].Spec.Size && nc.acs[ac].Labels[v1.StorageGroupLabelKey] == vol.StorageGroup {
var acSGLabel string
if nc.acs[ac].Labels != nil {
acSGLabel = nc.acs[ac].Labels[v1.StorageGroupLabelKey]
}

Check warning on line 160 in pkg/base/capacityplanner/node_capacity.go

View check run for this annotation

Codecov / codecov/patch

pkg/base/capacityplanner/node_capacity.go#L159-L160

Added lines #L159 - L160 were not covered by tests
if requiredSize <= nc.acs[ac].Spec.Size && acSGLabel == vol.StorageGroup {
// check if AC is reserved
reservation, ok := nc.reservedACs[ac]

Expand Down

0 comments on commit b953f24

Please sign in to comment.