From: Wei Liu Subject: Re: [PATCH] libxl: check HVM direct boot parameters Date: Thu, 15 Jan 2015 16:01:40 +0000 Message-ID: <20150115160140.GC3945@zion.uk.xensource.com> References: <1421334702-5776-1-git-send-email-wei.liu2@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1421334702-5776-1-git-send-email-wei.liu2@citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: Chunyan Liu , Ian Jackson , Wei Liu , Ian Campbell , Stefano Stabellini List-Id: xen-devel@lists.xenproject.org On Thu, Jan 15, 2015 at 03:11:42PM +0000, Wei Liu wrote: > 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. > > Signed-off-by: Wei Liu > Cc: Ian Campbell > Cc: Ian Jackson > Cc: Stefano Stabellini > Cc: Chunyan Liu > --- > tools/libxl/libxl_create.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c > index 1198225..31f681e 100644 > --- a/tools/libxl/libxl_create.c > +++ b/tools/libxl/libxl_create.c > @@ -170,6 +170,15 @@ 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)) { > + LIBXL__LOG(CTX, XLT_ERROR, > + "direct boot parameters specified but kernel is missing"); Hmm... There's a formatting error. I can resend if it's necessary. > + return ERROR_INVAL; > + } > } > > if (b_info->type == LIBXL_DOMAIN_TYPE_HVM && > -- > 1.7.10.4