X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=xenserver%2Fopt_xensource_libexec_interface-reconfigure;h=3b5c8617aec89a072a75fde24db121f1ffb7c3c0;hb=1d5aaa61fa8ca68f487e8b578b7aa99a0bbd1f26;hp=7d30f97eda62831b80b875c4e6343c80c5601bcb;hpb=823c5699d4de7bf726f988e1ca6197fb2400f388;p=sliver-openvswitch.git diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure index 7d30f97ed..3b5c8617a 100755 --- a/xenserver/opt_xensource_libexec_interface-reconfigure +++ b/xenserver/opt_xensource_libexec_interface-reconfigure @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/env python # # Copyright (c) 2008,2009 Citrix Systems, Inc. # @@ -50,6 +50,7 @@ import syslog import traceback import re import random +import syslog management_pif = None @@ -144,10 +145,11 @@ def netdev_remap_name(pif, already_renamed=[]): return None def rename_netdev(old_name, new_name): - log("Changing the name of %s to %s" % (old_name, new_name)) - run_command(['/sbin/ifconfig', old_name, 'down']) - if not run_command(['/sbin/ip', 'link', 'set', old_name, 'name', new_name]): - raise Error("Could not rename %s to %s" % (old_name, new_name)) + raise Error("Trying to rename %s to %s - This functionality has been removed" % (old_name, new_name)) + # log("Changing the name of %s to %s" % (old_name, new_name)) + # run_command(['/sbin/ifconfig', old_name, 'down']) + # if not run_command(['/sbin/ip', 'link', 'set', old_name, 'name', new_name]): + # raise Error("Could not rename %s to %s" % (old_name, new_name)) pifrec = db().get_pif_record(pif) device = pifrec['device'] @@ -197,13 +199,19 @@ def ifup(netdev): """Bring up a network interface""" if not os.path.exists(root_prefix() + "/etc/sysconfig/network-scripts/ifcfg-%s" % netdev): raise Error("ifup: device %s exists but ifcfg-%s does not" % (netdev,netdev)) + d = os.getenv("DHCLIENTARGS","") + if os.path.exists("/etc/firstboot.d/data/firstboot_in_progress"): + os.putenv("DHCLIENTARGS", d + " -T 240 " ) run_command(["/sbin/ifup", netdev]) + os.putenv("DHCLIENTARGS", d ) # # # def pif_rename_physical_devices(pif): + if pif_is_tunnel(pif): + return if pif_is_vlan(pif): pif = pif_get_vlan_slave(pif) @@ -234,7 +242,7 @@ def ipdev_configure_static_routes(interface, oc, f): 172.18.0.0/16 via 192.168.0.4 dev xenbr1 """ if oc.has_key('static-routes'): - # The key is present - extract comma seperates entries + # The key is present - extract comma separates entries lines = oc['static-routes'].split(',') else: # The key is not present, i.e. there are no static routes @@ -267,6 +275,7 @@ def ipdev_open_ifcfg(pif): f.write("XEMANAGED=yes\n") f.write("DEVICE=%s\n" % ipdev) f.write("ONBOOT=no\n") + f.write("NOZEROCONF=yes\n") return f @@ -354,6 +363,10 @@ def ipdev_configure_network(pif, dp): pifs_on_host = [p for p in db().get_all_pifs() if not p in pif_get_bond_masters(pif)] + # now prune out bond slaves as they are not connected to the IP + # stack and so cannot be used as gateway or DNS devices. + pifs_on_host = [ p for p in pifs_on_host if len(pif_get_bond_masters(p)) == 0] + # loop through all the pifs on this host looking for one with # other-config:peerdns = true, and one with # other-config:default-route=true @@ -525,6 +538,8 @@ def action_force_rewrite(bridge, config): f.write('\t\t\n') f.write('\t\tOpaqueRef:NULL\n') f.write('\t\t-1\n') + f.write('\t\t\n') + f.write('\t\t\n') f.write('\t\t%s\n' % interface) f.write('\t\t%s\n' % mac) f.write('\t\t\n')