[Libvirt-cim] [PATCH 4 of 5] Don't regenerate a UUID if one already exists

Dan Smith danms at us.ibm.com
Wed Nov 7 16:02:29 UTC 2007


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1194454630 28800
# Node ID e1c63130f720d975822d7c8e3c8ed35c8e18dd15
# Parent  03b92d27d21ea95b552642326fb4c357e643f989
Don't regenerate a UUID if one already exists

Signed-off-by: Dan Smith <danms at us.ibm.com>

diff -r 03b92d27d21e -r e1c63130f720 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c	Wed Nov 07 08:57:05 2007 -0800
+++ b/libxkutil/xmlgen.c	Wed Nov 07 08:57:10 2007 -0800
@@ -317,8 +317,14 @@ char *system_to_xml(struct domain *domin
         uint8_t uuid[16];
         char uuidstr[37];
 
-        uuid_generate(uuid);
-        uuid_unparse(uuid, uuidstr);
+        if (dominfo->uuid) {
+                strcpy(uuidstr, dominfo->uuid);
+                CU_DEBUG("Using existing UUID: %s");
+        } else {
+                CU_DEBUG("New UUID");
+                uuid_generate(uuid);
+                uuid_unparse(uuid, uuidstr);
+        }
 
         concat_devxml(&devxml, dominfo->dev_net, dominfo->dev_net_ct);
         concat_devxml(&devxml, dominfo->dev_disk, dominfo->dev_disk_ct);




More information about the Libvirt-cim mailing list