Skip to contentSkip to conversation

xl: obey uuid config option

PATCH In review Gianni Tedesco 3 participants 4 messages Aug 25, 2010 – Aug 27, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xl: obey uuid config option

tools/libxl/xl_cmdimpl.c +5 -1
diff -r fd38d1c9f5ac tools/libxl/xl_cmdimpl.c
@@ -607,7 +607,11 @@ static void parse_config_data(const char
         c_info->name = strdup(buf);
     else
         c_info->name = "test";
-    libxl_uuid_generate(&c_info->uuid);
+
+    if (!xlu_cfg_get_string (config, "uuid", &buf))
+        libxl_uuid_from_string(&c_info->uuid, buf);
+    else
+        libxl_uuid_generate(&c_info->uuid);
 
     if (!xlu_cfg_get_long(config, "oos", &l))
         c_info->oos = l;
#1 lore raw

What should the behaviour be if the uuid config option is a valid string but an invalid format?

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Gianni Tedesco
Sent: 25 August 2010 19:42
To: Xen Devel
Cc: Ian Jackson; Stefano Stabellini
Subject: [Xen-devel] [PATCH] xl: obey uuid config option

tools/libxl/xl_cmdimpl.c +5 -1
diff -r fd38d1c9f5ac tools/libxl/xl_cmdimpl.c
@@ -607,7 +607,11 @@ static void parse_config_data(const char
         c_info->name = strdup(buf);
     else
         c_info->name = "test";
-    libxl_uuid_generate(&c_info->uuid);
+
+    if (!xlu_cfg_get_string (config, "uuid", &buf))
+        libxl_uuid_from_string(&c_info->uuid, buf);
+    else
+        libxl_uuid_generate(&c_info->uuid);
 
     if (!xlu_cfg_get_long(config, "oos", &l))
         c_info->oos = l;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#2 lore raw
Quoted 2 lines · Owen Smith

What should the behaviour be if the uuid config option is a valid string but an invalid format?

good point.
We need to check the return value of libxl_uuid_from_string and act accordingly.

Quoted 33 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Gianni Tedesco
Sent: 25 August 2010 19:42
To: Xen Devel
Cc: Ian Jackson; Stefano Stabellini
Subject: [Xen-devel] [PATCH] xl: obey uuid config option

diff -r fd38d1c9f5ac tools/libxl/xl_cmdimpl.c

tools/libxl/xl_cmdimpl.c +5 -1
@@ -607,7 +607,11 @@ static void parse_config_data(const char
         c_info->name = strdup(buf);
     else
         c_info->name = "test";
-    libxl_uuid_generate(&c_info->uuid);
+
+    if (!xlu_cfg_get_string (config, "uuid", &buf))
+        libxl_uuid_from_string(&c_info->uuid, buf);
+    else
+        libxl_uuid_generate(&c_info->uuid);
 
     if (!xlu_cfg_get_long(config, "oos", &l))
         c_info->oos = l;

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel

#3 lore raw
In reply to Owen Smith
Quoted 2 lines · Owen Smith

What should the behaviour be if the uuid config option is a valid string but an invalid format?

Yes, this is indeed an error. Interestingly our uuid parsing API provides no return value whatsoever. This is interesting because it was lifted wholesale from blktap2 so this error may exist elsewhere.

I will need to re-do the random UUID's patch before re-basing this one and fixing it.

It's always the simplest seeming patches which take the longest eh :)

Gianni