Blame SOURCES/0047-foreign-menu-Use-query-for-fetching-virtual-machines.patch

5bafe0
From 4970f2528ce0e84d63242426cb6e360b5bbd07fe Mon Sep 17 00:00:00 2001
5bafe0
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
5bafe0
Date: Fri, 12 May 2017 16:06:08 -0300
5bafe0
Subject: [PATCH] foreign-menu: Use query for fetching virtual machines
5bafe0
5bafe0
This can save us some bandwidth, as we are searching for the specific
5bafe0
virtual machine instead of retrieving the collection with all VMs, and
5bafe0
then iterating over the results after the transfer finishes.
5bafe0
5bafe0
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
5bafe0
---
5bafe0
 src/ovirt-foreign-menu.c | 7 +++++++
5bafe0
 1 file changed, 7 insertions(+)
5bafe0
5bafe0
diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
5bafe0
index 2939ae5..6d0eab3 100644
5bafe0
--- a/src/ovirt-foreign-menu.c
5bafe0
+++ b/src/ovirt-foreign-menu.c
5bafe0
@@ -697,7 +697,14 @@ static void ovirt_foreign_menu_fetch_vm_async(OvirtForeignMenu *menu,
5bafe0
     g_return_if_fail(OVIRT_IS_PROXY(menu->priv->proxy));
5bafe0
     g_return_if_fail(OVIRT_IS_API(menu->priv->api));
5bafe0
 
5bafe0
+#ifdef HAVE_OVIRT_API_SEARCH_VMS
5bafe0
+    char * query = g_strdup_printf("id=%s", menu->priv->vm_guid);
5bafe0
+    vms = ovirt_api_search_vms(menu->priv->api, query);
5bafe0
+    g_free(query);
5bafe0
+#else
5bafe0
     vms = ovirt_api_get_vms(menu->priv->api);
5bafe0
+#endif
5bafe0
+
5bafe0
     ovirt_collection_fetch_async(vms, menu->priv->proxy,
5bafe0
                                  g_task_get_cancellable(task),
5bafe0
                                  vms_fetched_cb, task);
5bafe0
-- 
5bafe0
2.13.6
5bafe0