More fixes for port locking.

The script 'common.py' reads the config from xenopsd's database
directly. The past few commits made sure the on-disk database
was up-to-date after API calls to mutate various fields. However,
there is also some further modification of some of the fields
done by the xc driver - for example, the 'extra_private_fields'
string -> string map is augmented with some extra kvs derived
from other fields. In particular, the ipv4_allowed and
ipv6_allowed keys are derived from the locking_mode parameter.
These keys ended up in xenstore but not in the on-disk
json representation of the VIF. The same happened for the
network-backend field - added by xenopsd to the same map, and
thus not in the on-disk json. This was fixed in a xen-api
commit by explicitly adding it in xapi, which was a bit of
a hack.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Ensure VIF json written to disk before the scripts read it

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Correct invocation of setup-vif-rules

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Fix invocation of setup-vif-rules from set_locking_mode

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Udev jiggery-pokery

Add in the udev scripts from xen-api.git. Note these are only
installed in the xen-api-libs-specs specfile, not in the
xenserver-core specfile.

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Fix a warning

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Split up the vif udev script

Now there is a stub called by udev and a separate script
that can be called for debugging

Signed-off-by: Jon Ludlam <jonathan.ludlam@eu.citrix.com>
Imported two patches from xen-api.git

commit fa5d8321c27725fad175a2c4d259726e9b63d0ac
Author: Kevin Tower <ktower@towerfamily.org>
Date:   Mon Apr 29 14:10:44 2013 -0700

    Altering get_bridge_name_vswitch() to work correctly with VLANs.
    VLAN-tagged networks/ports are connected to a "fake bridge" device.
    Most ovs-* commands will not work with a fake bridge
    device, so this function needs to return the true parent bridge
    device name, not the fake bridge.  Otherwise, subsequent calls
    in this script to configure port locking via ovs-ofctl will
    (silently) fail, and port locking will not activate.

    Signed-off-by: Kevin Tower <ktower@towerfamily.org>

commit 06c2d0fedc7031c27ad9215a751c404fde1ebb70
Author: George Shuklin <shuklin@selectel.ru>
Date:   Thu Dec 20 17:41:46 2012 +0400

    Fix bridge name selection for vswitch mode in scripts/setup-vif-rules
      -        bridge_name = "xenbr%s" % devid
      +        bridge_name = get_bridge_name_vswitch(vif_name)

      Devid is device number for domU (f.e. vif1.15; 15 - devid) and is definitely NOT a
      xenbr number (xenbr0, xenbr1, etc).

    Signed-off-by: George Shuklin <george.shuklin@gmail.com>

Committed-by: Rob Hoes <rob.hoes@citrix.com>