mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-08 11:16:47 +00:00
The VM page's getters read the domain XML on their own: one load made 86 libvirt calls for a real VM, 29 of them for the same three XML documents (live, live with secrets, persistent) and 6 for the host capabilities. Each call is a round trip to the host. wvmInstance.cached_reads() is a block in which _XMLDesc (per flags value) and get_cap_xml are read from libvirt once; it ends with the block, even on an error, does not nest, and _defineXML drops it. Outside a block every read goes to libvirt as before. Only the VM page view, which does not change the VM, uses it, around its rendering. Views that change the VM keep reading fresh XML: most changes (devices, QoS, memory) do not go through _defineXML, and several views read, change and define more than once in one request. Measured on the test host: 86 -> 55 calls (XMLDesc 29 -> 3, getCapabilities 6 -> 1) for one VM, 82 -> 54 for another; the page took 0.23-0.25 s before, 0.14-0.15 s after. The HTML of both pages is identical before and after (CSRF tokens aside). A test renders the page on libvirt's test driver through the real getters: 25 XML reads before, one per kind now. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| connection.py | ||
| create.py | ||
| hostdetails.py | ||
| instance.py | ||
| interface.py | ||
| libvirt-ssh | ||
| network.py | ||
| nwfilters.py | ||
| rwlock.py | ||
| storage.py | ||
| test_change_network.py | ||
| test_connection.py | ||
| test_console_setters.py | ||
| test_iso_media.py | ||
| test_live_connection.py | ||
| test_network_ip.py | ||
| test_persistent_edits.py | ||
| test_read_cache.py | ||
| test_resize_disk.py | ||
| test_rwlock.py | ||
| test_usage.py | ||
| test_util.py | ||
| test_xml_safety.py | ||
| util.py | ||
| virtsecrets.py | ||