[ovs-git] Open vSwitch: xenserver: Rename network devices to match MAC addresses of physical PIFs. (citrix)

nicira-dev at nicira.com nicira-dev at nicira.com
Fri Aug 7 00:06:53 UTC 2009


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Open vSwitch".

The branch, citrix has been updated
       via  2bb451b698fa45c4c616ba721bd8fc6d07064bb7 (commit)
       via  449776d81d7b03d9b5f552b402c8a619323e8aa2 (commit)
       via  ba09980aaff81d5ba31aa221179740bc04680787 (commit)
       via  c874dc6d6b892a7697c0c83a070a5b0a564be55f (commit)
       via  0515ceb3e82ecc6160a141017c20ca26ec1a7a5f (commit)
       via  58c342f617051e9e2ffb09710b4ef2b22c34e79a (commit)
       via  3de35df914e39692470a5d4546cb1fae2d93a316 (commit)
       via  2ba9026e2fc114fa50ae923312340e9f08a1f513 (commit)
       via  2e7dd8eca88d131112a76301da24709b0472e381 (commit)
       via  3cc42ebbc144096dc56b618845519daf2d48ef6e (commit)
       via  5e93df1c46954b9a2c60c8e11bbf8ea25a1686ce (commit)
      from  8cc013b20f730d394b89748b4b5fae27821ed908 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 2bb451b698fa45c4c616ba721bd8fc6d07064bb7
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=2bb451b698fa45c4c616ba721bd8fc6d07064bb7
Author: Ben Pfaff <blp at nicira.com>
		
xenserver: Rename network devices to match MAC addresses of physical PIFs.
		
XenServer does not rely on Linux to keep the naming of network devices
stable from one boot to the next.  Instead, it requires
interface-reconfigure to ensure that network devices are named such that
they have the MAC address specified for the corresponding physical PIF
in the xapi database.

At one point, we fulfilled this requirement by calling out to the Centos
ifup/ifdown scripts, which rename netdevs as necessary to match the
"HWADDR=" lines in /etc/sysconfig/network-scripts/ifcfg-<devname>.  When
we rewrote interface-reconfigure not to use those scripts, however, we
accidentally dropped that support.  This commit adds back in that renaming.

Bug NIC-20.


commit 449776d81d7b03d9b5f552b402c8a619323e8aa2
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=449776d81d7b03d9b5f552b402c8a619323e8aa2
Author: Ben Pfaff <blp at nicira.com>
		
xenserver: Add new helper function to interface-reconfigure.
		
This will be useful in the followin commit.


commit ba09980aaff81d5ba31aa221179740bc04680787
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=ba09980aaff81d5ba31aa221179740bc04680787
Author: Ben Pfaff <blp at nicira.com>
		
vswitchd: Fix use of uninitialized variable in bridge_pick_local_hw_addr().
		
When a port's MAC is explicitly specified in the config file, we did not
initialize 'iface' and therefore later we could dereference a wild pointer.
This commit fixes the problem.


commit c874dc6d6b892a7697c0c83a070a5b0a564be55f
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=c874dc6d6b892a7697c0c83a070a5b0a564be55f
Author: Ben Pfaff <blp at nicira.com>
		
secchan: Fix behavior when a network device is renamed.
		
update_port() deals with the case where we have been notified that a
network device with a given name, that is part of the datapath, has changed
in some way.  In particular it breaks the problem space up into ports that
have been added, deleted, or modified.

But the code here deals badly with the case where the only change is that
the network device associated with a port has been renamed (which is
reported to it with 'devname' as the network device's new named): it
looks up devname in the ofproto's index by name and doesn't find it, then
it looks up the port number assigned to the netdev in the ofproto's index
by datapath index and sees that there already is one.  This makes it
think that it's a new port, but with a port number that conflicts with an
existing port (under the old name for the port), which makes it discard
the notification and keep the old netdev name, and so afterward nothing
on the netdev will work since it still has the old netdev name.

This rewrite fixes the problem and simplifies the code.


commit 0515ceb3e82ecc6160a141017c20ca26ec1a7a5f
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=0515ceb3e82ecc6160a141017c20ca26ec1a7a5f
Author: Ben Pfaff <blp at nicira.com>
		
datapath: Update sysfs links when network devices are renamed.
		
We create symlinks from /sys/class/net/<bridgename>/brif/<devname> to
/sys/class/net/<devname>/brport, but until now we have never updated the
links when network devices are renamed.  This commit fixes this problem.

(Only the <devname> in /sys/class/net/<bridgename>/brif/<devname> needs to
be updated.  Symlinks within sysfs have stable targets; that is, no matter
how the object that a sysfs symlink points to moves around, the link is
still maintained correctly.)


commit 58c342f617051e9e2ffb09710b4ef2b22c34e79a
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=58c342f617051e9e2ffb09710b4ef2b22c34e79a
Author: Ben Pfaff <blp at nicira.com>
		
datapath: Fix OOPS when dp_sysfs_add_if() fails.
		
Until now, when dp_sysfs_add_if() failed, the caller ignored the failure.
This is a minor problem, because everything else should continue working,
without sysfs entries for the interface, in theory anyhow.  In actual
practice, the error exit path of dp_sysfs_add_if() does a kobject_put(),
and that kobject_put() calls release_nbp(), so that the new port gets
freed.  The next reference to the new port (usually in an ovs-vswitchd call
to the ODP_PORT_LIST ioctl) will then use the freed data and probably OOPS.

The fix is to make the datapath code, as opposed to the sysfs code,
responsible for creating and destroying the net_bridge_port kobject.  The
dp_sysfs_{add,del}_if() functions then just attach and detach the kobject
to sysfs and their cleanup routines no longer need to destroy the kobject
and indeed we don't care whether dp_sysfs_add_if() really succeeds.

This commit also makes the same transformation to the datapath's ifobj,
for consistency.

It is easy to trigger the OOPS fixed by this commit by adding a network
device A to a datapath, then renaming network device A to B, then renaming
network device C to A, then adding A to the datapath.  The last attempt to
add A will fail because a file named /sys/class/net/<datapath>/brif/A
already exists from the time that C was added to the datapath under the
name A.

This commit also adds some compatibility infrastructure, because it moves
code out of #ifdef SUPPORT_SYSFS and it otherwise wouldn't build.


commit 3de35df914e39692470a5d4546cb1fae2d93a316
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=3de35df914e39692470a5d4546cb1fae2d93a316
Author: Ben Pfaff <blp at nicira.com>
		
datapath: Prepare to extend lifetime of kobjects.
		
The following commit will move the initialization of the datapath and
net_bridge_port kobjects earlier and the destruction later, without
changing when those kobjects are attached to sysfs.  To do so, the
initialization of kobjects and attaching to sysfs has to be done as
separate steps.  That's already the case for net_bridge_port kobjects, and
this commit makes it so for datapath kobjects too.

This commit also simplifies some code, since the split API exists both
before and after 2.6.25, but the combined functions changed names.

Also, in dp_sysfs_add_if() call kobject_init() after initializing the
kset member, since kobject_init() expects that.  This makes no actual
difference in this case since the kobj is obtained from kzalloc(), but
it still seems better.


commit 2ba9026e2fc114fa50ae923312340e9f08a1f513
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=2ba9026e2fc114fa50ae923312340e9f08a1f513
Author: Ben Pfaff <blp at nicira.com>
		
datapath: Rename brc_sysfs_* to dp_sysfs_*.
		
These files and names are now part of the datapath, not brcompat, so name
them appropriately so as not to confuse anyone.


commit 2e7dd8eca88d131112a76301da24709b0472e381
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=2e7dd8eca88d131112a76301da24709b0472e381
Author: Ben Pfaff <blp at nicira.com>
		
datapath: Move sysfs support from brcompat_mod into openvswitch_mod.
		
In the past problems have arisen due to the different ways that datapaths
are created and destroyed in the three different cases:

	1. sysfs supported, brcompat_mod loaded.
	2. sysfs supported, brcompat_mod not loaded.
	3. sysfs not supported.

The brcompat_mod loaded versus not loaded distinction is the stickiest
because we have to do all the calls into brcompat_mod through hook
functions, which in turn causes pressure to keep the number of hook
functions small and well-defined, which makes it really difficult to put
the hook call points at exactly the right place.  Witness, for example,
this piece of code in datapath.c:

        int dp_del_port(struct net_bridge_port *p)
        {
                ASSERT_RTNL();

        #ifdef SUPPORT_SYSFS
                if (p->port_no != ODPP_LOCAL && dp_del_if_hook)
                        sysfs_remove_link(&p->dp->ifobj, p->dev->name);
        #endif

The code inside the #ifdef is logically part of the brcompat_mod sysfs
support, but the author of this code (quite reasonably) didn't want to
add a hook function call there.  After all, what would you call the
hook function?  There's no obvious name from the dp_del_port() caller's
perspective.

All this argues that sysfs support should be in openvswitch_mod itself,
since it has to be tightly integrated, not bolted on.  So this commit
moves it there.

Now, this is not to say that openvswitch_mod should actually be
implementing bridge-compatible sysfs.  In the future, it probably should
not be; rather, it should implement something appropriate for Open vSwitch
datapaths instead.  But right now we have bridge-compatible sysfs, and so
that's what this commit moves.


commit 3cc42ebbc144096dc56b618845519daf2d48ef6e
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=3cc42ebbc144096dc56b618845519daf2d48ef6e
Author: Ben Pfaff <blp at nicira.com>
		
xenserver: Really take devices down in interface-reconfigure.
		
When down_netdev was called with deconfigure=True (which is the default),
it would invoke, e.g. "/sbin/ifconfig eth0 down 0.0.0.0", with the
intention of taking the interface down and removing any IP address from it
at the same time.

In fact, this removed any IP address from it and brought the device *up*,
because ifconfig executes its commands in the order that they are
specified, and setting or unsetting an IP address brings a device up.

We could specify the commands in the opposite order ("0.0.0.0 down") but
it seems to me more obviously correct to just run ifconfig twice, so that
is what this commit does.

This commit could break things, because it could be that there is a bug
elsewhere that depends on down_netdev not actually bringing a device down,
but it is needed for the upcoming device renaming commit (to fix bug
NIC-20), because a network device has to be down to be renamed.


commit 5e93df1c46954b9a2c60c8e11bbf8ea25a1686ce
Diffs: http://openvswitch.org/cgi-bin/gitweb.cgi?p=openvswitch;a=commitdiff;h=5e93df1c46954b9a2c60c8e11bbf8ea25a1686ce
Author: Ben Pfaff <blp at nicira.com>
		
brcompat: Add comments to sysfs code.
		
I got tired of figuring out over and over what these function calls do.


-----------------------------------------------------------------------

Summary of changes:
 datapath/Modules.mk                                |    3 +
 datapath/brcompat.c                                |   40 -------
 datapath/datapath.c                                |   81 ++++++++-----
 datapath/datapath.h                                |   11 +--
 datapath/dp_notify.c                               |   23 +++-
 datapath/{brc_sysfs.h => dp_sysfs.h}               |   22 ++--
 datapath/{brc_sysfs_dp.c => dp_sysfs_dp.c}         |   75 +++++-------
 datapath/{brc_sysfs_if.c => dp_sysfs_if.c}         |   55 ++++-----
 datapath/linux-2.6/.gitignore                      |    4 +-
 datapath/linux-2.6/Modules.mk                      |    8 +-
 .../linux-2.6/compat-2.6/include/linux/kobject.h   |   16 +++
 .../linux-2.6/compat-2.6/include/linux/netdevice.h |   12 ++-
 secchan/ofproto.c                                  |   92 +++++++++------
 vswitchd/bridge.c                                  |   14 ++-
 .../opt_xensource_libexec_interface-reconfigure    |  124 ++++++++++++++++---
 15 files changed, 347 insertions(+), 233 deletions(-)
 rename datapath/{brc_sysfs.h => dp_sysfs.h} (61%)
 rename datapath/{brc_sysfs_dp.c => dp_sysfs_dp.c} (84%)
 rename datapath/{brc_sysfs_if.c => dp_sysfs_if.c} (89%)
 create mode 100644 datapath/linux-2.6/compat-2.6/include/linux/kobject.h


hooks/post-receive
-- 
Open vSwitch




More information about the git mailing list