diff options
author | Guido Günther <agx@sigxcpu.org> | 2012-07-09 12:11:17 +0200 |
---|---|---|
committer | Guido Günther <agx@sigxcpu.org> | 2012-07-11 10:40:03 +0200 |
commit | 31351c316fee0487dcbc5ef6b630d75be6b212e5 (patch) | |
tree | 836b4ce033f7b62d29c368e4d47f9ade33aad530 /src/openvz | |
parent | Fix /domain/features setting in qemuParseCommandLine (diff) | |
download | libvirt-31351c316fee0487dcbc5ef6b630d75be6b212e5.tar.gz libvirt-31351c316fee0487dcbc5ef6b630d75be6b212e5.tar.bz2 libvirt-31351c316fee0487dcbc5ef6b630d75be6b212e5.zip |
openvz: Handle domain obj hash map errors
This makes the driver fail with a clear error message in case of UUID
collisions (for example if somebody copied a container configuration
without updating the UUID) and also raises an error on other hash map
failures.
OpenVZ itself doesn't complain about duplicate UUIDs since this
parameter is only used by libvirt.
Diffstat (limited to 'src/openvz')
-rw-r--r-- | src/openvz/openvz_conf.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c index 7b662994d..8d7bc258c 100644 --- a/src/openvz/openvz_conf.c +++ b/src/openvz/openvz_conf.c @@ -670,8 +670,18 @@ int openvzLoadDomains(struct openvz_driver *driver) { openvzReadMemConf(dom->def, veid); virUUIDFormat(dom->def->uuid, uuidstr); - if (virHashAddEntry(driver->domains.objs, uuidstr, dom) < 0) + if (virHashLookup(driver->domains.objs, uuidstr)) { + openvzError(VIR_ERR_INTERNAL_ERROR, + _("Duplicate container UUID %s detected for %d"), + uuidstr, + veid); + goto cleanup; + } + if (virHashAddEntry(driver->domains.objs, uuidstr, dom) < 0) { + openvzError(VIR_ERR_INTERNAL_ERROR, + _("Could not add UUID for container %d"), veid); goto cleanup; + } virDomainObjUnlock(dom); dom = NULL; |