remove multiple times will change resource incorrect
@@ -104,12 +104,18 @@ func (c *Calcium) RemoveContainer(ctx context.Context, IDs []string, force bool)
// remove one container
func (c *Calcium) removeOneContainer(ctx context.Context, container *types.Container) error {
+ var err error
defer func() {
// not deal with raw res container
if container.RawResource {
return
}
+ if err != nil {
+ log.Errorf("[removeOneContainer] Remove container failed, we have to check it manually %v", err)
+ return
+ }
+
log.Debugf("[removeOneContainer] Restore node %s resource cpu: %v mem: %v", container.Nodename, container.CPU, container.Memory)
if err := c.store.UpdateNodeResource(ctx, container.Podname, container.Nodename, container.CPU, container.Memory, "+"); err != nil {
log.Errorf("[removeOneContainer] Update Node resource failed %v", err)
