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 1/3] libxl: add 2 consoles to stubdoms for save/r

To: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 1/3] libxl: add 2 consoles to stubdoms for save/restore
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Wed, 19 Jan 2011 11:12:00 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 19 Jan 2011 03:12:38 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <alpine.DEB.2.00.1101181037400.7277@kaball-desktop>
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: <alpine.DEB.2.00.1101181037400.7277@kaball-desktop>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, 2011-01-18 at 17:17 +0000, Stefano Stabellini wrote:
> Add two "special" PV consoles to stubdoms that are going to be used
> to send and receive the qemu-xen save files on save/restore.
> 
> Rename the save file on resume so that it doesn't collide with the name
> of the next save file.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
> 
> 
> diff -r 59396addc940 tools/libxl/libxl.c
> --- a/tools/libxl/libxl.c     Fri Jan 14 14:26:11 2011 +0000
> +++ b/tools/libxl/libxl.c     Tue Jan 18 17:09:56 2011 +0000
> @@ -750,7 +750,7 @@ int libxl_primary_console_exec(libxl_ctx
>  {
>      uint32_t stubdomid = libxl_get_stubdom_id(ctx, domid_vm);
>      if (stubdomid)
> -        return libxl_console_exec(ctx, stubdomid, 1, LIBXL_CONSTYPE_PV);
> +        return libxl_console_exec(ctx, stubdomid, 3, LIBXL_CONSTYPE_PV);

#define STUBDOM_CONSOLE_xxx or an enum to give a symbolic name to each
of the 3-4 console numbers.

>      else {
>          if (libxl__domain_is_hvm(ctx, domid_vm))
>              return libxl_console_exec(ctx, domid_vm, 0, 
> LIBXL_CONSTYPE_SERIAL);
> diff -r 59396addc940 tools/libxl/libxl_create.c
> --- a/tools/libxl/libxl_create.c      Fri Jan 14 14:26:11 2011 +0000
> +++ b/tools/libxl/libxl_create.c      Tue Jan 18 17:09:56 2011 +0000
> @@ -250,8 +250,12 @@ static int domain_restore(libxl_ctx *ctx
>  
>      dm_info->saved_state = NULL;
>      if (info->hvm) {
> +        char buf[100];
> +        snprintf(buf, sizeof(buf), "/var/lib/xen/qemu-save.%d", domid);
>          ret = asprintf(&dm_info->saved_state,
> -                       "/var/lib/xen/qemu-save.%d", domid);
> +                       "/var/lib/xen/qemu-restore.%d", domid);

These two strings end up in a couple of places, probably worth either a
#define or libxl__domain_dm_{save,restore}_path(...).

char buf[100] is pretty ugly too. Either use the relevant libxl_Xprintf
or a number much smaller than 100 since domid is bounded -- i.e.
strlen("/var/lib/xen/qemu-save.") + strlen("65536") (+ 1?). 32 seems to
be more than sufficient.

[...]
> +            case 1:
> +                console[i].output = libxl__sprintf(&gc, 
> "file:/var/lib/xen/qemu-save.%d", info->domid);
> +                break;
> +            case 2:
> +                if (info->saved_state)
> +                    console[i].output = libxl__sprintf(&gc, "filerw:%s", 
> info->saved_state);

These "file:" and "filerw:" prefixed things are interpreted by qemu
within the stub domain? Since you need to introduce filerw why not
instead introduce something like pvconsole:{0,1,2,3} (or /dev/consoleN
etc)?

Ian.


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