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 11/11] xl: Migration support

On Thu, 25 Mar 2010, Ian Jackson wrote:
> diff --git a/tools/libxl/xl.c b/tools/libxl/xl.c
> index 7d35db1..53be99c 100644
> --- a/tools/libxl/xl.c
> +++ b/tools/libxl/xl.c
> @@ -17,6 +17,7 @@
>  #include "libxl_osdeps.h"
> 
>  #include <stdio.h>
> +#include <assert.h>
>  #include <stdlib.h>
>  #include <string.h>
>  #include <unistd.h>
> @@ -42,9 +43,33 @@ int logfile = 2;
> 
>  static int suspend_old_xl_format = 0;
> 
> +static struct libxl_ctx common_ctx;
> +static uint32_t common_domid;
> +static const char *common_domname;
> +static uint8_t *common_config_data;
> +static int common_config_len;
> +
> +static char *migration_domname;
> +

I really don't like the usage of global variables to pass parameters
between different functions.

In any case if you want to start using global variables you should do it
consistently across all the file: please write a separate patch that
does this clean up.


>  static const char savefileheader_magic[32]=
>      "Xen saved domain, xl format\n \0 \r";
> 
> +static const char migrate_receiver_banner[]=
> +    "xl migration receiver ready, send binary domain data.\n";
> +static const char migrate_receiver_ready[]=
> +    "domain received, ready to unpause";
> +static const char migrate_permission_to_go[]=
> +    "domain is yours, you are cleared to unpause";
> +static const char migrate_report[]=
> +    "my copy unpause results are as follows";
> +  /* followed by one byte:
> +   *     0: everything went well, domain is running
> +   *            next thing is we all exit
> +   * non-0: things went badly
> +   *            next thing should be a migrate_permission_to_go
> +   *            from target to source
> +   */
> +
>  typedef struct {
>      char magic[32]; /* savefileheader_magic */
>      /* All uint32_ts are in domain's byte order. */
> @@ -69,7 +94,7 @@ void log_callback(void *userdata, int loglevel, const char 
> *file, int line, cons
>      write(logfile, str, strlen(str));
>  }
> 
> -static int domain_qualifier_to_domid(struct libxl_ctx *ctx, char *p, 
> uint32_t *domid)
> +static int domain_qualifier_to_domid(struct libxl_ctx *ctx, char *p, 
> uint32_t *domid, const char **expected_name_r)
>  {
>      int i, alldigit;
> 
> @@ -83,10 +108,12 @@ static int domain_qualifier_to_domid(struct libxl_ctx 
> *ctx, char *p, uint32_t *d
> 
>      if (i > 0 && alldigit) {
>          *domid = strtoul(p, NULL, 10);
> +        if (expected_name_r) *expected_name_r = 0;
>          return 0;
>      } else {
>          /* check here if it's a uuid and do proper conversion */
>      }
> +    if (expected_name_r) *expected_name_r = p;
>      return libxl_name_to_domid(ctx, p, domid);
>  }
> 

can we avoid modifying domain_qualifier_to_domid and use libxl_domid_to_name 
instead?


> @@ -1091,6 +1126,25 @@ static void help(char *command)
>          printf("-O                     Old (configless) xl save format.\n");
>          printf("-p                     Do not unpause domain after restoring 
> it.\n");
>          printf("-e                     Do not wait in the background for the 
> death of the domain.\n");
> +        printf("-d                     Enable debug messages.\n");
> +    } else if(!strcmp(command, "migrate")) {
> +        printf("Usage: xl migrate [options] <Domain> <host>\n\n");
> +        printf("Save a domain state to restore later.\n\n");
> +        printf("Options:\n\n");
> +        printf("-h                     Print this help.\n");
> +        printf("-C <config>            Send <config> instead of config file 
> from creation.\n");
> +        printf("-s <sshcommand>        Use <sshcommand> instead of ssh.  
> String will be passed to sh.  If empty, run <host> instead of ssh <host> xl 
> migrate-receive [-d -e]\n");
> +        printf("-e                     Do not wait in the background (on 
> <host>) for the death of the domain.\n");
> +    } else if(!strcmp(command, "migrate-receive")) {
> +        printf("Usage: xl migrate-receive  - for internal use only");
> +    } else if(!strcmp(command, "restore")) {
> +        printf("Usage: xl restore [options] [<ConfigFile>] 
> <CheckpointFile>\n\n");
> +        printf("Restore a domain from a saved state.\n\n");
> +        printf("Options:\n\n");
> +        printf("-h                     Print this help.\n");
> +        printf("-O                     Old (configless) xl save format.\n");
> +        printf("-p                     Do not unpause domain after restoring 
> it.\n");
> +        printf("-e                     Do not wait in the background for the 
> death of the domain.\n");
>      } else if(!strcmp(command, "destroy")) {
>          printf("Usage: xl destroy <Domain>\n\n");
>          printf("Terminate a domain immediately.\n\n");

just remove the old "configless" save format



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

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [Xen-devel] [PATCH 11/11] xl: Migration support, Stefano Stabellini <=