From: Ben Pfaff Date: Tue, 19 May 2009 16:45:41 +0000 (-0700) Subject: Revert "xenserver: Make primary management interface on VLAN possible." X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42b1abcb454bb4aff50131b31f05e4432c664bf5;p=openvswitch Revert "xenserver: Make primary management interface on VLAN possible." This reverts commit d71cb7eb3e52fbf521abe6d0cb19cc8b7aea80dc. The strategy used in that commit for making the primary management interface on a VLAN possible did not work reliably. Sometimes it would work for a time, but eventually xapi would start listening only on the IP address attached to the fake VLAN bridge. Since this is not a real IP address that can be used to talk to the outside world (and in any case it isn't the IP address requested by the administrator) xapi would become unreachable at this point. --- diff --git a/xenserver/opt_xensource_libexec_interface-reconfigure b/xenserver/opt_xensource_libexec_interface-reconfigure index cf8a8083..46ff2b88 100755 --- a/xenserver/opt_xensource_libexec_interface-reconfigure +++ b/xenserver/opt_xensource_libexec_interface-reconfigure @@ -429,36 +429,6 @@ For a VLAN PIF, the ipdev name is the interface name. else: return interface_name(pif) -def fakevlanbridge_name(pif): - """Return the name of the network device that xapi *thinks* carries the -IP configuration associatied with pif, if this is different from the actual -network device for pif (as returned by ipdev_name). -Otherwise, returns None. - -This is important because xapi will refuse to put the primary management -interface on a network device that does not have an IP address. For ordinary -network devices and bonds, this is no problem for us, since the device we -want to use for the IP address is the same as what xapi expects. But for -VLANs, xapi expects us to put the IP address on the xapi# device, which is -a bridge device (datapath local port device, actually), but we can't do that -because it would have to be added to the xenbr# or xapi# bridge that -represents the vlan slave, and a bridge port device can only be a member of -a single bridge. - -So, in the latter case, we have to fake out xapi somehow. We choose to do -so by configuring a dummy 127.x.y.z address on the xapi# device that xapi -expects. xapi only cares that the interface has an address, not that the -address is correct, so this is sufficient. -""" - - pifrec = db.get_pif_record(pif) - - if pifrec['VLAN'] == '-1': - return None - else: - return bridge_name(pif) - - def physdev_names(pif): """Return the name(s) of the physical network device(s) associated with pif. For a VLAN PIF, the physical devices are the VLAN slave's physical devices. @@ -795,10 +765,6 @@ def configure_bond(pif): argv += ["--add=bonding.%s.%s=%s" % (interface, name, val)] return argv -def get_ifindex(netdev): - """Return the ifindex of the given 'netdev'.""" - return int(open("/sys/class/net/%s/ifindex" % netdev).readline()) - def action_up(pif): pifrec = db.get_pif_record(pif) @@ -806,7 +772,6 @@ def action_up(pif): ipdev = ipdev_name(pif) datapath = datapath_name(pif) physdevs = physdev_names(pif) - fakevlanbridge = fakevlanbridge_name(pif) vlan_slave = None if pifrec['VLAN'] != '-1': vlan_slave = get_vlan_slave_of_pif(pif) @@ -819,8 +784,6 @@ def action_up(pif): # "ifconfig down" the network device and delete its IP address, etc. down_netdev(ipdev) - if vlan_slave: - down_netdev(fakevlanbridge) for physdev in physdevs: down_netdev(physdev) @@ -872,17 +835,6 @@ def action_up(pif): # Bring up VLAN slave and bond slaves. if vlan_slave: up_netdev(ipdev_name(vlan_slave)) - - # Set up an IP address on the fake VLAN bridge. See the - # comments on fakevlanbridge_name for details. - up_netdev(fakevlanbridge) - fakevlan_ifindex = get_ifindex(fakevlanbridge) - fakevlan_ifindex_octets = ((fakevlan_ifindex >> 16) & 0xff, - (fakevlan_ifindex >> 8) & 0xff, - fakevlan_ifindex & 0xff) - run_command(['/sbin/ifconfig', fakevlanbridge, - '127.%d.%d.%d' % fakevlan_ifindex_octets, - 'netmask', '255.255.255.255']) for physdev in physdevs: up_netdev(physdev) @@ -894,13 +846,11 @@ def action_down(pif): interface = interface_name(pif) bridge = bridge_name(pif) ipdev = ipdev_name(pif) - fakevlanbridge = fakevlanbridge_name(pif) argv = [] if rec['VLAN'] != '-1': # Get rid of the VLAN device itself. down_netdev(ipdev) - down_netdev(fakevlanbridge) argv += interface_deconfigure_commands(ipdev) # If the VLAN's slave is attached, stop here.