]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Make the number machines to be reserved configurable 479/head
authorYuan Zhou <yuan.zhou@intel.com>
Thu, 30 Apr 2015 06:53:14 +0000 (14:53 +0800)
committerYuan Zhou <yuan.zhou@intel.com>
Mon, 4 May 2015 03:17:11 +0000 (11:17 +0800)
Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
docs/siteconfig.rst
teuthology/config.py
teuthology/task/internal.py
teuthology/test/test_config.py

index 1ec42e802ea9f012542313ffc26f4f1415a5634d..a4895fa0f86b95c04fc8ec527610ba5702c0f63b 100644 (file)
@@ -18,6 +18,10 @@ Here is a sample configuration with many of the options set and documented::
     # only used by teuthology-suite.
     default_machine_type: awesomebox
 
+    # Control how many machines need to be free in the cluster. 0 means
+    # Teuthology can use the entire cluster.
+    reserve_machines: 5
+
     # The host and port to use for the beanstalkd queue. This is required 
     # for scheduled jobs.
     queue_host: localhost
index 9ccd024e0e51b8aacfdad72665abf7c0a57f986f..145ee97debc7be6b26c7bd94de6c5a3a42dee5d6 100644 (file)
@@ -127,6 +127,7 @@ class TeuthologyConfig(YamlConfig):
     _defaults = {
         'archive_base': '/var/lib/teuthworker/archive',
         'automated_scheduling': False,
+        'reserve_machines': 5,
         'ceph_git_base_url': 'https://github.com/ceph/',
         'gitbuilder_host': 'gitbuilder.ceph.com',
         'lab_domain': 'front.sepia.ceph.com',
index e850be4991c070bb0fb4c9057f7318260aab9dc8..6ba2f69e70001f43a67da7c9a027de4cc4dbf82f 100644 (file)
@@ -78,7 +78,9 @@ def lock_machines(ctx, config):
     machine_type = config[1]
     how_many = config[0]
     # We want to make sure there are always this many machines available
-    to_reserve = 5
+    to_reserve = teuth_config.reserve_machines
+    assert isinstance(to_reserve, int), 'reserve_machines must be integer'
+    assert (to_reserve >= 0), 'reserve_machines should >= 0'
 
     # change the status during the locking process
     report.try_push_job_info(ctx.config, dict(status='waiting'))
index c3853739d2b0f6677247c996a9d4d468a8190d84..fee44bf1f27bcd08dddf64c6b6422704024551f8 100644 (file)
@@ -87,6 +87,17 @@ class TestTeuthologyConfig(TestYamlConfig):
             "git://git.ceph.com/"
         assert conf_obj.ceph_git_base_url == "git://git.ceph.com/"
 
+    def test_get_reserve_machines_default(self):
+        conf_obj = self.test_class()
+        conf_obj.yaml_path = ''
+        conf_obj.load()
+        assert conf_obj.reserve_machines == 5
+
+    def test_set_reserve_machines_via_private(self):
+        conf_obj = self.test_class()
+        conf_obj._conf['reserve_machines'] = 2
+        assert conf_obj.reserve_machines == 2
+
     def test_set_nonstandard(self):
         conf_obj = self.test_class()
         conf_obj.something = 'something else'