]> git.ipfire.org Git - thirdparty/libvirt.git/commit
esx: Fix and improve esxListAllDomains function
authorMatthias Bolte <matthias.bolte@googlemail.com>
Sun, 9 Sep 2012 10:31:16 +0000 (12:31 +0200)
committerCole Robinson <crobinso@redhat.com>
Mon, 1 Apr 2013 14:41:06 +0000 (10:41 -0400)
commitf50a9b3be1f3bba48ffc59e0b7cfbba52fe43e6f
tree6c56d29b41e8d67b87251c57862a779536393b3d
parent6f290666dc8f16830b06783126cbefd3849d0a41
esx: Fix and improve esxListAllDomains function

Avoid requesting information such as identity or power state when it
is not necessary.

Lookup virtual machine list with the required fields (configStatus,
name, and config.uuid) to make esxVI_GetVirtualMachineIdentity work.

No need to call esxVI_GetNumberOfSnapshotTrees. rootSnapshotTreeList
can be tested for emptiness by checking it for NULL.

esxVI_LookupRootSnapshotTreeList already does the error reporting,
don't overwrite it.

Check if autostart is enabled at all before looking up the individual
autostart setting of a virtual machine.

Reorder VIR_EXPAND_N(doms, ndoms, 1) to avoid leaking the result of
the call to virGetDomain if VIR_EXPAND_N fails.

Replace VIR_EXPAND_N by VIR_RESIZE_N to avoid quadratic scaling, as in
the Hyper-V version of the function.

If virGetDomain fails it already reports an error, don't overwrite it
with an OOM error.

All items in doms up to the count-th one are valid, no need to double
check before freeing them.

Finally, don't leak autoStartDefaults and powerInfoList.
(cherry picked from commit 5fc663d8bedc082585941e1453229cdcf5fe2880)
src/esx/esx_driver.c