提交 7b38f418 编写于 作者: D Daniel Veillard

* src/xml.c src/xend_internal.c TODO: added uuid to the XML

  serialization
Daniel
上级 1e018483
Thu Apr 27 14:17:04 EDT 2006 Daniel Veillard <veillard@redhat.com>
* src/xml.c src/xend_internal.c TODO: added uuid to the XML
serialization
Wed Apr 26 08:32:38 CEST 2006 Daniel Veillard <veillard@redhat.com>
* src/xml.c: applied patch from Jeremy Katz to not require a
......
......@@ -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
......@@ -1347,6 +1347,21 @@ xend_parse_sexp_desc(struct sexpr *root)
goto error;
}
virBufferVSprintf(&buf, " <name>%s</name>\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, " <uuid>%s</uuid>\n", compact);
}
tmp = sexpr_node(root, "domain/bootloader");
if (tmp != NULL)
virBufferVSprintf(&buf, " <bootloader>%s</bootloader>\n", tmp);
......
......@@ -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, " <name>%s</name>\n",
virDomainGetName(domain));
if (virDomainGetUUID(domain, &uuid[0]) == 0) {
virBufferVSprintf(&buf,
" <uuid>%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x</uuid>\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, " <memory>%lu</memory>\n", info.maxMem);
virBufferVSprintf(&buf, " <vcpu>%d</vcpu>\n", (int) info.nrVirtCpu);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册