locking the nodes.
Signed-off-by: Vasu Kulkarni <vasu@redhat.com>
--- /dev/null
+import docopt
+
+from teuthology.misc import reimage_fog
+import sys
+
+doc = """
+usage: teuthology-reimage-fog -h
+ teuthology-reimage-fog --nodes node1,node2 --os-type distro --os-version version
+
+Reimage nodes using FOG without locking the nodes
+
+standard arguments:
+ -h, --help Show this help message and exit
+ --nodes node1,node2 List of nodes to reimage
+ --os-type <os-type> Distribution type eg: rhel, ubuntu
+ --os-version <os-version> OS version eg: 7.6, 16.04 etc
+"""
+
+
+def main(argv=sys.argv[1:]):
+ args = docopt.docopt(doc, argv=argv)
+ reimage_fog(args)
'teuthology-prune-logs = scripts.prune_logs:main',
'teuthology-describe-tests = scripts.describe_tests:main',
'teuthology-gencov = scripts.gencov:main',
+ 'teuthology-reimage-fog = scripts.reimage_fog:main'
],
},
import json
import re
import pprint
+import parallel
+
from netaddr.strategy.ipv4 import valid_str as _is_ipv4
from netaddr.strategy.ipv6 import valid_str as _is_ipv6
return searchval == val
+def reimage_fog(args):
+ """
+ Reimage FOG nodes with options specified
+ """
+ machines = args['--nodes']
+ nodes = machines.rstrip(',').split(',')
+ ctx = argparse.Namespace()
+ ctx.os_type = args['--os-type']
+ ctx.os_version = args['--os-version']
+ from teuthology.provision import reimage
+ with parallel() as p:
+ for node in nodes:
+ p.spawn(reimage, ctx, node)
+
+
def sh(command, log_limit=1024):
"""
Run the shell command and return the output in ascii (stderr and