]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Remove support for a custom downburst config in teuthology.provision 420/head
authorAndrew Schoen <aschoen@redhat.com>
Wed, 28 Jan 2015 20:40:38 +0000 (14:40 -0600)
committerAndrew Schoen <aschoen@redhat.com>
Thu, 29 Jan 2015 17:30:32 +0000 (11:30 -0600)
Will log a warning message if a custom downburst config is found in
ctx.config. Removes unused --downburst-conf option from teuthology-lock.

Signed-off-by: Andrew Schoen <aschoen@redhat.com>
scripts/lock.py
teuthology/misc.py
teuthology/provision.py
teuthology/test/test_get_distro.py

index 2511ddf39204fa574fc47544b3d1983f8a3d80e4..d47a26ab1bd69d0baf080ac172eb688db995b745 100644 (file)
@@ -158,10 +158,5 @@ def parse_args():
         default=None,
         help='OS (distro) version such as "12.10"',
     )
-    parser.add_argument(
-        '--downburst-conf',
-        default=None,
-        help='Downburst meta-data yaml file to be used for vps machines',
-    )
 
     return parser.parse_args()
index 109b1bea3cc4b911eb752afac295c6081987f513..b818093dfb8d3b169d50ede2ad934b6f60ef4794 100644 (file)
@@ -1154,17 +1154,17 @@ def get_distro(ctx):
     """
     Get the name of the distro that we are using (usually the os_type).
     """
-    # ubuntu is our default distro choice
-    os_type = "ubuntu"
+    os_type = None
     if ctx.os_type:
         return ctx.os_type
 
     try:
-        os_type = ctx.config.get('os_type', os_type)
+        os_type = ctx.config.get('os_type', None)
     except AttributeError:
         pass
 
-    return os_type
+    # if os_type is None, return the default of ubuntu
+    return os_type or "ubuntu"
 
 
 def get_distro_version(ctx):
index e8d23a85982d6efeda95257067c8779d6c515a57..e9803f51637a9122b303071b312a83c00c673924 100644 (file)
@@ -49,32 +49,29 @@ def create_if_vm(ctx, machine_name):
 
     createMe = decanonicalize_hostname(machine_name)
     with tempfile.NamedTemporaryFile() as tmp:
-        if hasattr(ctx, 'config') and ctx.config is not None:
-            lcnfg = ctx.config.get('downburst', dict())
-        else:
-            lcnfg = {}
-        distro = lcnfg.get('distro', os_type.lower())
-        distroversion = lcnfg.get('distroversion', os_version)
+        has_config = hasattr(ctx, 'config') and ctx.config is not None
+        if has_config and 'downburst' in ctx.config:
+            log.warning(
+                'Usage of a custom downburst config has been deprecated.'
+            )
 
         log.info("Provisioning a {distro} {distroversion} vps".format(
-            distro=distro,
-            distroversion=distroversion
+            distro=os_type,
+            distroversion=os_version
         ))
 
-        file_info = {}
-        file_info['disk-size'] = lcnfg.get('disk-size', '100G')
-        file_info['ram'] = lcnfg.get('ram', '1.9G')
-        file_info['cpus'] = lcnfg.get('cpus', 1)
-        file_info['networks'] = lcnfg.get(
-            'networks',
-            [{'source': 'front', 'mac': status_info['mac_address']}])
-        file_info['distro'] = distro
-        file_info['distroversion'] = distroversion
-        file_info['additional-disks'] = lcnfg.get(
-            'additional-disks', 3)
-        file_info['additional-disks-size'] = lcnfg.get(
-            'additional-disks-size', '200G')
-        file_info['arch'] = lcnfg.get('arch', 'x86_64')
+        file_info = {
+            'disk-size': '100G',
+            'ram': '1.9G',
+            'cpus': 1,
+            'networks': [
+                {'source': 'front', 'mac': status_info['mac_address']}],
+            'distro': os_type.lower(),
+            'distroversion': os_version,
+            'additional-disks': 3,
+            'additional-disks-size': '200G',
+            'arch': 'x86_64',
+        }
         fqdn = machine_name.split('@')[1]
         file_out = {'downburst': file_info, 'local-hostname': fqdn}
         yaml.safe_dump(file_out, tmp)
@@ -89,13 +86,13 @@ def create_if_vm(ctx, machine_name):
         owt, err = p.communicate()
         if err:
             log.info("Downburst completed on %s: %s" %
-                    (machine_name, err))
+                     (machine_name, err))
         else:
             log.info("%s created: %s" % (machine_name, owt))
         # If the guest already exists first destroy then re-create:
         if 'exists' in err:
             log.info("Guest files exist. Re-creating guest: %s" %
-                    (machine_name))
+                     (machine_name))
             destroy_if_vm(ctx, machine_name)
             create_if_vm(ctx, machine_name)
     return True
index 9c9990306dfedbfb702f7ee1e7adc8dc981902f8..f3c96586eb764fa737a7fdffc5f942929ec8b5ee 100644 (file)
@@ -40,3 +40,8 @@ class TestGetDistro(object):
         self.fake_ctx.os_type = None
         distro = get_distro(self.fake_ctx)
         assert distro == 'ubuntu'
+
+    def test_config_os_type_is_none(self):
+        self.fake_ctx.config["os_type"] = None
+        distro = get_distro(self.fake_ctx)
+        assert distro == 'ubuntu'