]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Implement --downburst-conf parameter for teuthology-lock.
authorWarren Usui <warren.usui@inktank.com>
Mon, 2 Dec 2013 22:37:12 +0000 (14:37 -0800)
committerWarren Usui <warren.usui@inktank.com>
Thu, 5 Dec 2013 01:31:55 +0000 (17:31 -0800)
Load the appropriate yaml information when found (this formerly
did not work).  Make sure teuthology --lock works with a downburst
entry in the yaml files.  Document how this works in README.rst.

Fixes: #6921
Reviewed-by: Dan Mick
README.rst
scripts/lock.py
teuthology/lock.py

index 7549143da3442b0a5cfa33f9c00a89e36976d94b..fdb0748fd9c0108652c08bbc2177e8eb0897aea2 100644 (file)
@@ -401,6 +401,9 @@ yaml file will look like this::
 
 These values are used by downburst to create the virtual machine.
 
+When locking a file, a downburst meta-data yaml file can be specified by using
+the downburst-conf parameter on the command line.
+
 HOST KEYS:
 ----------
 
index f94021bf09750515f32643fdc83df4a34c00e369..1025f2b89f92e91fddd3caaa82f2f5649aa80cad 100644 (file)
@@ -156,5 +156,10 @@ 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 fc03429b1b24895f94bfb922abfaad51bdec7720..ce5951e123a962661b006d249ac93cf8e850d594 100644 (file)
@@ -446,9 +446,22 @@ def create_if_vm(ctx, machine_name):
     createMe = decanonicalize_hostname(machine_name)
     with tempfile.NamedTemporaryFile() as tmp:
         try:
-            lcnfg = ctx.config['downburst']
-        except (KeyError, AttributeError):
-            lcnfg = {}
+            lfile = ctx.downburst_conf
+            with open(lfile) as downb_yaml:
+                lcnfg = yaml.safe_load(downb_yaml)
+                if lcnfg.keys() == ['downburst']:
+                    lcnfg = lcnfg['downburst']
+        except (TypeError, AttributeError):
+            try:
+                lcnfg = {}
+                for tdict in ctx.config['downburst']:
+                    for key in tdict:
+                        lcnfg[key] = tdict[key]
+            except (KeyError, AttributeError):
+                lcnfg = {}
+        except IOError:
+            print "Error reading %s" % lfile 
+            return False
 
         distro = lcnfg.get('distro', os_type.lower())
         distroversion = lcnfg.get('distroversion', os_version)