[Libvirt-cim] [PATCH] Handle the case where bootloader (and _args) is not specified

Dan Smith danms at us.ibm.com
Mon Nov 12 21:36:23 UTC 2007


# HG changeset patch
# User Dan Smith <danms at us.ibm.com>
# Date 1194905179 28800
# Node ID 44fb749aa036b3ccaeed3862a302a3848cea3822
# Parent  4ceb57b4430b0455ef7cb68f57a8ec6ad01abeca
Handle the case where bootloader (and _args) is not specified

Otherwise, there is an error starting the domain because the bootloader
is not executable.

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

diff -r 4ceb57b4430b -r 44fb749aa036 libxkutil/xmlgen.c
--- a/libxkutil/xmlgen.c	Mon Nov 12 13:54:53 2007 -0800
+++ b/libxkutil/xmlgen.c	Mon Nov 12 14:06:19 2007 -0800
@@ -244,21 +244,29 @@ static char *system_xml(struct domain *d
 static char *system_xml(struct domain *domain)
 {
         int ret;
-        char *xml;
+        char *bl = NULL;
+        char *bl_args = NULL;
+        char *xml;
+
+        bl = tagify("bootloader", domain->bootloader, NULL, 0);
+        bl_args = tagify("bootloader_args", domain->bootloader_args, NULL, 0);
 
         ret = asprintf(&xml,
                        "<name>%s</name>\n"
-                       "<bootloader>%s</bootloader>\n"
-                       "<bootloader_args>%s</bootloader_args>\n"
+                       "%s\n"
+                       "%s\n"
                        "<on_poweroff>%s</on_poweroff>\n"
                        "<on_crash>%s</on_crash>\n",
                        domain->name,
-                       domain->bootloader,
-                       domain->bootloader_args,
+                       bl,
+                       bl_args,
                        vssd_recovery_action_str(domain->on_poweroff),
                        vssd_recovery_action_str(domain->on_crash));
         if (ret == -1)
                 xml = NULL;
+
+        free(bl);
+        free(bl_args);
 
         return xml;
 }




More information about the Libvirt-cim mailing list