From 387e06421fd7a381855fdaa2cc1b0afd3f3c347b Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Mon, 28 Jul 2008 12:52:37 +0000 Subject: [PATCH] =?UTF-8?q?*=20src/qemu=5Fdriver.c:=20patch=20from=20Guido?= =?UTF-8?q?=20G=C3=BCnther=20to=20make=20sure=20create=20=20=20doesn't=20o?= =?UTF-8?q?verride=20an=20existing=20domain=20definition=20or=20UUID=20Dan?= =?UTF-8?q?iel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ChangeLog | 5 +++++ src/qemu_driver.c | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6ca9ba7230..deff7ea54f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Jul 28 14:50:55 CEST 2008 Daniel Veillard + + * src/qemu_driver.c: patch from Guido Günther to make sure create + doesn't override an existing domain definition or UUID + Fri Jul 25 17:21:27 BST 2008 Daniel P. Berrange * src/domain_conf.c: Fix typos in comments, and the dummy diff --git a/src/qemu_driver.c b/src/qemu_driver.c index d0c818429e..b8fd11c857 100644 --- a/src/qemu_driver.c +++ b/src/qemu_driver.c @@ -2013,13 +2013,24 @@ static virDomainPtr qemudDomainCreate(virConnectPtr conn, const char *xml, return NULL; vm = virDomainFindByName(driver->domains, def->name); - if (vm && virDomainIsActive(vm)) { + if (vm) { qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, - _("domain %s is already defined and running"), + _("domain '%s' is already defined and running"), def->name); virDomainDefFree(def); return NULL; } + vm = virDomainFindByUUID(driver->domains, def->uuid); + if (vm) { + char uuidstr[VIR_UUID_STRING_BUFLEN]; + + virUUIDFormat(def->uuid, uuidstr); + qemudReportError(conn, NULL, NULL, VIR_ERR_OPERATION_FAILED, + _("domain with uuid '%s' is already defined and running"), + uuidstr); + virDomainDefFree(def); + return NULL; + } if (!(vm = virDomainAssignDef(conn, &driver->domains,