]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
More changes for creating vms manually with lock (no config)
authorSandon Van Ness <sandon@inktank.com>
Tue, 30 Jul 2013 00:03:30 +0000 (17:03 -0700)
committerSandon Van Ness <sandon@inktank.com>
Tue, 30 Jul 2013 00:07:31 +0000 (17:07 -0700)
Needed some more changes to allow for the case of creating vm's
manually with teuthology-lock instead of letting teuthology handle
it in internal.py with lock_machines(). Just some additional checks
to go to defaults when ctx.config is non-existent (causes an
attributeerror).

Signed-off-by: Sandon Van Ness <sandon@inktank.com>
Reviewed-by: Warren Usui <warren.usui@inktank.com>
teuthology/lock.py
teuthology/misc.py

index 3873136d7c33ab0ad81b3acc137da1e0596a4ec3..b0e0f62c8cfab3a2f9a043e872a6328ce416a859 100644 (file)
@@ -558,10 +558,15 @@ def create_if_vm(ctx, machine_name):
     with tempfile.NamedTemporaryFile() as tmp:
         try:
             lcnfg = ctx.config['downburst']
-        except KeyError:
+        except (KeyError, AttributeError):
             lcnfg = {}
 
         distro = lcnfg.get('distro', os_type.lower())
+        try:
+            distroversion = ctx.config.get('os_version', default_os_version[distro])
+        except AttributeError:
+            distroversion = default_os_version[distro]
+
         file_info = {}
         file_info['disk-size'] = lcnfg.get('disk-size', '30G')
         file_info['ram'] = lcnfg.get('ram', '1.9G')
@@ -569,7 +574,7 @@ def create_if_vm(ctx, machine_name):
         file_info['networks'] = lcnfg.get('networks',
                 [{'source' : 'front', 'mac' : status_info['mac']}])
         file_info['distro'] = distro
-        file_info['distroversion'] = ctx.config.get('os_version', default_os_version[distro])
+        file_info['distroversion'] = distroversion
         file_info['additional-disks'] = lcnfg.get(
                 'additional-disks', 3)
         file_info['additional-disks-size'] = lcnfg.get(
index 13e274a9c75b6a627cce3a26682a8d29c2c1fa28..86638e71d6df1c6b3b20b2dd1bd582b4b5517007 100644 (file)
@@ -894,4 +894,6 @@ def get_distro(ctx):
     try:
         return ctx.config['downburst'].get('distro', os_type)
     except KeyError:
-        return os_type
\ No newline at end of file
+        return os_type
+    except AttributeError:
+        return ctx.os_type