This patch extends the current Ganeti NIC connection modes with a new one, the 'macvtap' mode, to indicate that a NIC is using the MacVTap linux device driver.
Signed-off-by: Dimitris Bliablias <db...@skroutz.gr> --- lib/config/__init__.py | 2 ++ src/Ganeti/Constants.hs | 3 +++ src/Ganeti/HTools/Backend/IAlloc.hs | 1 + src/Ganeti/HTools/Nic.hs | 2 +- src/Ganeti/Types.hs | 1 + 5 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/config/__init__.py b/lib/config/__init__.py index b6e5047..f7d6aca 100644 --- a/lib/config/__init__.py +++ b/lib/config/__init__.py @@ -1032,6 +1032,8 @@ class ConfigWriter(object): link = "route:%s" % nic_link elif nic_mode == constants.NIC_MODE_OVS: link = "ovs:%s" % nic_link + elif nic_mode == constants.NIC_MODE_MACVTAP: + link = "macvtap:%s" % nic_link else: raise errors.ProgrammerError("NIC mode '%s' not handled" % nic_mode) diff --git a/src/Ganeti/Constants.hs b/src/Ganeti/Constants.hs index 5d651d2..a0d681d 100644 --- a/src/Ganeti/Constants.hs +++ b/src/Ganeti/Constants.hs @@ -2541,6 +2541,9 @@ nicModeRouted = Types.nICModeToRaw NMRouted nicModeOvs :: String nicModeOvs = Types.nICModeToRaw NMOvs +nicModeMacvtap:: String +nicModeMacvtap = Types.nICModeToRaw NMMacvtap + nicIpPool :: String nicIpPool = Types.nICModeToRaw NMPool diff --git a/src/Ganeti/HTools/Backend/IAlloc.hs b/src/Ganeti/HTools/Backend/IAlloc.hs index e431947..40a40c9 100644 --- a/src/Ganeti/HTools/Backend/IAlloc.hs +++ b/src/Ganeti/HTools/Backend/IAlloc.hs @@ -84,6 +84,7 @@ parseNic n a = do Just "bridged" -> Ok $ Just Nic.Bridged Just "routed" -> Ok $ Just Nic.Routed Just "openvswitch" -> Ok $ Just Nic.OpenVSwitch + Just "macvtap" -> Ok $ Just Nic.MacVtap Nothing -> Ok Nothing _ -> Bad $ "invalid NIC mode in instance " ++ n link <- maybeFromObj a "link" diff --git a/src/Ganeti/HTools/Nic.hs b/src/Ganeti/HTools/Nic.hs index 16d20eb..46ac233 100644 --- a/src/Ganeti/HTools/Nic.hs +++ b/src/Ganeti/HTools/Nic.hs @@ -48,7 +48,7 @@ import qualified Ganeti.HTools.Types as T -- * Type declarations -data Mode = Bridged | Routed | OpenVSwitch deriving (Show, Eq) +data Mode = Bridged | Routed | OpenVSwitch | MacVtap deriving (Show, Eq) -- | The NIC type. -- diff --git a/src/Ganeti/Types.hs b/src/Ganeti/Types.hs index 171eb19..e56450a 100644 --- a/src/Ganeti/Types.hs +++ b/src/Ganeti/Types.hs @@ -672,6 +672,7 @@ $(THH.declareLADT ''String "NICMode" [ ("NMBridged", "bridged") , ("NMRouted", "routed") , ("NMOvs", "openvswitch") + , ("NMMacvtap", "macvtap") , ("NMPool", "pool") ]) $(THH.makeJSONInstance ''NICMode) -- 2.1.4