[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-API] [PATCH 1 of 3] [PATCH] interface-reconfigure: callout to datapath backend class method on rewrite
# HG changeset patch # User Ian Campbell <ian.campbell@xxxxxxxxxx> # Date 1278596003 -3600 # Node ID 26f08e08cf3ce4fa91bd4249e0b52c6f6d73345d # Parent 318ea84e251395c3e46c2579301d48904aabb84b [PATCH] interface-reconfigure: callout to datapath backend class method on rewrite >From 823c5699d4de7bf726f988e1ca6197fb2400f388 Mon Sep 17 00:00:00 2001 Date: Fri, 4 Jun 2010 16:39:10 +0100 Use this mechanism to allow the vswitch backend to update the vswitch configuration's mapping from datapath to XenAPI datamodel Network UUIDs. The vswitch needs a mechanism to update these when they change (i.e. on pool join and eject). Refactor the DatapathFactory method to return the class which the caller can instantiate or not as the require. Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Signed-off-by: Dominic Curran <dominic.curran@xxxxxxxxxx> --- .../opt_xensource_libexec_InterfaceReconfigure.py | 12 +++++++++--- ...ensource_libexec_InterfaceReconfigureVswitch.py | 11 +++++++++++ .../opt_xensource_libexec_interface-reconfigure | 9 ++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) diff -r 318ea84e2513 -r 26f08e08cf3c scripts/InterfaceReconfigure.py --- a/scripts/InterfaceReconfigure.py Thu Jul 08 14:32:33 2010 +0100 +++ b/scripts/InterfaceReconfigure.py Thu Jul 08 14:33:23 2010 +0100 @@ -803,6 +803,12 @@ def __init__(self, pif): self._pif = pif + @classmethod + def rewrite(cls): + """Class method called when write action is called. Can be used + to update any backend specific configuration.""" + pass + def configure_ipdev(self, cfg): """Write ifcfg TYPE field for an IPdev, plus any type specific fields to cfg @@ -850,7 +856,7 @@ """ raise NotImplementedError -def DatapathFactory(pif): +def DatapathFactory(): # XXX Need a datapath object for bridgeless PIFs try: @@ -862,9 +868,9 @@ if network_backend == "bridge": from InterfaceReconfigureBridge import DatapathBridge - return DatapathBridge(pif) + return DatapathBridge elif network_backend in ["openvswitch", "vswitch"]: from InterfaceReconfigureVswitch import DatapathVswitch - return DatapathVswitch(pif) + return DatapathVswitch else: raise Error("unknown network backend %s" % network_backend) diff -r 318ea84e2513 -r 26f08e08cf3c scripts/InterfaceReconfigureVswitch.py --- a/scripts/InterfaceReconfigureVswitch.py Thu Jul 08 14:32:33 2010 +0100 +++ b/scripts/InterfaceReconfigureVswitch.py Thu Jul 08 14:33:23 2010 +0100 @@ -358,6 +358,17 @@ log("Configured for Vswitch datapath") + @classmethod + def rewrite(cls): + vsctl_argv = [] + for pif in db().get_all_pifs(): + pifrec = db().get_pif_record(pif) + if not pif_is_vlan(pif) and pifrec['currently_attached']: + vsctl_argv += set_br_external_ids(pif) + + if vsctl_argv != []: + datapath_modify_config(vsctl_argv) + def configure_ipdev(self, cfg): cfg.write("TYPE=Ethernet\n") diff -r 318ea84e2513 -r 26f08e08cf3c scripts/interface-reconfigure --- a/scripts/interface-reconfigure Thu Jul 08 14:32:33 2010 +0100 +++ b/scripts/interface-reconfigure Thu Jul 08 14:33:23 2010 +0100 @@ -415,7 +415,7 @@ pifrec = db().get_pif_record(pif) ipdev = pif_ipdev_name(pif) - dp = DatapathFactory(pif) + dp = DatapathFactory()(pif) log("action_up: %s" % ipdev) @@ -455,7 +455,7 @@ def action_down(pif): ipdev = pif_ipdev_name(pif) - dp = DatapathFactory(pif) + dp = DatapathFactory()(pif) log("action_down: %s" % ipdev) @@ -463,6 +463,9 @@ dp.bring_down() +def action_rewrite(): + DatapathFactory().rewrite() + # This is useful for reconfiguring the mgmt interface after having lost connectivity to the pool master def action_force_rewrite(bridge, config): def getUUID(): @@ -666,7 +669,7 @@ pif = db().get_pif_by_uuid(pif_uuid) if action == "rewrite": - pass + action_rewrite() else: if not pif: raise Usage("No PIF given") scripts/InterfaceReconfigure.py | 12 +++++++++--- scripts/InterfaceReconfigureVswitch.py | 11 +++++++++++ scripts/interface-reconfigure | 9 ++++++--- 3 files changed, 26 insertions(+), 6 deletions(-) Attachment:
txt8tn4FY9ecc.txt _______________________________________________ xen-api mailing list xen-api@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |