+Tue Aug 5 12:51:11 CEST 2008 Daniel Veillard <veillard@redhat.com>
+
+ * src/openvz_conf.c src/openvz_conf.h src/openvz_driver.c: patch
+ from Evgeniy Sokolov saving the UUID when creating or defining
+ a domain.
+
Tue Aug 5 10:43:42 CEST 2008 Jim Meyering <meyering@redhat.com>
make distclean: remove generated source files
/* Do actual checking for UUID presence in conf file,
* assign if not present.
*/
-
-static int
-openvzSetUUID(int vpsid)
+int
+openvzSetDefinedUUID(int vpsid, unsigned char *uuid)
{
char conf_file[PATH_MAX];
char uuidstr[VIR_UUID_STRING_BUFLEN];
- unsigned char uuid[VIR_UUID_BUFLEN];
+
+ if (uuid == NULL)
+ return -1;
if (openvzLocateConfFile(vpsid, conf_file, PATH_MAX)<0)
return -1;
if (fp == NULL)
return -1;
- virUUIDGenerate(uuid);
virUUIDFormat(uuid, uuidstr);
/* Record failure if fprintf or fclose fails,
return 0;
}
+static int
+openvzSetUUID(int vpsid){
+ unsigned char uuid[VIR_UUID_BUFLEN];
+
+ virUUIDGenerate(uuid);
+
+ return openvzSetDefinedUUID(vpsid, uuid);
+}
+
/*
* Scan VPS config files and see if they have a UUID.
* If not, assign one. Just append one to the config
int strtoI(const char *str);
int openvzCheckEmptyMac(const unsigned char *mac);
char *openvzMacToString(const unsigned char *mac);
+int openvzSetDefinedUUID(int vpsid, unsigned char *uuid);
#endif /* OPENVZ_CONF_H */
goto exit;
}
+ if (openvzSetDefinedUUID(strtoI(vmdef->name), vmdef->uuid) < 0) {
+ openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Could not set UUID"));
+ goto exit;
+ }
+
dom = virGetDomain(conn, vm->vmdef->name, vm->vmdef->uuid);
if (dom)
dom->id = vm->vpsid;
goto exit;
}
+ if (openvzSetDefinedUUID(strtoI(vmdef->name), vmdef->uuid) < 0) {
+ openvzError(conn, VIR_ERR_INTERNAL_ERROR,
+ _("Could not set UUID"));
+ goto exit;
+ }
+
if (openvzDomainSetNetwork(conn, vmdef->name, vmdef->net) < 0) {
openvzError(conn, VIR_ERR_INTERNAL_ERROR,
_("Could not configure network"));