virt-manager/virtman-collidelist-fix.diff

32 lines
1.3 KiB
Diff
Raw Normal View History

Subject: util: get_default_path: Handle 'None' in collidelist
From: Cole Robinson crobinso@redhat.com Tue Aug 30 14:29:08 2011 -0400
Date: Tue Aug 30 14:29:08 2011 -0400:
Git: 9a46aa41e092e73ed1596c361acbca65ac3cbe95
Index: virt-manager-0.9.0/src/virtManager/util.py
===================================================================
--- virt-manager-0.9.0.orig/src/virtManager/util.py
+++ virt-manager-0.9.0/src/virtManager/util.py
@@ -126,14 +126,14 @@ def get_default_path(conn, name, collide
target, ignore, suffix = get_ideal_path_info(conn, name)
# Sanitize collidelist to work with the collision checker
- for c in collidelist[:]:
- collidelist.remove(c)
- if os.path.dirname(c) == pool.get_target_path():
- collidelist.append(os.path.basename(c))
+ newcollidelist = []
+ for c in collidelist:
+ if c and os.path.dirname(c) == pool.get_target_path():
+ newcollidelist.append(os.path.basename(c))
path = virtinst.Storage.StorageVolume.find_free_name(name,
pool_object=pool.pool, suffix=suffix,
- collidelist=collidelist)
+ collidelist=newcollidelist)
path = os.path.join(target, path)