qubes: fix changing domain name

Changing name of running VM is wrong.

Acknowledgement:
This commit is a result of core3 review by Marek.
This commit is contained in:
Wojtek Porczyk 2015-01-08 19:44:14 +01:00
parent 1deb3221c7
commit c0e3281d04

View File

@ -509,6 +509,9 @@ class QubesVM(qubes.vm.BaseVM):
@qubes.events.handler('property-set:name')
def on_property_set_name(self, event, name, new_name, old_name=None):
# TODO not self.is_stopped() would be more appropriate
if self.is_running():
raise QubesException('Cannot change name of running domain')
if self.libvirt_domain:
self.libvirt_domain.undefine()
self._libvirt_domain = None