summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEduardo Lima (Etrunko) <etrunko@redhat.com>2019-08-09 16:26:13 -0300
committerEduardo Lima (Etrunko) <etrunko@redhat.com>2019-08-12 10:55:54 -0300
commit1c9a9c12050f03c4f0f69baf528d3b9560c53100 (patch)
tree69caf9c1b96a05755200df07b70a748c0d4a297f
parenta2a372ac2d33893cf1bc76aa0dc0612ebc950d77 (diff)
ovirt-foreign-menu: Fix endpoint for storage domains query
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@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
-rw-r--r--src/ovirt-foreign-menu.c26
1 files 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);