Skip to contentSkip to conversation

libxl: check HVM direct boot parameters

PATCH In review Wei Liu 2 participants 2 messages Jan 19, 2015

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH v2 1/1 libxl: check HVM direct boot parameters

We should honour -initrd and -append iff -kernel is specified, because that's how QEMU works.

Check direct boot parameters in libxl__domain_build_info_setdefault. Return failure if kernel is missing while ramdisk (-initrd) and / or cmdline (-append) is present.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Chunyan Liu <[email protected]>

---
v2: use LOG and fix formatting

---
 tools/libxl/libxl_create.c |    8 ++++++++
 1 file changed, 8 insertions(+)
tools/libxl/libxl_create.c +8 -0
index 6f87d1c..98687bd 100644
@@ -170,6 +170,14 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc,
             break;
         default:abort();
         }
+
+        /* Check HVM direct boot parameters, we should honour ->ramdisk and
+         * ->cmdline iff ->kernel is set.
+         */
+        if (!b_info->kernel && (b_info->ramdisk || b_info->cmdline)) {
+            LOG(ERROR, "direct boot parameters specified but kernel missing");
+            return ERROR_INVAL;
+        }
     }
 
     if (b_info->type == LIBXL_DOMAIN_TYPE_HVM &&
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 7 lines · Wei Liu

We should honour -initrd and -append iff -kernel is specified, because that's how QEMU works.

Check direct boot parameters in libxl__domain_build_info_setdefault. Return failure if kernel is missing while ramdisk (-initrd) and / or cmdline (-append) is present.

Quoted 6 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Chunyan Liu <[email protected]>

and applied, thanks for the fast turnaround!

Ian.