From 9fa090b422f40a29fa4e9a18d7fb2971e4a3b1d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= Date: Mon, 8 Feb 2016 04:38:26 +0100 Subject: [PATCH] core: prevent VM renaming over already existing VM Fixes QubesOS/qubes-issues#1723 --- core-modules/000QubesVm.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core-modules/000QubesVm.py b/core-modules/000QubesVm.py index b714f544..0a777c32 100644 --- a/core-modules/000QubesVm.py +++ b/core-modules/000QubesVm.py @@ -591,6 +591,10 @@ class QubesVm(object): if self.installed_by_rpm: 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) try: self.libvirt_domain.undefine()