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

Pavel Grunt pavelgrunt at gmail.com
Sun Aug 6 21:53:07 UTC 2017


Hi,

2017-08-04 23:53 GMT+02:00 Eduardo Lima (Etrunko) <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>
> ---
>  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 *


>
>      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)

Cheers!
Pavel


> --
> 2.13.4
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20170806/a6a947e3/attachment.htm>


More information about the virt-tools-list mailing list