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/
Home Products Support Community News


[Xen-devel] Re: [PATCH]: xl: catch invalid numeric domain ID

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH]: xl: catch invalid numeric domain ID
From: Andre Przywara <andre.przywara@xxxxxxx>
Date: Mon, 24 Jan 2011 23:12:21 +0100
Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Mon, 24 Jan 2011 14:12:40 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <19769.55433.742234.824540@xxxxxxxxxxxxxxxxxxxxxxxx>
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: <4D39B142.90806@xxxxxxx> <19769.55433.742234.824540@xxxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20101020 Thunderbird/3.0.9
On 01/21/2011 08:03 PM, Ian Jackson wrote:
Andre Przywara writes ("[PATCH]: xl: catch invalid numeric domain ID"):
if you run any domain specific xl command with an invalid (aka
non-existing) numeric domain ID, the command does not abort, but
proceeds with some bogus number:

Thanks, but I'm not 100% convinced that it is impossible to ever get
into a situation where a domain exists but has no name.  In that case,
this patch of yours would leave an undestroyable domain.

I think the right answer is to use libxl_domain_info to check whether
the domain exists.  It returns ERROR_INVAL, without logging anything,
if the domain does not exist.  On other failures xl destroy should
probably carry on and attempt to destroy the domain.
OK, I looked around the bit, libxl_domain_info really seems to be the easiest solution. So please consider the attached patch. I am not 100% happy with it, actually I think find_domain should return an error value. In this case we could abort the commands gracefully (like xl list does) and avoid the rather impolite exit(2). On the other hand I am not sure if fixing the 30 or so callers of find_domain() is appropriate in this state of development. Please tell me if you prefer this more elaborated version and I will send a patch.


Andre Przywara
AMD-Operating System Research Center (OSRC), Dresden, Germany

Attachment: xl_fix_bad_numeric_id_v2.path
Description: xl_fix_bad_numeric_id_v2.path

Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>