From: Ian Campbell <Ian.Campbell@citrix.com>
To: Roger Pau Monne <roger.pau@citrix.com>
Cc: xen-devel@lists.xenproject.org,
Ian Jackson <ian.jackson@eu.citrix.com>,
Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH for-xen-4.5] xl: use nic global default values in network-attach
Date: Wed, 1 Oct 2014 11:46:45 +0100 [thread overview]
Message-ID: <1412160405.4861.16.camel@citrix.com> (raw)
In-Reply-To: <1412160127-28088-1-git-send-email-roger.pau@citrix.com>
On Wed, 2014-10-01 at 12:42 +0200, Roger Pau Monne wrote:
> Introduce a new static function that will be used to set the initial nic
> config based on the global defaults. This fixes a bug caused by
> network-attach not using the default values set in xl.conf(5).
>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
I'm sure there is more unification which can be done for these things
but this is a step in the right direction, thanks!
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
> tools/libxl/xl_cmdimpl.c | 47 +++++++++++++++++++++++++++--------------------
> 1 file changed, 27 insertions(+), 20 deletions(-)
>
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index d205f96..94fb535 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -506,6 +506,30 @@ static void parse_vif_rate(XLU_Config **config, const char *rate,
> }
> }
>
> +static void set_default_nic_values(libxl_device_nic *nic)
> +{
> +
> + if (default_vifscript) {
> + free(nic->script);
> + nic->script = strdup(default_vifscript);
> + }
> +
> + if (default_bridge) {
> + free(nic->bridge);
> + nic->bridge = strdup(default_bridge);
> + }
> +
> + if (default_gatewaydev) {
> + free(nic->gatewaydev);
> + nic->gatewaydev = strdup(default_gatewaydev);
> + }
> +
> + if (default_vifbackend) {
> + free(nic->backend_domname);
> + nic->backend_domname = strdup(default_vifbackend);
> + }
> +}
> +
> static void split_string_into_string_list(const char *str,
> const char *delim,
> libxl_string_list *psl)
> @@ -1354,26 +1378,7 @@ static void parse_config_data(const char *config_source,
> nic = d_config->nics + d_config->num_nics;
> libxl_device_nic_init(nic);
> nic->devid = d_config->num_nics;
> -
> - if (default_vifscript) {
> - free(nic->script);
> - nic->script = strdup(default_vifscript);
> - }
> -
> - if (default_bridge) {
> - free(nic->bridge);
> - nic->bridge = strdup(default_bridge);
> - }
> -
> - if (default_gatewaydev) {
> - free(nic->gatewaydev);
> - nic->gatewaydev = strdup(default_gatewaydev);
> - }
> -
> - if (default_vifbackend) {
> - free(nic->backend_domname);
> - nic->backend_domname = strdup(default_vifbackend);
> - }
> + set_default_nic_values(nic);
>
> p = strtok(buf2, ",");
> if (!p)
> @@ -6005,6 +6010,8 @@ int main_networkattach(int argc, char **argv)
> }
>
> libxl_device_nic_init(&nic);
> + set_default_nic_values(&nic);
> +
> for (argv += optind+1, argc -= optind+1; argc > 0; ++argv, --argc) {
> if (MATCH_OPTION("type", *argv, oparg)) {
> if (!strcmp("vif", oparg)) {
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2014-10-01 10:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-01 10:42 [PATCH for-xen-4.5] xl: use nic global default values in network-attach Roger Pau Monne
2014-10-01 10:46 ` Ian Campbell [this message]
2014-10-01 12:17 ` Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1412160405.4861.16.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=roger.pau@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.