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,