86 lines
2.8 KiB
Diff
86 lines
2.8 KiB
Diff
From 6f3f17ab8e49fedded6df46d703dc0a5087a630c Mon Sep 17 00:00:00 2001
|
|
From: "Eduardo Lima (Etrunko)" <etrunko@redhat.com>
|
|
Date: Wed, 4 Jul 2018 12:29:42 -0300
|
|
Subject: [PATCH virt-viewer] ovirt-foreign-menu: New function
|
|
storage_domain_validate()
|
|
|
|
It may be useful to know why the storage domain has not been listed,
|
|
given that there are different reasons for that. To make it easier to
|
|
provide more detailed debug messages, we move code from the callback
|
|
function to this new one.
|
|
|
|
Acked-by: Christophe Fergeau <cfergeau@redhat.com>
|
|
Signed-off-by: Eduardo Lima (Etrunko) <etrunko@redhat.com>
|
|
---
|
|
src/ovirt-foreign-menu.c | 45 ++++++++++++++++++++++++++--------------
|
|
1 file changed, 30 insertions(+), 15 deletions(-)
|
|
|
|
diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
|
|
index cd1b8bd..b482401 100644
|
|
--- a/src/ovirt-foreign-menu.c
|
|
+++ b/src/ovirt-foreign-menu.c
|
|
@@ -640,6 +640,35 @@ static gboolean storage_domain_attached_to_data_center(OvirtStorageDomain *domai
|
|
}
|
|
#endif
|
|
|
|
+static gboolean storage_domain_validate(OvirtForeignMenu *menu G_GNUC_UNUSED,
|
|
+ OvirtStorageDomain *domain)
|
|
+{
|
|
+ char *name;
|
|
+ int type, state;
|
|
+ gboolean ret = TRUE;
|
|
+
|
|
+ g_object_get(domain, "name", &name, "type", &type, "state", &state, NULL);
|
|
+
|
|
+ if (type != OVIRT_STORAGE_DOMAIN_TYPE_ISO) {
|
|
+ g_debug("Storage domain '%s' type is not ISO", name);
|
|
+ ret = FALSE;
|
|
+ }
|
|
+
|
|
+ if (state != OVIRT_STORAGE_DOMAIN_STATE_ACTIVE) {
|
|
+ g_debug("Storage domain '%s' state is not active", name);
|
|
+ ret = FALSE;
|
|
+ }
|
|
+
|
|
+#ifdef HAVE_OVIRT_DATA_CENTER
|
|
+ if (!storage_domain_attached_to_data_center(domain, menu->priv->data_center)) {
|
|
+ g_debug("Storage domain '%s' is not attached to data center", name);
|
|
+ ret = FALSE;
|
|
+ }
|
|
+#endif
|
|
+
|
|
+ g_free(name);
|
|
+ return ret;
|
|
+}
|
|
|
|
static void storage_domains_fetched_cb(GObject *source_object,
|
|
GAsyncResult *result,
|
|
@@ -663,23 +692,9 @@ static void storage_domains_fetched_cb(GObject *source_object,
|
|
g_hash_table_iter_init(&iter, ovirt_collection_get_resources(collection));
|
|
while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&domain)) {
|
|
OvirtCollection *file_collection;
|
|
- int type;
|
|
- int state;
|
|
-
|
|
- g_object_get(domain, "type", &type, "state", &state, NULL);
|
|
- if (type != OVIRT_STORAGE_DOMAIN_TYPE_ISO) {
|
|
- continue;
|
|
- }
|
|
-
|
|
- if (state != OVIRT_STORAGE_DOMAIN_STATE_ACTIVE) {
|
|
- continue;
|
|
- }
|
|
|
|
-#ifdef HAVE_OVIRT_DATA_CENTER
|
|
- if (!storage_domain_attached_to_data_center(domain, menu->priv->data_center)) {
|
|
+ if (!storage_domain_validate(menu, domain))
|
|
continue;
|
|
- }
|
|
-#endif
|
|
|
|
file_collection = ovirt_storage_domain_get_files(domain);
|
|
if (file_collection != NULL) {
|
|
--
|
|
2.21.0
|
|
|