WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] Re: [PATCH] libxl: initialize domid to 0 in libxl__creat

To: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] Re: [PATCH] libxl: initialize domid to 0 in libxl__create_stubdom
From: ZhouPeng <zpengxen@xxxxxxxxx>
Date: Tue, 21 Jun 2011 15:31:46 +0800
Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Wei Liu <liuw@xxxxxxxxx>
Delivery-date: Tue, 21 Jun 2011 00:34:59 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=+MflLzFWt2yu8MxZ81jcbFZJxNrtBJvGkl2CdLEXm3w=; b=oH3sDm86dhhPszJlrsULsTnqfrTblTZeUY6ulXuI6DeskHZBVEptsxH7xqZUipDLK/ tTQ05qYdlkzLeO2EOtQG/chr8MoVzgdY9CqAzW35+hAP4hRduplXiB9bqfFg1O7/o1Ar Y6sZPamwypUyRi8H+TjxgfKh2PFpk7mHeMvlo=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=uPnHTiG+heH6vx5LCHF/T4Jn7ACD5hAA0tSSGUCwIghsRziIhaLuzCDZznV2jpGqJF 4R+Geapj90+fVicm4Bsv1dtzDtWRD9x51khdFB/eH0UJa9OkochS2iPBnvIdoojxKMoy Es5mENbDqMPy1ZlRuk/+5TJi2UxdGHjSJKcOM=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <BANLkTim+5avEnTc_uy2cQY5i63g=JAvNJQ@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1307595829.8990.9.camel@limbo> <1307606121.775.761.camel@xxxxxxxxxxxxxxxxxxxxxx> <1307608287.31235.17.camel@limbo> <1307615031.775.810.camel@xxxxxxxxxxxxxxxxxxxxxx> <19963.37638.19033.472036@xxxxxxxxxxxxxxxxxxxxxxxx> <alpine.DEB.2.00.1106202003430.12963@kaball-desktop> <BANLkTim+5avEnTc_uy2cQY5i63g=JAvNJQ@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Resend for a mistake.

I think 'domid' should be both an input and output parameter,
which allows caller/user to provide a given domid,
if the given domid <= 0, it meas to request the hypervisor
to assign the next free id.

so  "assert(!libxl_domid_valid_guest(*domid));" is necessary, but
should be "assert(libxl_domid_valid_guest(*domid));"
and '*domid = -1;' should be cut out in libxl__domain_make

If any mistake, pls fix me

My patch for this:
---
libxl: fix domid check err.
It should meet the XEN_DOMCTL_createdomain hypercall

Signed-off-by: Zhou Peng <zhoupeng@xxxxxxxxxxxxxxx>

diff -r eca057e4475c tools/libxl/libxl_create.c
--- a/tools/libxl/libxl_create.c        Fri Jun 17 08:08:13 2011 +0100
+++ b/tools/libxl/libxl_create.c        Tue Jun 21 11:02:51 2011 +0800
@@ -295,7 +295,8 @@ int libxl__domain_make(libxl__gc *gc, li
    xs_transaction_t t = 0;
    xen_domain_handle_t handle;

-    assert(!libxl_domid_valid_guest(*domid));
+    if (*domid > 0)
+        assert(libxl_domid_valid_guest(*domid));

    uuid_string = libxl__uuid2string(gc, info->uuid);
    if (!uuid_string) {
@@ -306,7 +307,8 @@ int libxl__domain_make(libxl__gc *gc, li
    flags = info->hvm ? XEN_DOMCTL_CDF_hvm_guest : 0;
    flags |= info->hap ? XEN_DOMCTL_CDF_hap : 0;
    flags |= info->oos ? 0 : XEN_DOMCTL_CDF_oos_off;
-    *domid = -1;
+    if (*domid < 0)
+        *domid = -1;

    /* Ultimately, handle is an array of 16 uint8_t, same as uuid */
    libxl_uuid_copy((libxl_uuid *)handle, &info->uuid);

-- 
Zhou Peng
Operating System Technology Group
Institute of Software, the Chinese Academy of Sciences (ISCAS)

Attachment: libxl-fix-domid-check-err.diff
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>