-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simplified Realloc and Refined Misc #261
Conversation
... 这个 MR even more terrible than the original one ..... |
cluster/calcium/create.go
Outdated
e = c.doDeployOneWorkload(ctx, node, opts, createMsg, seq+idx, deploy-1-idx) | ||
}() | ||
return e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return c.doDeployOneWorkload(ctx, node, opts, createMsg, seq+idx, deploy-1-idx)
cluster/calcium/realloc.go
Outdated
// if commit changes | ||
func(ctx context.Context) (err error) { | ||
for _, plan := range plans { | ||
plan.ApplyChangesOnNode(node, 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我认为应该先尝试修改容器资源,再做资源写入。。。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
吼
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
其实我安排顺序主要关注的是“哪个操作更容易回滚”. 试想一个无法回滚的操作, 比如 ContainerRemove, 那这个操作最好就安排在 then 里面而不是 if:
util.Txn(
// if
func(ctx context.Context) error {
return store.UpdateNode()
},
// then
func(ctx context.Context) error {
return engine.RemoveContainer()
},
// else
func(ctx context.Context) error {
return store.UpdateNode()
}
)
就比下面的顺序好:
util.Txn(
// if
func(ctx context.Context) error {
return engine.RemoveContainer()
},
// then
func(ctx context.Context) error {
return store.UpdateNode()
},
// else
nil,
)
return errors.Wrap(types.ErrBadMemory, "limit or request less than 0") | ||
} | ||
if a.memoryRequest == 0 && a.memoryLimit > 0 { | ||
a.memoryRequest = a.memoryLimit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个顺序不能改, 我改回去了.
否则对于 cpu limit >0 && cpu request =0 && cpu bind =true 的请求会报错 "unlimited request with bind"
realloc 测试1600行, 由于改了接口之后很多测试用例都没意义了, 我一个一个改吧....太难了 |
d2b9d33
to
9c4e50e
Compare
改完 cli 之后还需测试一番 |
9c4e50e
to
288923d
Compare
288923d
to
2fad2f2
Compare
inherited from #260