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

[Xen-devel] Re: [PATCH, v2]: xl: Check domain existance when doing domai

On Mon, 24 Jan 2011, Gianni Tedesco wrote:
> It occurs to me that the last patch won't fix it for anything but
> destroy. We should bail with a nice error for any command looking up a
> domain that doesn't exist and be consistent with name vs. numeric ID.
> 
> --
> xl: Check domain existance when doing domain identifier lookups
> 
> Also fix a mis-formatted error message in xl destroy command.
> 
> Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
> 
> diff -r b59f04eb8978 tools/libxl/xl_cmdimpl.c
> --- a/tools/libxl/xl_cmdimpl.c        Fri Jan 21 18:06:23 2011 +0000
> +++ b/tools/libxl/xl_cmdimpl.c        Mon Jan 24 17:58:20 2011 +0000
> @@ -143,11 +143,24 @@ static int qualifier_to_id(const char *p
>  static int domain_qualifier_to_domid(const char *p, uint32_t *domid_r,
>                                       int *was_name_r)
>  {
> -    int was_name;
> +    libxl_dominfo dominfo;
> +    int was_name, rc;
>  
>      was_name = qualifier_to_id(p, domid_r);
> -    if (was_name_r) *was_name_r = was_name;
> -    return was_name ? libxl_name_to_domid(&ctx, p, domid_r) : 0;
> +    if (was_name_r)
> +        *was_name_r = was_name;
> +
> +    if ( was_name ) {
> +        rc = libxl_name_to_domid(&ctx, p, domid_r);
> +        if ( rc )
> +            return rc;
> +    }
> +
> +    rc = libxl_domain_info(&ctx, &dominfo, *domid_r);
> +    if ( rc )
> +        return rc;
> +
> +    return 0;

is this really needed?
libxl_name_to_domid should have returned error already if the domain doesn't 
exist.


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>