Commit 57fb6fcb authored by Guido Trotter's avatar Guido Trotter

Very very very basic openvswitch support

This is a "better than nothing" support, just for kvm and just joining
the machine to the opevswitch bridge with the right command.
Signed-off-by: default avatarGuido Trotter <ultrotter@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarRené Nussbaumer <rn@google.com>
parent cce30754
......@@ -421,12 +421,12 @@ Configuring the network
**Mandatory** on all nodes.
You can run Ganeti either in "bridged mode" or in "routed mode". In
bridged mode, the default, the instances network interfaces will be
attached to a software bridge running in dom0. Xen by default creates
such a bridge at startup, but your distribution might have a different
way to do things, and you'll definitely need to manually set it up under
KVM.
You can run Ganeti either in "bridged mode", "routed mode" or
"openvswitch mode". In bridged mode, the default, the instances network
interfaces will be attached to a software bridge running in dom0. Xen by
default creates such a bridge at startup, but your distribution might
have a different way to do things, and you'll definitely need to
manually set it up under KVM.
Beware that the default name Ganeti uses is ``xen-br0`` (which was used
in Xen 2.0) while Xen 3.0 uses ``xenbr0`` by default. See the
......@@ -449,6 +449,10 @@ outside of ganeti. The vif scripts will only add /32 routes to your
instances, through their interface, in the table you specified (under
KVM, and in the main table under Xen).
Also for "openvswitch mode" under Xen a custom network script is needed.
Under KVM everything should work, but you'll need to configure your
switches outside of Ganeti (as for bridges).
.. admonition:: Bridging issues with certain kernels
Some kernel versions (e.g. 2.6.32) have an issue where the bridge
......
......@@ -366,6 +366,7 @@ $(THH.makeJSONInstance ''NetworkType)
$(THH.declareSADT "NICMode"
[ ("NMBridged", 'C.nicModeBridged)
, ("NMRouted", 'C.nicModeRouted)
, ("NMOvs", 'C.nicModeOvs)
])
$(THH.makeJSONInstance ''NICMode)
......
......@@ -13053,6 +13053,10 @@ class LUInstanceSetParams(LogicalUnit):
raise errors.OpPrereqError("Cannot set the NIC IP address to None"
" on a routed NIC", errors.ECODE_INVAL)
elif new_mode == constants.NIC_MODE_OVS:
# TODO: check OVS link
self.LogInfo("OVS links are currently not checked for correctness")
if constants.INIC_MAC in params:
mac = params[constants.INIC_MAC]
if mac is None:
......
......@@ -1068,9 +1068,10 @@ NIC_LINK = "link"
NIC_MODE_BRIDGED = "bridged"
NIC_MODE_ROUTED = "routed"
NIC_MODE_OVS = "openvswitch"
NIC_IP_POOL = "pool"
NIC_VALID_MODES = frozenset([NIC_MODE_BRIDGED, NIC_MODE_ROUTED])
NIC_VALID_MODES = frozenset([NIC_MODE_BRIDGED, NIC_MODE_ROUTED, NIC_MODE_OVS])
RESERVE_ACTION = "reserve"
RELEASE_ACTION = "release"
......
......@@ -101,17 +101,17 @@ NIC_%N_IP
instance.
NIC_%N_MODE
The NIC mode, either routed or bridged
The NIC mode, routed, bridged or openvswitch
NIC_%N_BRIDGE
The bridge to which this NIC will be attached. This variable is
defined only when the NIC is in bridged mode.
NIC_%N_LINK
If the NIC is in bridged mode, this is the same as
``NIC_%N_BRIDGE``. If it is in routed mode, the routing table
which will be used by the hypervisor to insert the appropriate
routes.
In bridged or openvswitch mode, this is the interface to which the
NIC will be attached (same as ``NIC_%N_BRIDGE`` for bridged). In
routed mode it is the routing table which will be used by the
hypervisor to insert the appropriate routes.
NIC_%N_FRONTEND_TYPE
(Optional) If applicable, the type of the exported NIC to the
......
......@@ -121,15 +121,15 @@ ip
the node expects the instance to use)
mode
specifies the connection mode for this nic: ``routed`` or
``bridged``.
specifies the connection mode for this nic: ``routed``,
``bridged`` or ``openvswitch``
link
in bridged mode specifies the bridge to attach this NIC to, in
routed mode it's intended to differentiate between different
routing tables/instance groups (but the meaning is dependent on
the network script in use, see **gnt-cluster**(8) for more
details)
in bridged and openvswitch mode specifies the interface to attach
this NIC to, in routed mode it's intended to differentiate between
different routing tables/instance groups (but the meaning is
dependent on the network script in use, see **gnt-cluster**(8) for
more details)
Of these ``mode`` and ``link`` are nic parameters, and inherit their
default at cluster level.
......
......@@ -363,14 +363,16 @@ parameters for the cluster. The parameter format is a comma-separated
list of key=value pairs with the following supported keys:
mode
The default nic mode, 'routed' or 'bridged'.
The default nic mode, 'routed', 'bridged' or 'openvswitch'.
link
In bridged mode the default NIC bridge. In routed mode it
represents an hypervisor-vif-script dependent value to allow
different instance groups. For example under the KVM default
network script it is interpreted as a routing table number or
name.
In bridged or openvswitch mode the default interface where to attach
NICs. In routed mode it represents an hypervisor-vif-script
dependent value to allow different instance groups. For example
under the KVM default network script it is interpreted as a routing
table number or name. Openvswitch support is also hypervisor
dependent and currently works for the default KVM network script.
Under Xen a custom network script must be provided.
The ``-D (--disk-parameters)`` option allows you to set the default disk
template parameters at cluster level. The format used for this option is
......
......@@ -103,13 +103,16 @@ ip
the node expects the instance to use)
mode
specifies the connection mode for this nic: routed or bridged.
specifies the connection mode for this nic: routed, bridged or
openvswitch.
link
in bridged mode specifies the bridge to attach this NIC to, in
routed mode it's intended to differentiate between different
routing tables/instance groups (but the meaning is dependent on
the network script, see gnt-cluster(8) for more details)
in bridged or openvswitch mode specifies the interface to attach
this NIC to, in routed mode it's intended to differentiate between
different routing tables/instance groups (but the meaning is
dependent on the network script, see gnt-cluster(8) for more
details). Note that openvswitch support is also hypervisor
dependent.
Of these "mode" and "link" are nic parameters, and inherit their
......
......@@ -47,6 +47,10 @@ if [ "$MODE" = "bridged" ]; then
# Connect the interface to the bridge
brctl addif $BRIDGE $INTERFACE
elif [ "$MODE" = "openvswitch" ]; then
ovs-vsctl add-port ${LINK} $INTERFACE
else
ip link set $INTERFACE up
......@@ -65,6 +69,7 @@ else
ip route replace $IP proto static dev $INTERFACE
fi
# Allow routing and arp proxying, or ndp proxying (IPv6)
if [ -d "/proc/sys/net/ipv4/conf/$INTERFACE" ]; then
echo 1 > /proc/sys/net/ipv4/conf/$INTERFACE/proxy_arp
echo 1 > /proc/sys/net/ipv4/conf/$INTERFACE/forwarding
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment