logger -t scripts-vif "Adding ${vif} to ${bridge} with address ${address}"
vid=
- if [ -e "/etc/sysconfig/network-scripts/ifcfg-$bridge" ]; then
- . "/etc/sysconfig/network-scripts/ifcfg-$bridge"
+ if [ -e "/etc/sysconfig/vswitch/br-$bridge" ]; then
+ . "/etc/sysconfig/vswitch/br-$bridge"
if [ -n "$VLAN_SLAVE" -a -n "$VLAN_VID" ]; then
bridge=$VLAN_SLAVE
vid="--add=vlan.$vif.tag=$VLAN_VID"
management_pif = None
dbcache_file = "/etc/vswitch.dbcache"
+vswitch_config_dir = "/etc/sysconfig/vswitch"
class Usage(Exception):
def __init__(self, msg):
def action_up(pif):
pifrec = db.get_pif_record(pif)
+ bridge = bridge_name(pif)
interface = interface_name(pif)
ipdev = ipdev_name(pif)
datapath = datapath_name(pif)
# xapi insists that its attempts to create the bridge succeed,
# so force that to happen.
argv += ['--add=iface.%s.fake-bridge=true' % (ipdev)]
+
+ # /etc/xensource/scripts/vif needs to know where to add VIFs.
+ if not os.path.exists(vswitch_config_dir):
+ os.mkdir(vswitch_config_dir)
+ f = ConfigurationFile("br-%s" % bridge, vswitch_config_dir)
+ f.write("VLAN_SLAVE=%s\n" % datapath)
+ f.write("VLAN_VID=%s\n" % pifrec['VLAN'])
+ f.close()
+ f.apply()
+ f.commit()
if bond_master:
argv += configure_bond(bond_master)
modify_config(argv)