Signed-off-by: Xu Wang <gesaint(a)linux.vnet.ibm.com>
---
libxkutil/xmlgen.c | 102 ++++++++++++++++++++++++++++++++++++----------------
1 files changed, 71 insertions(+), 31 deletions(-)
diff --git a/libxkutil/xmlgen.c b/libxkutil/xmlgen.c
index dbf60bd..3dff548 100644
--- a/libxkutil/xmlgen.c
+++ b/libxkutil/xmlgen.c
@@ -1338,56 +1338,96 @@ static const char *input_xml(xmlNodePtr root, struct domain
*dominfo)
static char *system_xml(xmlNodePtr root, struct domain *domain)
{
- xmlNodePtr tmp;
+ CU_DEBUG("Enter system_xml()");
- tmp = xmlNewChild(root, NULL, BAD_CAST "name", BAD_CAST
domain->name);
- if (tmp == NULL)
+ domain->others = add_node_to_others(domain->others,
+ "name",
+ domain->name,
+ TYPE_NODE,
+ "domain");
+
+ if (domain->others == NULL) {
+ CU_DEBUG("add node <name> failed.");
return XML_ERROR;
+ }
if (domain->bootloader) {
- tmp = xmlNewChild(root,
- NULL,
- BAD_CAST "bootloader",
- BAD_CAST domain->bootloader);
- if (tmp == NULL)
+ domain->others = add_node_to_others(domain->others,
+ "bootloader",
+ domain->bootloader,
+ TYPE_NODE,
+ "domain");
+
+ if (domain->others == NULL) {
+ CU_DEBUG("add node <bootloader> failed.");
return XML_ERROR;
+ }
}
if (domain->bootloader_args) {
- tmp = xmlNewChild(root,
- NULL,
- BAD_CAST "bootloader_args",
- BAD_CAST domain->bootloader_args);
- if (tmp == NULL)
+ domain->others = add_node_to_others(domain->others,
+ "bootloader_args",
+ domain->bootloader_args,
+ TYPE_NODE,
+ "domain");
+
+ if (domain->others == NULL) {
+ CU_DEBUG("add node <bootloader_args> failed.");
return XML_ERROR;
+ }
}
- tmp = xmlNewChild(root,
- NULL,
- BAD_CAST "on_poweroff",
- BAD_CAST vssd_recovery_action_str(domain->on_poweroff));
- if (tmp == NULL)
+ domain->others = add_node_to_others(domain->others,
+ "on_poweroff",
+
vssd_recovery_action_str(domain->on_poweroff),
+ TYPE_NODE,
+ "domain");
+
+ if (domain->others == NULL) {
+ CU_DEBUG("add node <on_poweroff> failed.");
return XML_ERROR;
+ }
- tmp = xmlNewChild(root,
- NULL,
- BAD_CAST "on_crash",
- BAD_CAST vssd_recovery_action_str(domain->on_crash));
- if (tmp == NULL)
+ domain->others = add_node_to_others(domain->others,
+ "on_crash",
+
vssd_recovery_action_str(domain->on_crash),
+ TYPE_NODE,
+ "domain");
+
+ if (domain->others == NULL) {
+ CU_DEBUG("add node <on_crash> failed.");
return XML_ERROR;
+ }
- tmp = xmlNewChild(root,
- NULL,
- BAD_CAST "uuid",
- BAD_CAST domain->uuid);
- if (tmp == NULL)
+ domain->others = add_node_to_others(domain->others,
+ "uuid",
+ domain->uuid,
+ TYPE_NODE,
+ "domain");
+
+ if (domain->others == NULL) {
+ CU_DEBUG("add node <uuid> failed.");
return XML_ERROR;
+ }
+
if (domain->clock != NULL) {
- tmp = xmlNewChild(root, NULL, BAD_CAST "clock", NULL);
- if (tmp == NULL)
+ domain->others = add_node_to_others(domain->others,
+ "clock",
+ NULL,
+ TYPE_NODE,
+ "domain");
+
+ if (domain->others == NULL) {
+ CU_DEBUG("add node <clock> failed.");
return XML_ERROR;
- xmlNewProp(tmp, BAD_CAST "offset", BAD_CAST domain->clock);
+ }
+
+ domain->others = add_node_to_others(domain->others,
+ "offset",
+ domain->clock,
+ TYPE_PROP,
+ "clock");
}
return NULL;
--
1.7.1