Fix domain rename

libvirt_domain object needs to be recreated, so force it. Also fix
config path setting (missing extension) - create_config_file
uses it as custom config indicator (if such detected, VM settings -
especially name, would not be updated).
This commit is contained in:
Marek Marczykowski 2013-05-22 05:44:35 +02:00 committed by Marek Marczykowski-Górecki
parent 062c3afcf5
commit 9393b5f931

View File

@ -548,6 +548,7 @@ class QubesVm(object):
self.pre_rename(name) self.pre_rename(name)
self.libvirt_domain.undefine() self.libvirt_domain.undefine()
self._libvirt_domain = 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):
@ -652,6 +653,8 @@ class QubesVm(object):
def _update_libvirt_domain(self): def _update_libvirt_domain(self):
domain_config = self.create_config_file() domain_config = self.create_config_file()
if self._libvirt_domain:
self._libvirt_domain.undefine()
self._libvirt_domain = vmm.libvirt_conn.defineXML(domain_config) self._libvirt_domain = vmm.libvirt_conn.defineXML(domain_config)
self.uuid = uuid.UUID(bytes=self._libvirt_domain.UUID()) self.uuid = uuid.UUID(bytes=self._libvirt_domain.UUID())