Add exclusive_storage node parameter
authorBernardo Dal Seno <bdalseno@google.com>
Wed, 12 Dec 2012 16:28:49 +0000 (17:28 +0100)
committerBernardo Dal Seno <bdalseno@google.com>
Wed, 19 Dec 2012 13:14:50 +0000 (14:14 +0100)
Unit tests updated and expanded with an inheritance check.

The flag has no effect yet.

Signed-off-by: Bernardo Dal Seno <bdalseno@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

htools/Ganeti/Objects.hs
lib/constants.py
man/ganeti.rst
test/ganeti.config_unittest.py
test/ganeti.objects_unittest.py

index 18ca6df..b4a61ab 100644 (file)
@@ -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" $
index cedb125..3e6a0eb 100644 (file)
@@ -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 = {
index d31adfc..70e50e5 100644 (file)
@@ -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
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
index 4f39017..b06f774 100755 (executable)
@@ -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=[])
index 19b75c1..c29f83e 100755 (executable)
@@ -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,