<div dir="ltr">Reviewed-by: Crístian Deives &lt;<a href="mailto:cristiandeives@gmail.com">cristiandeives@gmail.com</a>&gt;<br></div><br><div class="gmail_quote">On Thu, May 7, 2015 at 12:17 PM Aline Manera &lt;<a href="mailto:alinefm@linux.vnet.ibm.com">alinefm@linux.vnet.ibm.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Instead of predefine a default pools list, build it according to user<br>
input to make it will be always accurated.<br>
Specially in case to import the StoragePoolsModel multiple times.<br>
<br>
Signed-off-by: Aline Manera &lt;<a href="mailto:alinefm@linux.vnet.ibm.com" target="_blank">alinefm@linux.vnet.ibm.com</a>&gt;<br>
---<br>
 src/kimchi/model/storagepools.py | 19 +++++++++----------<br>
 1 file changed, 9 insertions(+), 10 deletions(-)<br>
<br>
diff --git a/src/kimchi/model/storagepools.py b/src/kimchi/model/storagepools.py<br>
index e82d6ed..f022deb 100644<br>
--- a/src/kimchi/model/storagepools.py<br>
+++ b/src/kimchi/model/storagepools.py<br>
@@ -35,9 +35,6 @@ from kimchi.utils import add_task, kimchi_log, pool_name_from_uri, run_command<br>
 from kimchi.xmlutils.utils import xpath_get_text<br>
<br>
<br>
-DEFAULT_POOLS = {&#39;default&#39;: {&#39;path&#39;: &#39;/var/lib/libvirt/images&#39;},<br>
-                 &#39;ISO&#39;: {&#39;path&#39;: &#39;/var/lib/kimchi/isos&#39;}}<br>
-<br>
 ISO_POOL_NAME = u&#39;kimchi_isos&#39;<br>
<br>
 POOL_STATE_MAP = {0: &#39;inactive&#39;,<br>
@@ -71,25 +68,27 @@ class StoragePoolsModel(object):<br>
             self._check_default_pools()<br>
<br>
     def _check_default_pools(self):<br>
+        pools = {}<br>
+<br>
         default_pool = tmpl_defaults[&#39;storagepool&#39;]<br>
         default_pool = default_pool.split(&#39;/&#39;)[2]<br>
<br>
-        if default_pool != &#39;default&#39;:<br>
-            del DEFAULT_POOLS[&#39;default&#39;]<br>
-            DEFAULT_POOLS[default_pool] = {}<br>
+        pools[default_pool] = {}<br>
+        if default_pool == &#39;default&#39;:<br>
+            pools[default_pool] = {&#39;path&#39;: &#39;/var/lib/libvirt/images&#39;}<br>
<br>
-        if config.get(&quot;server&quot;, &quot;create_iso_pool&quot;) != &quot;true&quot;:<br>
-            del DEFAULT_POOLS[&#39;ISO&#39;]<br>
+        if config.get(&quot;server&quot;, &quot;create_iso_pool&quot;) == &quot;true&quot;:<br>
+            pools[&#39;ISO&#39;] = {&#39;path&#39;: &#39;/var/lib/kimchi/isos&#39;}<br>
<br>
         error_msg = (&quot;Please, check the configuration in %s/template.conf to &quot;<br>
                      &quot;ensure it has a valid storage pool.&quot; % paths.conf_dir)<br>
<br>
         conn = self.conn.get()<br>
-        for pool_name in DEFAULT_POOLS:<br>
+        for pool_name in pools:<br>
             try:<br>
                 pool = conn.storagePoolLookupByName(pool_name)<br>
             except libvirt.libvirtError, e:<br>
-                pool_path = DEFAULT_POOLS[pool_name].get(&#39;path&#39;)<br>
+                pool_path = pools[pool_name].get(&#39;path&#39;)<br>
                 if pool_path is None:<br>
                     msg = &quot;Fatal: Unable to find storage pool %s. &quot; + error_msg<br>
                     kimchi_log.error(msg % pool_name)<br>
--<br>
2.1.0<br>
<br>
_______________________________________________<br>
Kimchi-devel mailing list<br>
<a href="mailto:Kimchi-devel@ovirt.org" target="_blank">Kimchi-devel@ovirt.org</a><br>
<a href="http://lists.ovirt.org/mailman/listinfo/kimchi-devel" target="_blank">http://lists.ovirt.org/mailman/listinfo/kimchi-devel</a><br>
</blockquote></div>