[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-users] xl network-attach and hotplug scripts



El 30/09/14 a les 12.33, Ian Campbell ha escrit:
> On Fri, 2014-09-26 at 13:09 +0200, Jorge CalÃs Lozano wrote:
>> Hello,
>>
>> We have configured xen 4.4.1 to use a custom hotplug script for network
>> interfaces:
>>
>> On /etc/xen/xl.conf:
>>
>>         vif.default.script="vif-custom"
>>
>> It works fine when creating a vm, when rebooting the vm, etc.
>>
>> But when I run 'xl network-attach' command it does not seems to load
>> default settings: bridge interface and script default values are ignored
>> and should be manually specified.
>>
>> Is this a known bug? A desired behaviour? Is there any workaround for
>> this issue?
> 
> It certainly sounds like a bug. If you report it to xen-devel please
> include the output of "xl -vvv network-attach". See
> http://wiki.xen.org/wiki/Reporting_Bugs_against_Xen for more info.
> 
> Only workaround would be to manually specify them as you have
> discovered.

Hello,

I have the following patch which I think solves your problem, could you 
please test it?

Roger.
---
commit d88005524423617acbc37afb3448f5f625adc81d
Author: Roger Pau Monne <roger.pau@xxxxxxxxxx>
Date:   Tue Sep 30 15:58:47 2014 +0200

    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.
    
    Signed-off-by: Roger Pau Monnà <roger.pau@xxxxxxxxxx>

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-users mailing list
Xen-users@xxxxxxxxxxxxx
http://lists.xen.org/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.