diff options
author | Cole Robinson <crobinso@redhat.com> | 2017-07-18 19:09:58 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2017-07-20 17:28:38 -0400 |
commit | 5b51c98ae5c11e3282b34189a8de59531731e6b3 (patch) | |
tree | 62744952b85128ee5aba55647141a2bbde616693 /virtinst/storage.py | |
parent | 55aa23b4000072e22e13e6e13ff4031cb75111af (diff) | |
download | virt-manager-5b51c98ae5c11e3282b34189a8de59531731e6b3.tar.gz |
storage: Check for pool name collisions against the pool cache
Rather than using storagePoolLookupByName. This will save some API
calls, but the main benefit is that it can help shake out cache
issues.
Diffstat (limited to 'virtinst/storage.py')
-rw-r--r-- | virtinst/storage.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/virtinst/storage.py b/virtinst/storage.py index 8733d87d..c5f1f1a4 100644 --- a/virtinst/storage.py +++ b/virtinst/storage.py @@ -295,9 +295,14 @@ class StoragePool(_StorageObject): Finds a name similar (or equal) to passed 'basename' that is not in use by another pool. Extra params are passed to generate_name """ - return util.generate_name(basename, - conn.storagePoolLookupByName, - **kwargs) + def cb(name): + for pool in conn.fetch_all_pools(): + if pool.name == name: + return True + return False + + kwargs["lib_collision"] = False + return util.generate_name(basename, cb, **kwargs) def __init__(self, *args, **kwargs): |