]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/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)
committerMatthias Bolte <matthias.bolte@googlemail.com>
Sat, 29 Sep 2012 19:06:19 +0000 (21:06 +0200)
commit5fc663d8bedc082585941e1453229cdcf5fe2880
tree5b472f8824907b8501abe9f4be3fcec507882919
parentaa696e1846c9ddfcc25654dc4ea8762df4fd38ab
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.
src/esx/esx_driver.c