Blob Blame History Raw
From 790cfb1fd1789f7bbc7c2afd2e9220825c2c1f0d Mon Sep 17 00:00:00 2001
From: Christophe Fergeau <cfergeau@redhat.com>
Date: Tue, 1 Mar 2016 11:51:13 +0100
Subject: [PATCH] ovirt: Only use active ISO domains for foreign menu

oVirt storage domains can be in various states (inactive, in
maintainance, ...). We only want to show the ISOs it contains in the
foreign menu when the storage domain is actually active, not in the
other states.

https://bugzilla.redhat.com/show_bug.cgi?id=1310450
(cherry picked from commit 0ea2a674b8a7fd51dc1a115c646fe6ff82da3e39)
---
 src/ovirt-foreign-menu.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/ovirt-foreign-menu.c b/src/ovirt-foreign-menu.c
index 9b6d3b8..59104a8 100644
--- a/src/ovirt-foreign-menu.c
+++ b/src/ovirt-foreign-menu.c
@@ -651,12 +651,17 @@ static void storage_domains_fetched_cb(GObject *source_object,
     while (g_hash_table_iter_next(&iter, NULL, (gpointer *)&domain)) {
         OvirtCollection *file_collection;
         int type;
+        int state;
 
-        g_object_get(domain, "type", &type, NULL);
+        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;
+        }
+
         file_collection = ovirt_storage_domain_get_files(domain);
         if (file_collection != NULL) {
             if (menu->priv->files) {