[SPVR-207] fix the issue of calculating storage-request #572
+55
−37
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
修复了一个计算storage request / limit的bug。
在申请volume资源的时候,eru会把volume size加到storage request / limit里。例如申请volume_request = "AUTO:/data1:rw:1G",storage_request = 10G,最终调度时候eru会把storage_request 按照11G来计算。
造成bug的原因:
eru在CreateWorkload这个API里允许调用方只传limit,不传request,在validate时检测到这种情况的话就会使request = limit,而不会报错。但是这个validate是在变更storage_request之后进行的。
也就是说,对于下面这个请求:
volume_limit = 100G, storage_request = 10G, storage_limit = 10G
,eru首先将其变成volume_limit = 100G, storage_request = 10G, storage_limit = 110G
,然后validate时再将其变成volume_request = 100G, volume_limit = 100G, storage_request = 10G, storage_limit = 110G
。我们期望这里的storage_request应该等于最终的volume_request + storage_request = 100G + 10G = 110G,但是实际上只有10G,这是因为第一步转换的时候volume_request是空的,所以只变化了storage_limit,没有变storage_request。