diff --git a/src/openvz/openvz_conf.c b/src/openvz/openvz_conf.c
index 51dbde5ee3..a4aab1ee4a 100644
--- a/src/openvz/openvz_conf.c
+++ b/src/openvz/openvz_conf.c
@@ -908,7 +908,11 @@ static int
 openvzSetUUID(int vpsid){
     unsigned char uuid[VIR_UUID_BUFLEN];
 
-    virUUIDGenerate(uuid);
+    if (virUUIDGenerate(uuid)) {
+        openvzError(NULL, VIR_ERR_INTERNAL_ERROR,
+                    "%s", _("Failed to generate UUID"));
+        return -1;
+    }
 
     return openvzSetDefinedUUID(vpsid, uuid);
 }