SKS-2393: Check if the IP from IPPool is already in use #38
+109
−1
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.
Issue
如果 IPPool 中有些 IP 已经被非 ElfMachine 使用了,IP 分配到 ElfMachine 后,创建虚拟机会导致 IP 冲突,且需要花一定的时间排查。
Change
目前从 IPPool 过滤被非 ElfMachine 使用的 IP 实现难道较大。
简单起见,从 IPPool 获取到 IP 后,先 ping 一下 IP 是否已经被使用,如果还没有被使用继续正常的创建流程。如果 IP 已经被使用,给 ElfMachine 设置
WaitingForStaticIPAllocationReason
和相关的错误信息。用户发现该错误后,可以处理已经被使用的 IP,之后 ElfMachine 的创建流程会继续正常进行。workflow 运行
make test
报错listen ip4:icmp : socket: operation not permitted
,因此改成 sudo -E sh -c 'make test',Test
WaitingForStaticIPAllocationReason