[virt-tools-list] [PATCH virt-viewer v2 2/4] foreign-menu: Use query for fetching virtual machines
Eduardo Lima (Etrunko)
etrunko at redhat.com
Fri Sep 29 21:30:16 UTC 2017
This can save us some bandwidth, as we are searching for the specific
virtual machine instead of retrieving the collection with all VMs, and
then iterating over the results after the transfer finishes.
Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
---
src/ovirt-foreign-menu.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index fdfd327..8af3716 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -701,7 +701,14 @@ static void ovirt_foreign_menu_fetch_vm_async(OvirtForeignMenu *menu,
g_return_if_fail(OVIRT_IS_PROXY(menu->priv->proxy));
g_return_if_fail(OVIRT_IS_API(menu->priv->api));
+#ifdef HAVE_OVIRT_API_SEARCH_VMS
+ char * query = g_strdup_printf("id=%s", menu->priv->vm_guid);
+ vms = ovirt_api_search_vms(menu->priv->api, query);
+ g_free(query);
+#else
vms = ovirt_api_get_vms(menu->priv->api);
+#endif
+
ovirt_collection_fetch_async(vms, menu->priv->proxy,
g_task_get_cancellable(task),
vms_fetched_cb, task);
--
2.13.6
More information about the virt-tools-list
mailing list