[PATCH] openvz: Handle domain obj hash map errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).

OpenVZ itself doesn't complain about duplicate UUIDs since this
parameter is only used by libvirt.
---
 src/openvz/openvz_conf.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 503c8a0..0764c2c 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -684,8 +684,11 @@ int openvzLoadDomains(struct openvz_driver *driver) {
         openvzReadMemConf(dom->def, veid);
 
         virUUIDFormat(dom->def->uuid, uuidstr);
-        if (virHashAddEntry(driver->domains.objs, uuidstr, dom) < 0)
+        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;
-- 
1.7.10.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]