From 7b38f418cb01d17cc125f5548ab5c13c0576684e Mon Sep 17 00:00:00 2001 From: Daniel Veillard Date: Thu, 27 Apr 2006 14:14:23 +0000 Subject: [PATCH] * src/xml.c src/xend_internal.c TODO: added uuid to the XML serialization Daniel --- ChangeLog | 5 +++++ TODO | 2 +- src/xend_internal.c | 15 +++++++++++++++ src/xml.c | 9 +++++++++ 4 files changed, 30 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 6353f98ee3..8a11a6b7bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Apr 27 14:17:04 EDT 2006 Daniel Veillard + + * src/xml.c src/xend_internal.c TODO: added uuid to the XML + serialization + Wed Apr 26 08:32:38 CEST 2006 Daniel Veillard * src/xml.c: applied patch from Jeremy Katz to not require a diff --git a/TODO b/TODO index 0055bd36f9..48a59724ac 100644 --- a/TODO +++ b/TODO @@ -7,7 +7,6 @@ TODO: - DTD/RNG/XSD schemas for the XML Domain descriptions - in python bindings raise an exception if a lookup or connection fails to return a non-None object -- Add uuid to XML format - add error handling hooks at the python level - object unicity for domains at the Python level - UUID lookup in hash.c @@ -50,3 +49,4 @@ Done: - API for the Node: extracting informations - docs for the principle in the error handling code - thread protection, reentrancy, refcounting, etc ... +- Add uuid to XML format diff --git a/src/xend_internal.c b/src/xend_internal.c index 3655246516..64cd72edda 100644 --- a/src/xend_internal.c +++ b/src/xend_internal.c @@ -1347,6 +1347,21 @@ xend_parse_sexp_desc(struct sexpr *root) goto error; } virBufferVSprintf(&buf, " %s\n", tmp); + tmp = sexpr_node(root, "domain/uuid"); + if (tmp != NULL) { + char compact[33]; + int i, j; + for (i = 0, j = 0;(i < 32) && (tmp[j] != 0);j++) { + if (((tmp[j] >= '0') && (tmp[j] <= '9')) || + ((tmp[j] >= 'a') && (tmp[j] <= 'f'))) + compact[i++] = tmp[j]; + else if ((tmp[j] >= 'A') && (tmp[j] <= 'F')) + compact[i++] = tmp[j] + 'a' - 'A'; + } + compact[i] = 0; + if (i > 0) + virBufferVSprintf(&buf, " %s\n", compact); + } tmp = sexpr_node(root, "domain/bootloader"); if (tmp != NULL) virBufferVSprintf(&buf, " %s\n", tmp); diff --git a/src/xml.c b/src/xml.c index 58646b3d85..ba417aa7d0 100644 --- a/src/xml.c +++ b/src/xml.c @@ -462,6 +462,7 @@ char * virDomainGetXMLDesc(virDomainPtr domain, int flags) { char *ret = NULL; + unsigned char uuid[16]; virBuffer buf; virDomainInfo info; @@ -483,6 +484,14 @@ virDomainGetXMLDesc(virDomainPtr domain, int flags) virDomainGetID(domain)); virBufferVSprintf(&buf, " %s\n", virDomainGetName(domain)); + if (virDomainGetUUID(domain, &uuid[0]) == 0) { + virBufferVSprintf(&buf, +" %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", + uuid[0], uuid[1], uuid[2], uuid[3], + uuid[4], uuid[5], uuid[6], uuid[7], + uuid[8], uuid[9], uuid[10], uuid[11], + uuid[12], uuid[13], uuid[14], uuid[15]); + } virDomainGetXMLBoot(domain, &buf); virBufferVSprintf(&buf, " %lu\n", info.maxMem); virBufferVSprintf(&buf, " %d\n", (int) info.nrVirtCpu); -- 2.47.2