[virt-tools-list] [PATCH virt-viewer v2] ovirt-foreign-menu: Fix endpoint for storage domains query
Victor Toso
victortoso at redhat.com
Mon Aug 12 12:48:18 UTC 2019
On Mon, Aug 12, 2019 at 09:36:39AM -0300, Eduardo Lima (Etrunko) wrote:
> Instead of fetching toplevel REST API query, we use the one relative
> from the data center, which returns more detailed information,
> especially the status of the storage domain.
>
> This fixes https://bugzilla.redhat.com/show_bug.cgi?id=1427467
>
> Signed-off-by: Eduardo Lima (Etrunko) <etrunko at redhat.com>
> ---
>
> in V2:
> - Improve usage of boolean domain_valid
Sure,
Acked-by: Victor Toso <victortoso at redhat.com>
>
> ---
> src/ovirt-foreign-menu.c | 26 ++++++++++++++++++++------
> 1 file changed, 20 insertions(+), 6 deletions(-)
>
> diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
> index 59c3d48..75f9ac4 100644
> --- a/src/ovirt-foreign-menu.c
> +++ b/src/ovirt-foreign-menu.c
> @@ -683,6 +683,7 @@ static void storage_domains_fetched_cb(GObject *source_object,
> OvirtCollection *collection = OVIRT_COLLECTION(source_object);
> GHashTableIter iter;
> OvirtStorageDomain *domain;
> + gboolean domain_valid = FALSE;
>
> ovirt_collection_fetch_finish(collection, result, &error);
> if (error != NULL) {
> @@ -696,7 +697,8 @@ static void storage_domains_fetched_cb(GObject *source_object,
> while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&domain)) {
> OvirtCollection *file_collection;
>
> - if (!storage_domain_validate(menu, domain))
> + domain_valid = storage_domain_validate(menu, domain);
> + if (!domain_valid)
> continue;
>
> file_collection = ovirt_storage_domain_get_files(domain);
> @@ -713,9 +715,11 @@ static void storage_domains_fetched_cb(GObject *source_object,
> if (menu->priv->files != NULL) {
> ovirt_foreign_menu_next_async_step(menu, task, STATE_STORAGE_DOMAIN);
> } else {
> - g_debug("Could not find iso file collection");
> - g_task_return_new_error(task, OVIRT_ERROR, OVIRT_ERROR_FAILED,
> - "Could not find ISO file collection");
> + const char *msg = domain_valid ? "Could not find ISO file collection"
> + : "Could not find valid ISO storage domain";
> +
> + g_debug(msg);
> + g_task_return_new_error(task, OVIRT_ERROR, OVIRT_ERROR_FAILED, msg);
> g_object_unref(task);
> }
> }
> @@ -724,9 +728,19 @@ static void storage_domains_fetched_cb(GObject *source_object,
> static void ovirt_foreign_menu_fetch_storage_domain_async(OvirtForeignMenu *menu,
> GTask *task)
> {
> - OvirtCollection *collection = ovirt_api_get_storage_domains(menu->priv->api);
> + OvirtCollection *collection = NULL;
> +
> +#ifdef HAVE_OVIRT_DATA_CENTER
> + 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_DATA_CENTER(menu->priv->data_center));
> +
> + collection = ovirt_data_center_get_storage_domains(menu->priv->data_center);
> +#else
> + collection = ovirt_api_get_storage_domains(menu->priv->api);
> +#endif
>
> - g_debug("Start fetching oVirt REST collection");
> + g_debug("Start fetching iso file collection");
> ovirt_collection_fetch_async(collection, menu->priv->proxy,
> g_task_get_cancellable(task),
> storage_domains_fetched_cb, task);
> --
> 2.21.0
>
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list at redhat.com
> https://www.redhat.com/mailman/listinfo/virt-tools-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20190812/40ea65cb/attachment.sig>
More information about the virt-tools-list
mailing list