Skip to content

Commit 524c019

Browse files
committed
fix: avoid preparing resourceclaim with more than one Pods in reserverdFor
Signed-off-by: Shouren Yang <yangshouren@gmail.com>
1 parent d2e8ea3 commit 524c019

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

cmd/hami-kubelet-plugin/device_state.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,13 @@ func (s *DeviceState) Prepare(ctx context.Context, claim *resourceapi.ResourceCl
156156
s.Lock()
157157
defer s.Unlock()
158158

159+
if featuregates.Enabled(featuregates.HAMiCoreSupport) {
160+
if len(claim.Status.ReservedFor) > 1 {
161+
klog.Error("The claim can only be reservedFor a single Pod with HAMiCoreSupport enabled.")
162+
return nil, fmt.Errorf("unable to prepare a claim with more than one Pods in reservedFor")
163+
}
164+
}
165+
159166
claimUID := string(claim.UID)
160167

161168
checkpoint, err := s.getCheckpoint()

0 commit comments

Comments
 (0)