node: Allow OVSSwitch to run in userspace mode
This adds a datapath parameter to OVSSwitch which allows one to tell OVS to run in userspace mode rather than kernel mode. From the commandline, this is --switch=ovsk,datapath=user. Note that this makes "ovsk" and the OVSKernelSwitch alias misnomers. Since the default behavior is still kernel mode, this is hopefully harmless. This is the second version of this patch, which changes the argument name and values according to Bob's suggestion.
This commit is contained in:
+6
-2
@@ -896,12 +896,14 @@ 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, failMode='secure', **params ):
|
def __init__( self, name, failMode='secure', datapath='kernel', **params ):
|
||||||
"""Init.
|
"""Init.
|
||||||
name: name for switch
|
name: name for switch
|
||||||
failMode: controller loss behavior (secure|open)"""
|
failMode: controller loss behavior (secure|open)
|
||||||
|
datapath: userspace or kernel mode (kernel|user)"""
|
||||||
Switch.__init__( self, name, **params )
|
Switch.__init__( self, name, **params )
|
||||||
self.failMode = failMode
|
self.failMode = failMode
|
||||||
|
self.datapath = datapath
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setup( cls ):
|
def setup( cls ):
|
||||||
@@ -956,6 +958,8 @@ 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 )
|
||||||
|
if self.datapath == 'user':
|
||||||
|
self.cmd( 'ovs-vsctl set bridge', self,'datapath_type=netdev' )
|
||||||
self.cmd( 'ovs-vsctl -- set Bridge', self,
|
self.cmd( 'ovs-vsctl -- set Bridge', self,
|
||||||
'other_config:datapath-id=' + self.dpid )
|
'other_config:datapath-id=' + self.dpid )
|
||||||
self.cmd( 'ovs-vsctl set-fail-mode', self, self.failMode )
|
self.cmd( 'ovs-vsctl set-fail-mode', self, self.failMode )
|
||||||
|
|||||||
Reference in New Issue
Block a user