debuggers.hg

changeset 21996:36c9f6ea9782

xl: support backend domid in config file for vifs

Allow specification of backend domains for vifs, either in the config
file or via network-attach.

Signed-off-by: Mihir Nanavati <mihirn@cs.ubc.ca>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
author Stefano Stabellini <sstabellini@xensource.com>
date Mon Aug 09 17:44:01 2010 +0100 (2010-08-09)
parents 1d67dd785ef4
children 1644b4efef8a
files tools/libxl/xl_cmdimpl.c
line diff
     1.1 --- a/tools/libxl/xl_cmdimpl.c	Mon Aug 09 17:43:18 2010 +0100
     1.2 +++ b/tools/libxl/xl_cmdimpl.c	Mon Aug 09 17:44:01 2010 +0100
     1.3 @@ -833,6 +833,11 @@ static void parse_config_data(const char
     1.4                      nic->script = strdup(p2 + 1);
     1.5                  } else if (!strcmp(p, "vifname")) {
     1.6                      nic->ifname = strdup(p2 + 1);
     1.7 +                } else if (!strcmp(p, "backend")) {
     1.8 +                    if(libxl_name_to_domid(&ctx, (p2 + 1), &(nic->backend_domid))) {
     1.9 +                        fprintf(stderr, "Specified backend domain does not exist, defaulting to Dom0\n");
    1.10 +                        nic->backend_domid = 0;
    1.11 +                    }
    1.12                  } else if (!strcmp(p, "rate")) {
    1.13                      fprintf(stderr, "the rate parameter for vifs is currently not supported\n");
    1.14                  } else if (!strcmp(p, "accel")) {
    1.15 @@ -4012,10 +4017,9 @@ int main_networkattach(int argc, char **
    1.16          } else if (!strncmp("script=", *argv, 6)) {
    1.17              nic.script = (*argv) + 6;
    1.18          } else if (!strncmp("backend=", *argv, 8)) {
    1.19 -            val = strtoul((*argv) + 8, &endptr, 10);
    1.20 -            if (((*argv) + 8) == endptr) {
    1.21 -                fprintf(stderr, "Invalid parameter `backend'.\n");
    1.22 -                return 1;
    1.23 +            if(libxl_name_to_domid(&ctx, ((*argv) + 8), &val)) {
    1.24 +                fprintf(stderr, "Specified backend domain does not exist, defaulting to Dom0\n");
    1.25 +                val = 0;
    1.26              }
    1.27              nic.backend_domid = val;
    1.28          } else if (!strncmp("vifname=", *argv, 8)) {