fix: 修复实例管理器加载已终止实例的问题.

已终止实例已无管理必要, 可以排除.
This commit is contained in:
LamGC 2021-08-19 17:59:07 +08:00
parent 9905f6ce01
commit 332bc7a6a1
Signed by: LamGC
GPG Key ID: 6C5AE2A913941E1D

View File

@ -86,6 +86,9 @@ public class ComputeInstanceManager {
.compartmentId(compartmentId) .compartmentId(compartmentId)
.build()); .build());
for (Instance instance : listInstances.getItems()) { for (Instance instance : listInstances.getItems()) {
if (instance.getLifecycleState() == Instance.LifecycleState.Terminated) {
continue;
}
ComputeInstance computeInstance = new ComputeInstance(this, instance.getId(), ComputeInstance computeInstance = new ComputeInstance(this, instance.getId(),
provider.getUserId(), compartmentId, instance.getImageId(), provider); provider.getUserId(), compartmentId, instance.getImageId(), provider);