diff options
author | Daniel Veillard <veillard@redhat.com> | 2009-11-17 12:06:46 +0100 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2009-11-20 16:02:17 +0100 |
commit | 776b675861a73b5571edfdbd6c29e0e1b18b569f (patch) | |
tree | da1d6922c864b14203b57805d702244dbe55657a | |
parent | 512069 fix domain XML schemas for backward compatibility (diff) | |
download | libvirt-776b675861a73b5571edfdbd6c29e0e1b18b569f.tar.gz libvirt-776b675861a73b5571edfdbd6c29e0e1b18b569f.tar.bz2 libvirt-776b675861a73b5571edfdbd6c29e0e1b18b569f.zip |
504262 Check for duplicated UUID in XM Xen defines
* src/xen/xm_internal.c: the XM driver was not checking for previously
defined UUID on new defines. Similar to virDomainObjIsDuplicate()
behaviour.
-rw-r--r-- | src/xen/xm_internal.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c index f833ce7ef..2ee321f0b 100644 --- a/src/xen/xm_internal.c +++ b/src/xen/xm_internal.c @@ -2623,6 +2623,26 @@ virDomainPtr xenXMDomainDefineXML(virConnectPtr conn, const char *xml) { return (NULL); } + /* + * check that if there is another domain defined with the same uuid + * it has the same name + */ + if ((entry = virHashSearch(priv->configCache, xenXMDomainSearchForUUID, + (const void *)&(def->uuid))) != NULL) { + if ((entry->def != NULL) && (entry->def->name != NULL) && + (STRNEQ(def->name, entry->def->name))) { + char uuidstr[VIR_UUID_STRING_BUFLEN]; + + virUUIDFormat(entry->def->uuid, uuidstr); + xenXMError(conn, VIR_ERR_OPERATION_FAILED, + _("domain '%s' is already defined with uuid %s"), + entry->def->name, uuidstr); + entry = NULL; + goto error; + } + entry = NULL; + } + if (virHashLookup(priv->nameConfigMap, def->name)) { /* domain exists, we will overwrite it */ |