@@ -41,7 +41,7 @@ func (c *Calcium) doReallocOnNode(ctx context.Context, nodename string, containe
41
41
if err != nil {
42
42
return errors .WithStack (err )
43
43
}
44
- if total != 1 {
44
+ if total < 1 {
45
45
return errors .WithStack (types .ErrInsufficientRes )
46
46
}
47
47
@@ -80,12 +80,9 @@ func (c *Calcium) doReallocOnNode(ctx context.Context, nodename string, containe
80
80
func (c * Calcium ) doReallocContainersOnInstance (ctx context.Context , node * types.Node , plans []resourcetypes.ResourcePlans , container * types.Container ) (err error ) {
81
81
r := & types.ResourceMeta {}
82
82
for _ , plan := range plans {
83
- // TODO@zc: single existing instance
84
- // TODO@zc: no HardVolumeBindings
85
83
if r , err = plan .Dispense (resourcetypes.DispenseOptions {
86
- Node : node ,
87
- Index : 1 ,
88
- ExistingInstances : []* types.Container {container },
84
+ Node : node ,
85
+ ExistingInstance : container ,
89
86
}, r ); err != nil {
90
87
return
91
88
}
@@ -131,7 +128,17 @@ func (c *Calcium) doReallocContainersOnInstance(ctx context.Context, node *types
131
128
if failureByCond {
132
129
return nil
133
130
}
134
- return errors .WithStack (c .store .UpdateContainer (ctx , & originalContainer ))
131
+ r := & enginetypes.VirtualizationResource {
132
+ CPU : originalContainer .CPU ,
133
+ Quota : originalContainer .CPUQuotaLimit ,
134
+ NUMANode : originalContainer .NUMANode ,
135
+ Memory : originalContainer .MemoryLimit ,
136
+ Volumes : originalContainer .VolumeLimit .ToStringSlice (false , false ),
137
+ VolumePlan : originalContainer .VolumePlanLimit .ToLiteral (),
138
+ VolumeChanged : r .VolumeChanged ,
139
+ Storage : originalContainer .StorageLimit ,
140
+ }
141
+ return errors .WithStack (node .Engine .VirtualizationUpdateResource (ctx , container .ID , r ))
135
142
},
136
143
137
144
c .config .GlobalTimeout ,
0 commit comments