[virt-tools-list] [PATCH virt-viewer 1/3] foreign-menu: Use query for fetching virtual machines

Eduardo Lima (Etrunko) etrunko at redhat.com
Mon Aug 7 13:28:32 UTC 2017


On 06/08/17 18:53, Pavel Grunt wrote:
> Hi,
> 
> 2017-08-04 23:53 GMT+02:00 Eduardo Lima (Etrunko) <etrunko at redhat.com
> <mailto:etrunko at redhat.com>>:
> 
>     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
>     <mailto:etrunko at redhat.com>>
>     ---
>      src/ovirt-foreign-menu.c | 6 +++++-
>      1 file changed, 5 insertions(+), 1 deletion(-)
> 
>     diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
>     index fdfd327..539f716 100644
>     --- a/src/ovirt-foreign-menu.c
>     +++ b/src/ovirt-foreign-menu.c
>     @@ -696,12 +696,16 @@ static void
>     ovirt_foreign_menu_fetch_vm_async(OvirtForeignMenu *menu,
>                                                    GTask *task)
>      {
>          OvirtCollection *vms;
>     +    char *query;
> 
> g_strdup_printf returns gchar *

Fixed.

>  
> 
> 
>          g_return_if_fail(OVIRT_IS_FOREIGN_MENU(menu));
>          g_return_if_fail(OVIRT_IS_PROXY(menu->priv->proxy));
>          g_return_if_fail(OVIRT_IS_API(menu->priv->api));
> 
>     -    vms = ovirt_api_get_vms(menu->priv->api);
>     +    query = g_strdup_printf("id=%s", menu->priv->vm_guid);
>     +    vms = ovirt_api_search_vms(menu->priv->api, query);
> 
> it looks like api from unreleased version of libgovirt, remote-viewer
> depends on libgovirt 0.3.2
>  
> 
>     +    g_free(query);
>     +
>          ovirt_collection_fetch_async(vms, menu->priv->proxy,
>                                       g_task_get_cancellable(task),
>                                       vms_fetched_cb, task);
> 
> 
> You can go for AC_CHECK_FUNCS and do it conditionally based on the
> function presence to keep it builldable on distros not shipping the very
> recent libgovirt
> 
> IMHO would be better to have a release of libgovirt to make the new api
> stable :) (However I'd still consider using the `#ifdef
> |HAVE_OVIRT_API_SEARCH_VMS` check)

Yeah, the idea is to release libgovirt soon and update the requirements
in configure.ac, but there are still some pending patches there to be
merged. I've sent this patch series because most of the API changes have
already been merged and it is possible to test against the latest git
master.

Regards, Eduardo.

-- 
Eduardo de Barros Lima (Etrunko)
Software Engineer - RedHat
etrunko at redhat.com




More information about the virt-tools-list mailing list