Check for None before calling method (VM rename fix)

This commit is contained in:
Marek Marczykowski-Górecki 2013-09-26 22:24:58 +02:00
parent 39918fa9e2
commit 27b031c59f

View File

@ -554,10 +554,12 @@ class QubesVm(object):
raise QubesException("Cannot rename VM installed by RPM -- first clone VM and then use yum to remove package.") raise QubesException("Cannot rename VM installed by RPM -- first clone VM and then use yum to remove package.")
self.pre_rename(name) self.pre_rename(name)
self.libvirt_domain.undefine() if self.libvirt_domain:
self.libvirt_domain.undefine()
self._libvirt_domain = None self._libvirt_domain = None
self._qdb_connection.close() if self._qdb_connection:
self._qdb_connection = None self._qdb_connection.close()
self._qdb_connection = None
new_conf = os.path.join(self.dir_path, name + '.conf') new_conf = os.path.join(self.dir_path, name + '.conf')
if os.path.exists(self.conf_file): if os.path.exists(self.conf_file):