Subject: storage: do not throw exception if the volume or the pool don't exist From: Giuseppe Scrivano gscrivan@redhat.com Thu May 7 13:42:00 2015 +0200 Date: Thu May 7 17:42:58 2015 +0200: Git: ac2be79658ec5673d00ca9603db63b9b0de4fbd3 commit 5357b91402fb7a8a73921216926908c08f6ad99d changed the semantic of conn.get_(vm|pool|interface|nodedev|net), to return None instead of raising KeyError. Leave the exception handling code in case the semantic is going to be reverted. Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1219427 Signed-off-by: Giuseppe Scrivano Index: virt-manager-1.2.0/virtManager/delete.py =================================================================== --- virt-manager-1.2.0.orig/virtManager/delete.py +++ virt-manager-1.2.0/virtManager/delete.py @@ -236,7 +236,11 @@ def populate_storage_list(storage_list, if disk.source_pool: try: pool = conn.get_pool(disk.source_pool) + if pool is None: + return disk.path vol = pool.get_volume(disk.path) + if vol is None: + return disk.path return vol.get_target_path() except KeyError: return disk.path Index: virt-manager-1.2.0/virtManager/details.py =================================================================== --- virt-manager-1.2.0.orig/virtManager/details.py +++ virt-manager-1.2.0/virtManager/details.py @@ -2698,12 +2698,14 @@ class vmmDetails(vmmGObjectUI): if not path: size = "-" else: + vol = None if source_pool: try: pool = self.conn.get_pool(source_pool) - vol = pool.get_volume(path) + if pool is not None: + vol = pool.get_volume(path) except KeyError: - vol = None + pass else: vol = self.conn.get_vol_by_path(path)