forked from H3C/teuthology
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Zack Cerza <[email protected]>
- Loading branch information
Zack Cerza
committed
Nov 25, 2014
1 parent
f84662b
commit a19e1cf
Showing
5 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/usr/bin/env python | ||
# A sample script that can be used while setting up a new teuthology lab | ||
# This script will connect to the machines in your lab, and populate a | ||
# paddles instance with their information. | ||
# | ||
# You WILL need to modify it. | ||
|
||
import logging | ||
import sys | ||
from teuthology.orchestra.remote import Remote | ||
from teuthology.lock import update_inventory | ||
paddles_url = 'http://pulpito.example.com:8080/nodes/' | ||
|
||
machine_type = 'magna' | ||
lab_domain = 'example.com' | ||
user = 'ubuntu' | ||
# We are populating 'magna003' -> 'magna122' | ||
machine_index_range = range(3, 123) | ||
|
||
log = logging.getLogger(sys.argv[0]) | ||
logging.getLogger("requests.packages.urllib3.connectionpool").setLevel( | ||
logging.WARNING) | ||
|
||
|
||
def get_shortname(machine_type, index): | ||
""" | ||
Given a number, return a hostname. Example: | ||
get_shortname('magna', 3) = 'magna003' | ||
Modify to suit your needs. | ||
""" | ||
return machine_type + str(index).rjust(3, '0') | ||
|
||
|
||
def get_info(user, fqdn): | ||
remote = Remote('@'.join((user, fqdn))) | ||
return remote.inventory_info | ||
|
||
def main(): | ||
shortnames = [get_shortname(machine_type, i) for i in range(3, 123)] | ||
fqdns = ['.'.join((name, lab_domain)) for name in shortnames] | ||
for fqdn in fqdns: | ||
log.info("Creating %s", fqdn) | ||
try: | ||
info = get_info(user, fqdn) | ||
except Exception: | ||
info = dict( | ||
name=fqdn, | ||
up=False, | ||
) | ||
info.update(dict( | ||
locked=True, | ||
locked_by='initial@setup', | ||
machine_type=machine_type, | ||
description="Initial node creation", | ||
)) | ||
update_inventory(info) | ||
|
||
if __name__ == '__main__': | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
server { | ||
server_name paddles.example.com; | ||
proxy_send_timeout 600; | ||
proxy_connect_timeout 240; | ||
location / { | ||
proxy_pass http://paddles.example.com:8080/; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
server { | ||
server_name pulpito.example.com; | ||
proxy_send_timeout 600; | ||
proxy_connect_timeout 240; | ||
location / { | ||
proxy_pass http://pulpito.example.com:8081/; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
server { | ||
allow all; | ||
autoindex on; | ||
server_name test_logs.example.com; | ||
root /home/teuthworker/archive; | ||
default_type text/plain; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# A simple script used by Red Hat to start teuthology-worker processes. | ||
|
||
ARCHIVE=$HOME/archive | ||
WORKER_LOGS=$ARCHIVE/worker_logs | ||
|
||
function start_workers_for_tube { | ||
echo "Starting $2 workers for $1" | ||
for i in `seq 1 $2` | ||
do | ||
teuthology-worker -v --archive-dir $ARCHIVE --tube $1 --log-dir $WORKER_LOGS & | ||
done | ||
} | ||
|
||
function start_all { | ||
start_workers_for_tube plana 50 | ||
start_workers_for_tube mira 50 | ||
start_workers_for_tube vps 80 | ||
start_workers_for_tube burnupi 10 | ||
start_workers_for_tube tala 5 | ||
start_workers_for_tube saya 10 | ||
start_workers_for_tube multi 100 | ||
} | ||
|
||
function main { | ||
echo "$@" | ||
if [[ -z "$@" ]] | ||
then | ||
start_all | ||
elif [ ! -z "$2" ] && [ "$2" -gt "0" ] | ||
then | ||
start_workers_for_tube $1 $2 | ||
else | ||
echo "usage: $0 [tube_name number_of_workers]" >&2 | ||
exit 1 | ||
fi | ||
} | ||
|
||
main $@ |