[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl/xl: enable support for routed network configurations.
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1298043122 0 # Node ID d210f43decdf4ced25159b4d071493cc73030a7d # Parent fb83c89d80cbddb4b678047e639a7624d74e3a80 libxl/xl: enable support for routed network configurations. Add "vifscript" option to xl.conf which configures the default vif script to use (default remains "vif-bridge") Write each VIFs "ip" option to xenstore so the vif-route script can pick it up. Reported-by: W. Michael Petullo <mike@xxxxxxxx>. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Committed-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- diff -r fb83c89d80cb -r d210f43decdf tools/examples/xl.conf --- a/tools/examples/xl.conf Fri Feb 18 15:04:19 2011 +0000 +++ b/tools/examples/xl.conf Fri Feb 18 15:32:02 2011 +0000 @@ -6,3 +6,6 @@ # full path of the lockfile used by xl during domain creation #lockfile="/var/lock/xl" + +# default vif script +#vifscript="vif-bridge" diff -r fb83c89d80cb -r d210f43decdf tools/libxl/libxl.c --- a/tools/libxl/libxl.c Fri Feb 18 15:04:19 2011 +0000 +++ b/tools/libxl/libxl.c Fri Feb 18 15:32:02 2011 +0000 @@ -31,6 +31,8 @@ #include <inttypes.h> #include <assert.h> +#include <arpa/inet.h> + #include "libxl.h" #include "libxl_utils.h" #include "libxl_internal.h" @@ -1173,6 +1175,7 @@ nic_info->mac[5] = r[2]; nic_info->ifname = NULL; nic_info->bridge = strdup("xenbr0"); + nic_info->ip.s_addr = 0UL; if ( asprintf(&nic_info->script, "%s/vif-bridge", libxl_xen_script_dir_path()) < 0 ) return ERROR_FAIL; @@ -1232,6 +1235,16 @@ flexarray_append(back, libxl__sprintf(&gc, "%02x:%02x:%02x:%02x:%02x:%02x", nic->mac[0], nic->mac[1], nic->mac[2], nic->mac[3], nic->mac[4], nic->mac[5])); + if (nic->ip.s_addr != 0UL) { + char dst[INET_ADDRSTRLEN]; + const char *addr = inet_ntop(AF_INET, &nic->ip.s_addr, &dst[0], INET_ADDRSTRLEN); + if (addr) { + flexarray_append(back, "ip"); + flexarray_append(back, libxl__strdup(&gc, addr)); + } else { + LIBXL__LOG(ctx, LIBXL__LOG_WARNING, "Unable to format IP address"); + } + } flexarray_append(back, "bridge"); flexarray_append(back, libxl__strdup(&gc, nic->bridge)); flexarray_append(back, "handle"); diff -r fb83c89d80cb -r d210f43decdf tools/libxl/xl.c --- a/tools/libxl/xl.c Fri Feb 18 15:04:19 2011 +0000 +++ b/tools/libxl/xl.c Fri Feb 18 15:32:02 2011 +0000 @@ -35,6 +35,7 @@ xentoollog_logger_stdiostream *logger; int autoballoon = 1; char *lockfile; +char *default_vifscript = NULL; static xentoollog_level minmsglevel = XTL_PROGRESS; @@ -72,6 +73,9 @@ } } + if (!xlu_cfg_get_string (config, "vifscript", &buf)) + default_vifscript = strdup(buf); + xlu_cfg_destroy(config); } diff -r fb83c89d80cb -r d210f43decdf tools/libxl/xl.h --- a/tools/libxl/xl.h Fri Feb 18 15:04:19 2011 +0000 +++ b/tools/libxl/xl.h Fri Feb 18 15:32:02 2011 +0000 @@ -101,5 +101,6 @@ /* global options */ extern int autoballoon; extern char *lockfile; +extern char *default_vifscript; #endif /* XL_H */ diff -r fb83c89d80cb -r d210f43decdf tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Fri Feb 18 15:04:19 2011 +0000 +++ b/tools/libxl/xl_cmdimpl.c Fri Feb 18 15:32:02 2011 +0000 @@ -798,6 +798,11 @@ nic = d_config->vifs + d_config->num_vifs; CHK_ERRNO( libxl_device_nic_init(nic, d_config->num_vifs) ); + if (default_vifscript) { + free(nic->script); + nic->script = strdup(default_vifscript); + } + p = strtok(buf2, ","); if (!p) goto skip; _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |