9228aea
From: Cole Robinson <crobinso@redhat.com>
9228aea
Date: Sun, 21 Jun 2015 15:47:31 -0400
9228aea
Subject: [PATCH virt-manager] createpool: Fix adding iscsi pools (bz 1231558)
9228aea
9228aea
(cherry picked from commit 34db1af7b661b7eb5df4c71fc910d31c1ae9f7a4)
9228aea
---
9228aea
 virtManager/createpool.py | 6 ++++--
9228aea
 virtManager/uiutil.py     | 8 ++++++--
9228aea
 2 files changed, 10 insertions(+), 4 deletions(-)
9228aea
9228aea
diff --git a/virtManager/createpool.py b/virtManager/createpool.py
9228aea
index bd18d43..1eaa805 100644
9228aea
--- a/virtManager/createpool.py
9228aea
+++ b/virtManager/createpool.py
9228aea
@@ -479,9 +479,11 @@ class vmmCreatePool(vmmGObjectUI):
9228aea
         source_list = self.widget("pool-source-path")
9228aea
         target_list = self.widget("pool-target-path")
9228aea
 
9228aea
-        pool = uiutil.get_list_selection(source_list, column=2)
9228aea
+        pool = uiutil.get_list_selection(source_list, column=2,
9228aea
+                                         check_entry=False)
9228aea
         if pool is None:
9228aea
-            pool = uiutil.get_list_selection(target_list, column=2)
9228aea
+            pool = uiutil.get_list_selection(target_list, column=2,
9228aea
+                                             check_entry=False)
9228aea
 
9228aea
         return pool
9228aea
 
9228aea
diff --git a/virtManager/uiutil.py b/virtManager/uiutil.py
9228aea
index 82d2c1d..40b74d4 100644
9228aea
--- a/virtManager/uiutil.py
9228aea
+++ b/virtManager/uiutil.py
9228aea
@@ -70,17 +70,21 @@ def get_list_selected_row(widget, check_visible=False):
9228aea
     return row
9228aea
 
9228aea
 
9228aea
-def get_list_selection(widget, column=0, check_visible=False):
9228aea
+def get_list_selection(widget, column=0,
9228aea
+                       check_visible=False, check_entry=True):
9228aea
     """
9228aea
     Helper to simplify getting the selected row and value in a list/tree/combo.
9228aea
     If nothing is selected, and the widget is a combo box with a text entry,
9228aea
     return the value of that.
9228aea
+
9228aea
+    :param check_entry: If True, attempt to check the widget's text entry
9228aea
+        using the logic described above.
9228aea
     """
9228aea
     row = get_list_selected_row(widget, check_visible=check_visible)
9228aea
     if row is not None:
9228aea
         return row[column]
9228aea
 
9228aea
-    if hasattr(widget, "get_has_entry"):
9228aea
+    if check_entry and hasattr(widget, "get_has_entry"):
9228aea
         if widget.get_has_entry():
9228aea
             return widget.get_child().get_text().strip()
9228aea