xl: use nic global default values in network-attach
PATCH 1/1 xl: use nic global default values in network-attach
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).
--- tools/libxl/xl_cmdimpl.c | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-)
tools/libxl/xl_cmdimpl.c +27 -20
@@ -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)) {
Signature · 7 lines
1.9.3 (Apple Git-50) _______________________________________________ Xen-devel mailing list [email protected] http://lists.xen.org/xen-devel
Quoted 6 lines · Roger Pau Monne
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é <[email protected]>Cc Ian Jackson <[email protected]>
I'm sure there is more unification which can be done for these things but this is a step in the right direction, thanks!
Quoted 69 lines
Cc Wei Liu <[email protected]>--- tools/libxl/xl_cmdimpl.c | 47 +++++++++++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 20 deletions(-)tools/libxl/xl_cmdimpl.c +25
-20@@ -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)
tools/libxl/xl_cmdimpl.c int main_networkattach(int argc, char **argv) · line 6017
Quoted 8 lines
tools/libxl/xl_cmdimpl.c +2
-0@@ -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
[email protected]
http://lists.xen.org/xen-devel
Quoted 5 lines · Ian Campbell
Quoted 4 lines · Roger Pau Monne
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).
Quoted 7 lines
Quoted 2 lines
Signed-off-by Roger Pau Monné <[email protected]>Cc Ian Jackson <[email protected]>Acked-by Ian Campbell <[email protected]>I'm sure there is more unification which can be done for these things but this is a step in the right direction, thanks!
Now applied.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel