Commit 807d8853 authored by Sebastian Gebhard's avatar Sebastian Gebhard Committed by Klaus Aehlig
Browse files

Add params for OpenvSwitch to ndparams



This patch introduces the needed fields for OpenvSwitch parameters
into ndparams and also provides the default values.

The parameters are:
ND_OVS: boolean, to show whether OpenvSwitch is enabled or not
ND_OVS_NAME: the name of the OpenvSwitch to create
ND_OVS_LINK: the physical link to the OpenvSwitch

While ND_OVS and ND_OVS_NAME are mandatory and default to FALSE and
constants.DEFAULT_OVS respectively, ND_OVS_LINK is optional and can
be left empty.
Adding a new node with OpenvSwitch and no physical interface might
or might not be what the user wants, so this case will result in a
warning to inform the user (see later patch in this series).

This patch also fixes unittests which are using these parameters.
Signed-off-by: default avatarSebastian Gebhard <sege@fs.ei.tum.de>
Signed-off-by: default avatarKlaus Aehlig <aehlig@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 4ab6784a
......@@ -1200,11 +1200,17 @@ IPOLICY_ALL_KEYS = (IPOLICY_PARAMETERS |
ND_OOB_PROGRAM = "oob_program"
ND_SPINDLE_COUNT = "spindle_count"
ND_EXCLUSIVE_STORAGE = "exclusive_storage"
ND_OVS = "ovs"
ND_OVS_NAME = "ovs_name"
ND_OVS_LINK = "ovs_link"
NDS_PARAMETER_TYPES = {
ND_OOB_PROGRAM: VTYPE_STRING,
ND_SPINDLE_COUNT: VTYPE_INT,
ND_EXCLUSIVE_STORAGE: VTYPE_BOOL,
ND_OVS: VTYPE_BOOL,
ND_OVS_NAME: VTYPE_MAYBE_STRING,
ND_OVS_LINK: VTYPE_MAYBE_STRING,
}
NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
......@@ -1213,6 +1219,8 @@ NDS_PARAMETER_TITLES = {
ND_OOB_PROGRAM: "OutOfBandProgram",
ND_SPINDLE_COUNT: "SpindleCount",
ND_EXCLUSIVE_STORAGE: "ExclusiveStorage",
ND_OVS_NAME: "OpenvSwitchName",
ND_OVS_LINK: "OpenvSwitchLink",
}
# Logical Disks parameters
......@@ -2206,6 +2214,9 @@ NDC_DEFAULTS = {
ND_OOB_PROGRAM: "",
ND_SPINDLE_COUNT: 1,
ND_EXCLUSIVE_STORAGE: False,
ND_OVS: False,
ND_OVS_NAME: DEFAULT_OVS,
ND_OVS_LINK: ""
}
NDC_GLOBALS = compat.UniqueFrozenset([
......
......@@ -242,6 +242,9 @@ class TestConfigRunner(unittest.TestCase):
constants.ND_OOB_PROGRAM: "/bin/node-oob",
constants.ND_SPINDLE_COUNT: 1,
constants.ND_EXCLUSIVE_STORAGE: False,
constants.ND_OVS: True,
constants.ND_OVS_NAME: "openvswitch",
constants.ND_OVS_LINK: "eth1"
}
cfg = self._get_object()
......@@ -253,15 +256,21 @@ class TestConfigRunner(unittest.TestCase):
def testGetNdParamsInheritance(self):
node_ndparams = {
constants.ND_OOB_PROGRAM: "/bin/node-oob",
constants.ND_OVS_LINK: "eth3"
}
group_ndparams = {
constants.ND_SPINDLE_COUNT: 10,
constants.ND_OVS: True,
constants.ND_OVS_NAME: "openvswitch",
}
expected_ndparams = {
constants.ND_OOB_PROGRAM: "/bin/node-oob",
constants.ND_SPINDLE_COUNT: 10,
constants.ND_EXCLUSIVE_STORAGE:
constants.NDC_DEFAULTS[constants.ND_EXCLUSIVE_STORAGE],
constants.ND_OVS: True,
constants.ND_OVS_NAME: "openvswitch",
constants.ND_OVS_LINK: "eth3"
}
cfg = self._get_object()
node = cfg.GetNodeInfo(cfg.GetNodeList()[0])
......
......@@ -167,6 +167,9 @@ class TestClusterObject(unittest.TestCase):
constants.ND_OOB_PROGRAM: "/bin/group-oob",
constants.ND_SPINDLE_COUNT: 10,
constants.ND_EXCLUSIVE_STORAGE: True,
constants.ND_OVS: True,
constants.ND_OVS_LINK: "eth2",
constants.ND_OVS_NAME: "openvswitch",
}
fake_group = objects.NodeGroup(name="testgroup",
ndparams=group_ndparams)
......@@ -178,6 +181,9 @@ class TestClusterObject(unittest.TestCase):
constants.ND_OOB_PROGRAM: "/bin/node-oob",
constants.ND_SPINDLE_COUNT: 2,
constants.ND_EXCLUSIVE_STORAGE: True,
constants.ND_OVS: True,
constants.ND_OVS_LINK: "eth2",
constants.ND_OVS_NAME: "openvswitch",
}
fake_node = objects.Node(name="test",
ndparams=node_ndparams,
......@@ -192,6 +198,9 @@ class TestClusterObject(unittest.TestCase):
constants.ND_OOB_PROGRAM: "/bin/node-oob",
constants.ND_SPINDLE_COUNT: 5,
constants.ND_EXCLUSIVE_STORAGE: True,
constants.ND_OVS: True,
constants.ND_OVS_LINK: "eth2",
constants.ND_OVS_NAME: "openvswitch",
}
fake_node = objects.Node(name="test",
ndparams=node_ndparams,
......
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