core: prevent VM renaming over already existing VM
Fixes QubesOS/qubes-issues#1723
This commit is contained in:
parent
be231421de
commit
9fa090b422
@ -591,6 +591,10 @@ class QubesVm(object):
|
|||||||
if self.installed_by_rpm:
|
if self.installed_by_rpm:
|
||||||
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.")
|
||||||
|
|
||||||
|
assert self._collection is not None
|
||||||
|
if self._collection.get_vm_by_name(name):
|
||||||
|
raise QubesException("VM with this name already exists")
|
||||||
|
|
||||||
self.pre_rename(name)
|
self.pre_rename(name)
|
||||||
try:
|
try:
|
||||||
self.libvirt_domain.undefine()
|
self.libvirt_domain.undefine()
|
||||||
|
Loading…
Reference in New Issue
Block a user