5bdfcd9
commit 9a46aa41e092e73ed1596c361acbca65ac3cbe95
5bdfcd9
Author: Cole Robinson <crobinso@redhat.com>
5bdfcd9
Date:   Tue Aug 30 14:29:08 2011 -0400
5bdfcd9
5bdfcd9
    util: get_default_path: Handle 'None' in collidelist
5bdfcd9
5bdfcd9
diff --git a/src/virtManager/util.py b/src/virtManager/util.py
5bdfcd9
index d351cb3..0cba349 100644
5bdfcd9
--- a/src/virtManager/util.py
5bdfcd9
+++ b/src/virtManager/util.py
5bdfcd9
@@ -126,14 +126,14 @@ def get_default_path(conn, name, collidelist=None):
5bdfcd9
         target, ignore, suffix = get_ideal_path_info(conn, name)
5bdfcd9
 
5bdfcd9
         # Sanitize collidelist to work with the collision checker
5bdfcd9
-        for c in collidelist[:]:
5bdfcd9
-            collidelist.remove(c)
5bdfcd9
-            if os.path.dirname(c) == pool.get_target_path():
5bdfcd9
-                collidelist.append(os.path.basename(c))
5bdfcd9
+        newcollidelist = []
5bdfcd9
+        for c in collidelist:
5bdfcd9
+            if c and os.path.dirname(c) == pool.get_target_path():
5bdfcd9
+                newcollidelist.append(os.path.basename(c))
5bdfcd9
 
5bdfcd9
         path = virtinst.Storage.StorageVolume.find_free_name(name,
5bdfcd9
                         pool_object=pool.pool, suffix=suffix,
5bdfcd9
-                        collidelist=collidelist)
5bdfcd9
+                        collidelist=newcollidelist)
5bdfcd9
 
5bdfcd9
         path = os.path.join(target, path)
5bdfcd9