提交 31351c31 编写于 作者: G Guido Günther

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.
上级 626dd518
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册