Commit 0ea11dcb authored by Bernardo Dal Seno's avatar Bernardo Dal Seno
Browse files

Add exclusive_storage node parameter



Unit tests updated and expanded with an inheritance check.

The flag has no effect yet.
Signed-off-by: default avatarBernardo Dal Seno <bdalseno@google.com>
Reviewed-by: default avatarIustin Pop <iustin@google.com>
parent d3b06210
......@@ -426,6 +426,7 @@ fillIPolicy (FilledIPolicy { ipolicyMinSpec = fmin
$(buildParam "ND" "ndp"
[ simpleField "oob_program" [t| String |]
, simpleField "spindle_count" [t| Int |]
, simpleField "exclusive_storage" [t| Bool |]
])
$(buildObject "Node" "node" $
......
......@@ -942,10 +942,12 @@ IPOLICY_ALL_KEYS = (IPOLICY_ISPECS |
# Node parameter names
ND_OOB_PROGRAM = "oob_program"
ND_SPINDLE_COUNT = "spindle_count"
ND_EXCLUSIVE_STORAGE = "exclusive_storage"
NDS_PARAMETER_TYPES = {
ND_OOB_PROGRAM: VTYPE_STRING,
ND_SPINDLE_COUNT: VTYPE_INT,
ND_EXCLUSIVE_STORAGE: VTYPE_BOOL,
}
NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
......@@ -953,6 +955,7 @@ NDS_PARAMETERS = frozenset(NDS_PARAMETER_TYPES.keys())
NDS_PARAMETER_TITLES = {
ND_OOB_PROGRAM: "OutOfBandProgram",
ND_SPINDLE_COUNT: "SpindleCount",
ND_EXCLUSIVE_STORAGE: "ExclusiveStorage",
}
# Logical Disks parameters
......@@ -1842,6 +1845,7 @@ BEC_DEFAULTS = {
NDC_DEFAULTS = {
ND_OOB_PROGRAM: "",
ND_SPINDLE_COUNT: 1,
ND_EXCLUSIVE_STORAGE: False,
}
DISK_LD_DEFAULTS = {
......
......@@ -116,6 +116,12 @@ spindle_count
hard-drives, its meaning is site-local and just the relative values
matter.
exclusive_storage
When this Boolean flag is enabled, physical disks on the node are
assigned to instance disks in an exclusive manner, so as to lower I/O
interference between instances. See the `Partitioned Ganeti
<design-partitioned.rst>`_ design document for more details.
Hypervisor State Parameters
~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -201,6 +201,7 @@ class TestConfigRunner(unittest.TestCase):
my_ndparams = {
constants.ND_OOB_PROGRAM: "/bin/node-oob",
constants.ND_SPINDLE_COUNT: 1,
constants.ND_EXCLUSIVE_STORAGE: False,
}
cfg = self._get_object()
......@@ -209,6 +210,28 @@ class TestConfigRunner(unittest.TestCase):
cfg.Update(node, None)
self.assertEqual(cfg.GetNdParams(node), my_ndparams)
def testGetNdParamsInheritance(self):
node_ndparams = {
constants.ND_OOB_PROGRAM: "/bin/node-oob",
}
group_ndparams = {
constants.ND_SPINDLE_COUNT: 10,
}
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],
}
cfg = self._get_object()
node = cfg.GetNodeInfo(cfg.GetNodeList()[0])
node.ndparams = node_ndparams
cfg.Update(node, None)
group = cfg.GetNodeGroup(node.group)
group.ndparams = group_ndparams
cfg.Update(group, None)
self.assertEqual(cfg.GetNdParams(node), expected_ndparams)
def testAddGroupFillsFieldsIfMissing(self):
cfg = self._get_object()
group = objects.NodeGroup(name="test", members=[])
......
......@@ -79,7 +79,8 @@ class TestClusterObject(unittest.TestCase):
}
ndparams = {
constants.ND_OOB_PROGRAM: "/bin/cluster-oob",
constants.ND_SPINDLE_COUNT: 1
constants.ND_SPINDLE_COUNT: 1,
constants.ND_EXCLUSIVE_STORAGE: False,
}
self.fake_cl = objects.Cluster(hvparams=hvparams, os_hvp=os_hvp,
......@@ -164,6 +165,7 @@ class TestClusterObject(unittest.TestCase):
group_ndparams = {
constants.ND_OOB_PROGRAM: "/bin/group-oob",
constants.ND_SPINDLE_COUNT: 10,
constants.ND_EXCLUSIVE_STORAGE: True,
}
fake_group = objects.NodeGroup(name="testgroup",
ndparams=group_ndparams)
......@@ -174,6 +176,7 @@ class TestClusterObject(unittest.TestCase):
node_ndparams = {
constants.ND_OOB_PROGRAM: "/bin/node-oob",
constants.ND_SPINDLE_COUNT: 2,
constants.ND_EXCLUSIVE_STORAGE: True,
}
fake_node = objects.Node(name="test",
ndparams=node_ndparams,
......@@ -187,6 +190,7 @@ class TestClusterObject(unittest.TestCase):
node_ndparams = {
constants.ND_OOB_PROGRAM: "/bin/node-oob",
constants.ND_SPINDLE_COUNT: 5,
constants.ND_EXCLUSIVE_STORAGE: True,
}
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