mirror of https://gitee.com/openkylin/libvirt.git
virsh: don't list unknown domains
When the list of domains is fetched and being printed, but in the meantime one domain was undefined before its status was fetched, the output then includes domain with "no state". With this patch, such domain is skipped over as consecutive 'virsh list --all' (or the same one ran a second later) wouldn't list it anyway. Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
This commit is contained in:
parent
b3880bbe97
commit
1eb53f05bc
|
@ -1916,6 +1916,11 @@ cmdList(vshControl *ctl, const vshCmd *cmd)
|
|||
ignore_value(virStrcpyStatic(id_buf, "-"));
|
||||
|
||||
state = vshDomainState(ctl, dom, NULL);
|
||||
|
||||
/* Domain could've been removed in the meantime */
|
||||
if (state < 0)
|
||||
continue;
|
||||
|
||||
if (optTable && managed && state == VIR_DOMAIN_SHUTOFF &&
|
||||
virDomainHasManagedSaveImage(dom, 0) > 0)
|
||||
state = -2;
|
||||
|
|
Loading…
Reference in New Issue