diff --git a/b b/b new file mode 100644 index 00000000000..df79f99afbe --- /dev/null +++ b/b @@ -0,0 +1,4 @@ +test +test +test3 +4 diff --git a/plugin/kvm/src/main/java/org/zstack/kvm/hypervisor/datatype/ResourceHypervisorInfo.java b/plugin/kvm/src/main/java/org/zstack/kvm/hypervisor/datatype/ResourceHypervisorInfo.java index 90cb983f1ab..b25573c64d9 100644 --- a/plugin/kvm/src/main/java/org/zstack/kvm/hypervisor/datatype/ResourceHypervisorInfo.java +++ b/plugin/kvm/src/main/java/org/zstack/kvm/hypervisor/datatype/ResourceHypervisorInfo.java @@ -75,6 +75,7 @@ public static List from(Collection uuidSet) { String type = tuple.get(1, String.class); return mapResourceHypervisorInfo(uuid, type, uuidVoMap.get(uuid)); }) + .filter(Objects::nonNull) .collect(Collectors.toList()); fillMatchTargetInfo(results); @@ -82,6 +83,11 @@ public static List from(Collection uuidSet) { } private static ResourceHypervisorInfo mapResourceHypervisorInfo(String uuid, String type, KvmHypervisorInfoVO vo) { + if (vo == null) { + // maybe vm is in stopped states + return null; + } + ResourceHypervisorInfo target = new ResourceHypervisorInfo(); target.uuid = uuid; target.resourceType = type;