Allow fail-mode to be set.
Probably we should have a generic mechanism to specify OVS options.
This commit is contained in:
+4
-3
@@ -827,11 +827,12 @@ class OVSLegacyKernelSwitch( Switch ):
|
|||||||
class OVSSwitch( Switch ):
|
class OVSSwitch( Switch ):
|
||||||
"Open vSwitch switch. Depends on ovs-vsctl."
|
"Open vSwitch switch. Depends on ovs-vsctl."
|
||||||
|
|
||||||
def __init__( self, name, **params ):
|
def __init__( self, name, failMode='secure', **params ):
|
||||||
"""Init.
|
"""Init.
|
||||||
name: name for switch
|
name: name for switch
|
||||||
defaultMAC: default MAC as unsigned int; random value if None"""
|
failMode: controller loss behavior (secure|open)"""
|
||||||
Switch.__init__( self, name, **params )
|
Switch.__init__( self, name, **params )
|
||||||
|
self.failMode = failMode
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup( cls ):
|
def setup( cls ):
|
||||||
@@ -884,7 +885,7 @@ class OVSSwitch( Switch ):
|
|||||||
# Annoyingly, --if-exists option seems not to work
|
# Annoyingly, --if-exists option seems not to work
|
||||||
self.cmd( 'ovs-vsctl del-br', self )
|
self.cmd( 'ovs-vsctl del-br', self )
|
||||||
self.cmd( 'ovs-vsctl add-br', self )
|
self.cmd( 'ovs-vsctl add-br', self )
|
||||||
self.cmd( 'ovs-vsctl set-fail-mode', self, 'secure' )
|
self.cmd( 'ovs-vsctl set-fail-mode', self, self.failMode )
|
||||||
for intf in self.intfList():
|
for intf in self.intfList():
|
||||||
if not intf.IP():
|
if not intf.IP():
|
||||||
self.attach( intf )
|
self.attach( intf )
|
||||||
|
|||||||
Reference in New Issue
Block a user