[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] After switching from "xm" to "xl" toolstack, can't get Guest networking to work.
On Sat, 2012-01-21 at 20:06 +0000, erin.balid@xxxxxxxxxxxx wrote: > The Guest cfg file I'm using for testing is: > > cat test.cfg > name='test' > builder='linux' > bootloader='/usr/bin/pygrub' > disk=['phy:/dev/XenVols/test,xvda,w'] > vif=[mac=00:16:3e:12:34:01, bridge=br0 , vifname=vifBR'] ISTRT xl had a bug at one point where it would fail to strip whitespace in the network KVP lists. i.e. the above ended up expecting to find a bridge named "br0 ". Can you try without the spaces please? (hmm, I wonder if that was ever fixed. I appear to have the following tucked away in my queue. I suspect I got sidetracked with never getting round to fixing it properly instead of pushing the bandaid) 8<-------------------------------------------------- xl: strip whitespace from vif key/values when parsing Otherwise we can end up with bridge = "br0 " etc which is usually not what is desired. This whole parser could do with a rewrite (perhaps a generic KVP parser in flex would be useful) but this quick fix appears to suffice for now. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> diff -r 3c6eaf62996d -r 31eee4e06a20 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Nov 10 07:56:40 2011 +0000 +++ b/tools/libxl/xl_cmdimpl.c Thu Nov 10 08:04:16 2011 +0000 @@ -515,6 +515,20 @@ static void parse_disk_config(XLU_Config parse_disk_config_multistring(config, 1, &spec, disk); } +/* + * Duplicate s stripping leading and trailing whitespace. + * Destroys contents of s. + */ +static char *strdup_ws(char *s) +{ + char *e = s + strlen(s) - 1; + while (*s == ' ') + s++; + while (*e == ' ') + *(e--) = '\0'; + return strndup(s, e-s+1); +} + static void parse_config_data(const char *configfile_filename_report, const char *configfile_data, int configfile_len, @@ -758,7 +772,7 @@ static void parse_config_data(const char while ((buf = xlu_cfg_get_listitem (nics, d_config->num_vifs)) != NULL) { libxl_device_nic *nic; char *buf2 = strdup(buf); - char *p, *p2; + char *p, *p2, *p3; d_config->vifs = (libxl_device_nic *) realloc(d_config->vifs, sizeof (libxl_device_nic) * (d_config->num_vifs+1)); nic = d_config->vifs + d_config->num_vifs; @@ -779,6 +793,9 @@ static void parse_config_data(const char if ((p2 = strchr(p, '=')) == NULL) break; *p2 = '\0'; + p3 = p2 - 1; + while (*p3 == ' ' && p3 > p) + *(p3--) = '\0'; if (!strcmp(p, "model")) { free(nic->model); nic->model = strdup(p2 + 1); @@ -802,8 +820,8 @@ static void parse_config_data(const char *(p3 + 2) = '\0'; nic->mac[5] = strtol(p3, NULL, 16); } else if (!strcmp(p, "bridge")) { free(nic->bridge); - nic->bridge = strdup(p2 + 1); + nic->bridge = strdup_ws(p2 + 1); } else if (!strcmp(p, "type")) { if (!strcmp(p2 + 1, "ioemu")) nic->nictype = LIBXL_NIC_TYPE_IOEMU; _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |