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] [PATCH 14/14] xl: xl block-attach -N (dry run) option

To: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 14/14] xl: xl block-attach -N (dry run) option
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Fri, 13 May 2011 13:56:50 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 13 May 2011 06:01:47 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1305211004-31687-15-git-send-email-ian.jackson@xxxxxxxxxxxxx>
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>
Organization: Citrix Systems, Inc.
References: <1305211004-31687-1-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-2-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-3-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-4-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-5-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-6-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-7-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-8-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-9-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-10-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-11-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-12-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-13-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-14-git-send-email-ian.jackson@xxxxxxxxxxxxx> <1305211004-31687-15-git-send-email-ian.jackson@xxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Thu, 2011-05-12 at 15:36 +0100, Ian Jackson wrote:
> This is mainly for debugging purposes at the moment.  Eventually I
> hope all commands will gain this so that -N will be a global option.

A few existing commands take a -n with the same meaning (create,
cpucpoolcreate). A bunch of others use -n for something else.

I'm unsure what to suggest we do about that. Using -N, with -n as an
alias where it already exists, seems sensible enough I suppose.

> In the meantime this new option is not documented and should be
> regarded as unstable.
> 
> Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>

Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

> ---
>  tools/libxl/xl_cmdimpl.c |   34 +++++++++++++++++++++++++++++++---
>  1 files changed, 31 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index ccffd26..a8b3f9f 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -3930,13 +3930,25 @@ int main_networkdetach(int argc, char **argv)
>  
>  int main_blockattach(int argc, char **argv)
>  {
> -    int opt;
> +    int opt, dry_run = 0;
>      uint32_t fe_domid, be_domid = 0;
>      libxl_device_disk disk = { 0 };
>      XLU_Config *config = 0;
>  
> -    if ((opt = def_getopt(argc, argv, "", "block-attach", 2)) != -1)
> -        return opt;
> +    while ((opt = getopt(argc, argv, "Nh")) != -1) {

You've undone part of 23299:39f2942fe56b here.

> +        switch (opt) {
> +        case 'N':
> +            /* fixme this should become a global option eventually */
> +            dry_run = 1;
> +            break;
> +        case 'h':
> +            help("block-attach");
> +            return 0;
> +        default:
> +            fprintf(stderr, "option `%c' not supported.\n", optopt);
> +            break;
> +        }
> +    }
>      if ((argc-optind < 2)) {
>          help("block-attach");
>          return 2;
> @@ -3953,6 +3965,22 @@ int main_blockattach(int argc, char **argv)
>  
>      disk.backend_domid = be_domid;
>  
> +    if (dry_run) {
> +        /* fixme: this should be generated from the idl */
> +        /* fixme: enums (backend, format) should be converted to strings */

Yes, that'd be good.

> +        printf("disk.backend_domid = %"PRIx32"\n", disk.backend_domid);
> +        printf("disk.pdev_path =     %s\n",        disk.pdev_path);
> +        printf("disk.vdev =          %s\n",        disk.vdev);
> +        printf("disk.backend =       %d\n",        disk.backend);
> +        printf("disk.format =        %d\n",        disk.format);
> +        printf("disk.script =        %s\n",        disk.script);
> +        printf("disk.removable =     %d\n",        disk.removable);
> +        printf("disk.readwrite =     %d\n",        disk.readwrite);
> +        printf("disk.is_cdrom =      %d\n",        disk.is_cdrom);
> +        if (ferror(stdout) || fflush(stdout)) { perror("stdout"); exit(-1); }
> +        return 0;
> +    }
> +
>      if (libxl_device_disk_add(ctx, fe_domid, &disk)) {
>          fprintf(stderr, "libxl_device_disk_add failed.\n");
>      }



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

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