@@ -2,6 +2,7 @@ package calcium
2
2
3
3
import (
4
4
"context"
5
+ "encoding/json"
5
6
"fmt"
6
7
"sync"
7
8
"time"
@@ -202,8 +203,8 @@ func (c *Calcium) doDeployWorkloadsOnNode(ctx context.Context, ch chan *types.Cr
202
203
// remap 就不搞进事务了吧, 回滚代价太大了
203
204
// 放任 remap 失败的后果是, share pool 没有更新, 这个后果姑且认为是可以承受的
204
205
// 而且 remap 是一个幂等操作, 就算这次 remap 失败, 下次 remap 也能收敛到正确到状态
205
- if err := c .withNodeLocked (ctx , nodename , func (ctx context.Context , node * types.Node ) error {
206
- c .doRemapResourceAndLog (ctx , logger , node )
206
+ if err := c .withNodeLocked (context . Background () , nodename , func (ctx context.Context , node * types.Node ) error {
207
+ c .doRemapResourceAndLog (context . Background () , logger , node )
207
208
return nil
208
209
}); err != nil {
209
210
logger .Errorf ("failed to lock node to remap: %v" , err )
@@ -408,6 +409,10 @@ func (c *Calcium) doMakeWorkloadOptions(no int, msg *types.CreateWorkloadMessage
408
409
env = append (env , fmt .Sprintf ("ERU_WORKLOAD_SEQ=%d" , no ))
409
410
env = append (env , fmt .Sprintf ("ERU_MEMORY=%d" , msg .MemoryLimit ))
410
411
env = append (env , fmt .Sprintf ("ERU_STORAGE=%d" , msg .StorageLimit ))
412
+ if msg .CPU != nil {
413
+ bs , _ := json .Marshal (msg .CPU )
414
+ env = append (env , fmt .Sprintf ("ERU_CPU=%s" , bs ))
415
+ }
411
416
config .Env = env
412
417
// basic labels, bind to LabelMeta
413
418
config .Labels = map [string ]string {
0 commit comments