JobResults = _JobResults()
+
+class _NodeReimagingResults(TeuthologyMetric):
+ def __init__(self):
+ self.metric = Counter(
+ "teuthology_reimaging_results",
+ "Teuthology Reimaging Results",
+ ["machine_type", "status"],
+ )
+
+ # As this is to be used within job processes, we implement record() rather than update()
+ def record(self, machine_type, status):
+ self.metric.labels(machine_type=machine_type, status=status).inc()
+
+
+NodeReimagingResults = _NodeReimagingResults()
+
NodeLockingTime = Summary(
"teuthology_node_locking_duration_seconds",
"Time spent waiting to lock nodes",
import logging
+import teuthology.exporter
import teuthology.lock.query
from teuthology.misc import decanonicalize_hostname, get_distro, get_distro_version
return os.path.join(ctx.config['archive_path'],
shortname + '.downburst.log')
+
def get_reimage_types():
return pelagos.get_types() + fog.get_types()
+
def reimage(ctx, machine_name, machine_type):
os_type = get_distro(ctx)
os_version = get_distro_version(ctx)
else:
raise Exception("The machine_type '%s' is not known to any "
"of configured provisioners" % machine_type)
- return obj.create()
+ status = "fail"
+ try:
+ result = obj.create()
+ status = "success"
+ except Exception:
+ # We only need this clause so that we avoid triggering the finally
+ # clause below in cases where the exception raised is KeyboardInterrupt
+ # or SystemExit
+ raise
+ finally:
+ teuthology.exporter.NodeReimagingResults.record(
+ ctx.config.get("machine_type"),
+ status,
+ )
+ return result
def create_if_vm(ctx, machine_name, _downburst=None):