# 3. A network may have an associated bridge, allowing vifs to be attached
# 4. A network may be bridgeless (there's no point having a bridge over a storage pif)
-# XXX: --force-interface=all down
-
-# XXX: --force-interface rewrite
-
-# XXX: Sometimes this leaves "orphaned" datapaths, e.g. a datapath whose
-# only port is the local port. Should delete those.
-
-# XXX: This can leave crud in ovs-vswitchd.conf in this scenario:
-# - Create bond in XenCenter.
-# - Create VLAN on bond in XenCenter.
-# - Attempt to delete bond in XenCenter (this will fail because there
-# is a VLAN on the bond, although the error may not be reported
-# until the next step)
-# - Delete VLAN in XenCenter.
-# - Delete bond in XenCenter.
-# At this point there will still be some configuration data for the bond
-# or the VLAN in ovs-vswitchd.conf.
-
import XenAPI
import os, sys, getopt, time, signal
import syslog
'MAC': (str_to_xml,str_from_xml),
'other_config': (lambda x, p, t, v: otherconfig_to_xml(x, p, v, PIF_OTHERCONFIG_ATTRS),
lambda n: otherconfig_from_xml(n, PIF_OTHERCONFIG_ATTRS)),
+
+ # Special case: We write the current value
+ # PIF.currently-attached to the cache but since it will
+ # not be valid when we come to use the cache later
+ # (i.e. after a reboot) we always read it as False.
+ 'currently_attached': (bool_to_xml, lambda n: False),
}
PIF_OTHERCONFIG_ATTRS = [ 'domain', 'peerdns', 'defaultroute', 'mtu', 'static-routes' ] + \
rec = session.xenapi.network.get_record(n)
self.__networks[n] = {}
for f in NETWORK_ATTRS:
- self.__networks[n][f] = rec[f]
+ if f == "PIFs":
+ # drop PIFs on other hosts
+ self.__networks[n][f] = [p for p in rec[f] if self.__pif_on_host(p)]
+ else:
+ self.__networks[n][f] = rec[f]
self.__networks[n]['other_config'] = {}
for f in NETWORK_OTHERCONFIG_ATTRS:
if not rec['other_config'].has_key(f): continue
raise Usage("Unknown action %s" % action)
# Save cache.
- pifrec = db.get_pif_record(pif)
db.save(dbcache_file)
except Usage, err: