Merge lp:~vila/ubuntu-ci-services-itself/1287955-flavors-config-option into lp:ubuntu-ci-services-itself

Proposed by Vincent Ladeuil
Status: Merged
Approved by: Vincent Ladeuil
Approved revision: 316
Merged at revision: 325
Proposed branch: lp:~vila/ubuntu-ci-services-itself/1287955-flavors-config-option
Merge into: lp:ubuntu-ci-services-itself
Diff against target: 126 lines (+42/-16)
3 files modified
juju-deployer/configs/unit_config.yaml.tmpl (+3/-0)
test_runner/tstrun/run_worker.py (+5/-5)
test_runner/tstrun/testbed.py (+34/-11)
To merge this branch: bzr merge lp:~vila/ubuntu-ci-services-itself/1287955-flavors-config-option
Reviewer Review Type Date Requested Status
Francis Ginther Approve
PS Jenkins bot (community) continuous-integration Approve
Chris Johnston (community) Needs Fixing
Review via email: mp+209619@code.launchpad.net

Commit message

Provide a config option to select the nova flavor for the testbed.

Description of the change

This adds a 'tr_flavors' config option in unit_config that describes the various flavors that the testbed should try to create a nova instance.

This defaults to 'm1.small' for canonistack and 'standard.small' for hpcloud.

While I removed a FIXME doing so, I filed 2 additional bugs:
- bug #1288622 local testing requires floating-ip on hpcloud
- bug #1288617 testbed nova instance flavor selection

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:315
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~vila/ubuntu-ci-services-itself/1287955-flavors-config-option/+merge/209619/+edit-commit-message

http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/304/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/304/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
Chris Johnston (cjohnston) wrote :

According to LP:

Diff against target: 134 lines (+50/-16) 3 files modified (has conflicts)
Text conflict in test_runner/tstrun/testbed.py

review: Needs Fixing
316. By Vincent Ladeuil

Merge trunk resolving conflicts

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:316
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/307/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/307/rebuild

review: Approve (continuous-integration)
Revision history for this message
Francis Ginther (fginther) wrote :

Looks reasonable.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'juju-deployer/configs/unit_config.yaml.tmpl'
2--- juju-deployer/configs/unit_config.yaml.tmpl 2014-03-03 20:43:25 +0000
3+++ juju-deployer/configs/unit_config.yaml.tmpl 2014-03-06 13:59:27 +0000
4@@ -20,3 +20,6 @@
5 base_image: "http://cloud-images.ubuntu.com/releases/13.10/release-20131015/ubuntu-13.10-server-cloudimg-amd64-disk1.img"
6 series: saucy
7 master_ppa: $CI_MASTER_PPA
8+tr_flavors:
9+ - m1.small
10+ - standard.small
11
12=== modified file 'test_runner/tstrun/run_worker.py'
13--- test_runner/tstrun/run_worker.py 2014-03-05 11:20:09 +0000
14+++ test_runner/tstrun/run_worker.py 2014-03-06 13:59:27 +0000
15@@ -42,6 +42,8 @@
16 package_list = params['package_list']
17 amqp_utils.progress_update(progress_queue, params)
18
19+ conf = tstrun.get_auth_config()
20+
21 def status_cb(msg):
22 amqp_utils.progress_update(progress_queue, {'message': msg})
23
24@@ -50,12 +52,10 @@
25 results = {}
26 try:
27 test_bed = None
28- store = data_store.create_for_ticket(ticket, tstrun.get_auth_config())
29- # FIXME: We need either a config option or a parameter for the instance
30- # flavor -- vila 2014-01-29
31- flavor = 'm1.small'
32+ store = data_store.create_for_ticket(ticket, conf)
33+ flavors = conf['tr_flavors']
34 test_bed = testbed.TestBed('testbed-{}'.format(progress_queue),
35- flavor, image_id, status_cb)
36+ flavors, image_id, status_cb)
37 test_bed.setup()
38
39 # FIXME: There is a potentially confusing failure mode here: by reusing
40
41=== modified file 'test_runner/tstrun/testbed.py'
42--- test_runner/tstrun/testbed.py 2014-03-05 11:20:19 +0000
43+++ test_runner/tstrun/testbed.py 2014-03-06 13:59:27 +0000
44@@ -21,7 +21,7 @@
45 import time
46 import yaml
47
48-
49+from novaclient import exceptions
50 from novaclient.v1_1 import client
51
52 import tstrun
53@@ -112,12 +112,12 @@
54
55 class TestBed(object):
56
57- def __init__(self, name, flavor, image, status_cb, auth_conf=None):
58+ def __init__(self, name, flavors, image, status_cb, auth_conf=None):
59 if auth_conf is None:
60 auth_conf = tstrun.get_auth_config()
61 self.auth_conf = auth_conf
62 self.name = name
63- self.flavor = flavor
64+ self.flavors = flavors
65 self.image = image
66 self.status_cb = status_cb
67 self.instance = None
68@@ -171,14 +171,26 @@
69 self.cloud_init_completion_message = ud.cloud_config['final_message']
70 self.user_data = ud.dump()
71
72+ def find_flavor(self):
73+ for flavor in self.flavors:
74+ try:
75+ return self.nova.flavors.find(name=flavor)
76+ except exceptions.NotFound:
77+ pass
78+ # MISSINGTEST: some cloud doesn't provide one of our expected flavors
79+ # -- vila 2014-01-06
80+ raise NovaClientException(
81+ 'None of {} can be found'.format(self.flavors))
82+
83 def setup(self):
84- # MISSINGTEST: flavors.find can raise HTTP 503 ? -- vila 2014-01-30
85- flavor = self.nova.flavors.find(name=self.flavor)
86+ flavor = self.find_flavor()
87 image = self.nova.images.find(name=self.image)
88 self.create_user_data()
89 self.instance = self.nova.servers.create(
90 name=self.name, flavor=flavor, image=image,
91 userdata=self.user_data, keypair=self.nova_ssh_key_name)
92+ # FIXME: This times out for hpcloud because it requires a floating ip
93+ # for the instance see http://pad.lv/1288622 -- vila 2014-03-06
94 self.wait_for_ip()
95 self.wait_for_cloud_init()
96
97@@ -296,12 +308,23 @@
98 # 'auth_testbed_sshkey' can be defined there if you don't use ~/.ssh/id_rsa.
99
100 def test_print_ip():
101- # The following image can be used if needed for precise testing
102- # precise_image = ('ubuntu-released/ubuntu-precise-12.04'
103- # '-amd64-server-20131205-disk1.img')
104- saucy_image = ('ubuntu-released/ubuntu-saucy-13.10'
105- '-amd64-server-20140212-disk1.img')
106- test_bed = TestBed('vila1', 'm1.small', saucy_image,
107+ conf = tstrun.get_auth_config()
108+ # The following images are "known" to work when they are added while
109+ # testing manually. In general, they need to be updated because they
110+ # disappear to be replaced by newer ones. They also vary depending on
111+ # whether canonistack or hpcloud is used.
112+ test_images = dict(
113+ cs_precise=('ubuntu-released/ubuntu-precise-12.04'
114+ '-amd64-server-20131205-disk1.img'),
115+ cs_saucy=('ubuntu-released/ubuntu-saucy-13.10'
116+ '-amd64-server-20140212-disk1.img'),
117+ hp_precise=('Ubuntu Server 12.04.4 LTS (amd64 20140227)'
118+ ' - CI Engineering'),
119+ hp_saucy=('Ubuntu Server 13.10 (amd64 20131030) - Partner Image'),
120+ )
121+ test_bed = TestBed('localtest',
122+ conf['tr_flavors'],
123+ test_images['hp_saucy'],
124 lambda x: None)
125 test_bed.setup()
126 print 'cloud-init user-data: {}'.format(test_bed.user_data)

Subscribers

People subscribed via source and target branches