diff options
author | Cole Robinson <crobinso@redhat.com> | 2017-05-05 12:47:21 -0400 |
---|---|---|
committer | Cole Robinson <crobinso@redhat.com> | 2017-05-05 14:52:11 -0400 |
commit | 62feeb02a80f2d5a94773316d9193da9f53ddf3e (patch) | |
tree | 9fb382b8301d7604d82c57d12997b6e482df3947 /virtinst/storage.py | |
parent | fcebefd3bba251ba0d5de4381f55789df2c57295 (diff) | |
download | virt-manager-62feeb02a80f2d5a94773316d9193da9f53ddf3e.tar.gz |
Switch to python3 style 'except X as Y' notation
Which also works with python2.7
Diffstat (limited to 'virtinst/storage.py')
-rw-r--r-- | virtinst/storage.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/virtinst/storage.py b/virtinst/storage.py index 808891f3..1526b342 100644 --- a/virtinst/storage.py +++ b/virtinst/storage.py @@ -160,7 +160,7 @@ class StoragePool(_StorageObject): try: xml = conn.findStoragePoolSources(pool_type, source_xml, 0) - except libvirt.libvirtError, e: + except libvirt.libvirtError as e: if util.is_error_nosupport(e): return [] raise @@ -228,7 +228,7 @@ class StoragePool(_StorageObject): defpool.install(build=True, create=True, autostart=True) conn.clear_cache(pools=True) return defpool - except Exception, e: + except Exception as e: raise RuntimeError( _("Couldn't create default storage pool '%s': %s") % (path, str(e))) @@ -529,33 +529,33 @@ class StoragePool(_StorageObject): try: pool = self.conn.storagePoolDefineXML(xml, 0) - except Exception, e: + except Exception as e: raise RuntimeError(_("Could not define storage pool: %s") % str(e)) errmsg = None if build: try: pool.build(libvirt.VIR_STORAGE_POOL_BUILD_NEW) - except Exception, e: + except Exception as e: errmsg = _("Could not build storage pool: %s") % str(e) if create and not errmsg: try: pool.create(0) - except Exception, e: + except Exception as e: errmsg = _("Could not start storage pool: %s") % str(e) if autostart and not errmsg: try: pool.setAutostart(True) - except Exception, e: + except Exception as e: errmsg = _("Could not set pool autostart flag: %s") % str(e) if errmsg: # Try and clean up the leftover pool try: pool.undefine() - except Exception, e: + except Exception as e: logging.debug("Error cleaning up pool after failure: " + "%s" % str(e)) raise RuntimeError(errmsg) @@ -846,7 +846,7 @@ class StorageVolume(_StorageObject): logging.debug("Storage volume '%s' install complete.", self.name) return vol - except Exception, e: + except Exception as e: logging.debug("Error creating storage volume", exc_info=True) raise RuntimeError("Couldn't create storage volume " "'%s': '%s'" % (self.name, str(e))) |