diff --git a/doc/install.rst b/doc/install.rst index 8abbfb570ac05e4a1a9b70a1aa7f728190620537..c6a62d9076f3034eb560e38930def82fe055f134 100644 --- a/doc/install.rst +++ b/doc/install.rst @@ -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 diff --git a/htools/Ganeti/Types.hs b/htools/Ganeti/Types.hs index a654b921d9976b8f770f18170bfc0f9729c5f209..e24edaf636324958126bfbd5f5cef369157d1227 100644 --- a/htools/Ganeti/Types.hs +++ b/htools/Ganeti/Types.hs @@ -366,6 +366,7 @@ $(THH.makeJSONInstance ''NetworkType) $(THH.declareSADT "NICMode" [ ("NMBridged", 'C.nicModeBridged) , ("NMRouted", 'C.nicModeRouted) + , ("NMOvs", 'C.nicModeOvs) ]) $(THH.makeJSONInstance ''NICMode) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 93482735a56037f96473ad47637a252eed94f9ec..ae39560cd5c2efdf431db6120de3e28f6430e92d 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -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: diff --git a/lib/constants.py b/lib/constants.py index de13c9d0a16497fa0e68e812ac31746a1ba7f957..cedb125e5a573122e6f9320b10cd89dbae766bbe 100644 --- a/lib/constants.py +++ b/lib/constants.py @@ -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" diff --git a/man/ganeti-os-interface.rst b/man/ganeti-os-interface.rst index b1f4a1713b25fa01926100f7b2031d577fb7f8b5..7c9bef1c2e5f23c7168690a4ebf66402889d5835 100644 --- a/man/ganeti-os-interface.rst +++ b/man/ganeti-os-interface.rst @@ -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 diff --git a/man/gnt-backup.rst b/man/gnt-backup.rst index da562996724ab8a86cbd23ed3c65c1cb142f3275..51b6e2d5518c6987aab18ed10b34b4afc04b353e 100644 --- a/man/gnt-backup.rst +++ b/man/gnt-backup.rst @@ -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. diff --git a/man/gnt-cluster.rst b/man/gnt-cluster.rst index ee17ed3009d3472d1f28a1c70202b68e9bb4c728..d15e2885a6bc8e6dcb6746d1fdfc5a45b80f888a 100644 --- a/man/gnt-cluster.rst +++ b/man/gnt-cluster.rst @@ -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 diff --git a/man/gnt-instance.rst b/man/gnt-instance.rst index db858cd6570c3669b989604f17da98a219daddf7..e269a9563a69269641d6da8ba09f6119402bbfb2 100644 --- a/man/gnt-instance.rst +++ b/man/gnt-instance.rst @@ -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 diff --git a/tools/kvm-ifup.in b/tools/kvm-ifup.in index 339e1326ad395b01fb679496fc36210d0a0af6f8..e506d736010160284d9dedce9c6ac15d1e523843 100644 --- a/tools/kvm-ifup.in +++ b/tools/kvm-ifup.in @@ -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