summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2015-09-11 10:09:33 +0100
committerMichael Drake <michael.drake@codethink.co.uk>2015-09-11 15:01:30 +0100
commit168fe14060aebfa5639819892ba1d403ac63cf22 (patch)
tree2147c46b25b02846d20a5cd23e42ce5e201045d0
parent4c20a71c5321e4347a7f4f0aee620b29a83779ac (diff)
downloadciat-tester-168fe14060aebfa5639819892ba1d403ac63cf22.tar.gz
Allow flavour to be passed on CLI.
-rwxr-xr-xopenstack/tester30
1 files changed, 18 insertions, 12 deletions
diff --git a/openstack/tester b/openstack/tester
index 1cfaf34..3add6c5 100755
--- a/openstack/tester
+++ b/openstack/tester
@@ -158,10 +158,11 @@ class DeployedSystemInstance(object):
class Deployment(object):
- def __init__(self, host_machine, net_id, image_file):
+ def __init__(self, host_machine, net_id, image_file, flavour):
self.host_machine = host_machine
self.net_id = net_id
self.image_file = image_file
+ self.flavour = flavour
@staticmethod
def _ssh_host_key_exists(hostname):
@@ -207,7 +208,7 @@ class Deployment(object):
# TODO: Ensure this is cleaned up when something raises an exception
# TODO: use python-novaclient
args = ['nova', 'boot',
- '--flavor', 'm1.medium',
+ '--flavor', self.flavour,
'--image', hostname,
#'--user-data', '/usr/lib/mason/os-init-script',
'--nic', "net-id=%s" % (self.net_id),
@@ -269,6 +270,10 @@ class ReleaseApp(cliapp.Application):
'Path to system image to test',
default=None,
group=group_main)
+ self.settings.string(['flavour'],
+ 'Name of flavour to use for instance',
+ default=None,
+ group=group_main)
def run_tests(self, instance):
instance.wait_until_online()
@@ -291,10 +296,16 @@ class ReleaseApp(cliapp.Application):
for test in tests:
test(instance)
- def deploy_and_test_systems(self, host_machine, net_id, image_file):
+ def deploy_and_test_systems(self):
"""Run the deployments and tests"""
- deployment = Deployment(host_machine, net_id, image_file)
+ # TODO: Don't assume root is the user we ssh to for tests
+ host_machine = VMHost('root', self.settings['os-host'])
+
+ deployment = Deployment(host_machine,
+ self.settings['net-id'],
+ self.settings['image-file'],
+ self.settings['flavour'])
instance = deployment.deploy()
try:
@@ -304,18 +315,13 @@ class ReleaseApp(cliapp.Application):
def process_args(self, args):
"""Process the command line args and kick off the builds/tests"""
- for setting in ('os-host', 'net-id', 'image-file'):
+ for setting in ('os-host', 'net-id', 'image-file', 'flavour'):
self.settings.require(setting)
- # TODO: Don't assume root is the user we ssh to for tests
- host_machine = VMHost('root', self.settings['os-host'])
-
if len(args) != 0:
raise cliapp.AppException(
- 'Usage: release-test-os --os-host <HOST> --net-id <ID> --image-file <PATH>')
- self.deploy_and_test_systems(host_machine,
- self.settings['net-id'],
- self.settings['image-file'])
+ 'Usage: release-test-os --os-host <HOST> --net-id <ID> --image-file <PATH> --flavour <NAME>')
+ self.deploy_and_test_systems()
if __name__ == '__main__':