Merge lp:~ev/uci-engine/find-wrong-flavor-usage into lp:uci-engine

Proposed by Evan
Status: Needs review
Proposed branch: lp:~ev/uci-engine/find-wrong-flavor-usage
Merge into: lp:uci-engine
Diff against target: 45 lines (+41/-0)
1 file modified
bin/find_wrong_flavor_usage.py (+41/-0)
To merge this branch: bzr merge lp:~ev/uci-engine/find-wrong-flavor-usage
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Vincent Ladeuil (community) Approve
Review via email: mp+242857@code.launchpad.net

Commit message

A small program to find wrong flavor usage.

Description of the change

./bin/find_wrong_flavor_usage.py
e8c643d5-fbe7-4698-87c1-7fac37625925 | juju-ci-engine-demo-machine-16 | gramm | m1.smaller
c18d283c-b9dd-41b7-979a-a3dd18be18cb | juju-ci-engine-demo-machine-15 | berliet | m1.smaller
b82402c7-a255-4a24-bbbe-a415a8e9a8a5 | juju-ci-engine-demo-machine-14 | lawter | m1.smaller
77cb8983-ea62-47a9-a8d9-aa8e35988b42 | juju-ci-engine-demo-machine-13 | beggs | m1.smaller
2a842d3e-8156-4e89-9326-69df9f7192bb | juju-ci-engine-demo-machine-12 | gramm | m1.smaller
58d0fc62-5cf1-4feb-bcd7-96f6258b7382 | juju-ci-engine-demo-machine-11 | berliet | m1.smaller
68ede383-d836-40f1-b75b-790cb4c920d6 | juju-ci-engine-demo-machine-10 | lawter | m1.smaller
5fa72eaf-c779-4e56-9a69-0c5adb1e1259 | juju-ci-engine-demo-machine-9 | berliet | m1.smaller
6b11f550-d42c-4a1f-aec3-8e607d400c89 | juju-ci-engine-demo-machine-8 | beggs | m1.smaller
6cb6bd71-fd8b-4a1d-8c2c-bf0691daae41 | juju-ci-engine-demo-machine-7 | lawter | m1.smaller
3e0f9941-d151-4499-a4ec-63160f7a3c8f | juju-ci-engine-demo-machine-6 | beggs | m1.smaller
d3f6473b-ad6c-4323-9964-b9b974e34db3 | juju-ci-engine-demo-machine-5 | gramm | m1.smaller
d6acf606-f811-46b2-856c-a101bd3329d5 | juju-ci-engine-demo-machine-4 | berliet | m1.smaller
0e12c0ba-66f7-442e-bf5f-3332eb74692b | juju-ci-engine-demo-machine-3 | berliet | m1.smaller
4b14a52e-689f-445e-b117-2575592c5a49 | juju-ci-engine-demo-machine-2 | berliet | m1.smaller
157c8393-ecad-4f47-ad38-96aa221ba738 | juju-ci-engine-demo-machine-1 | berliet | m1.smaller
d729e528-f7a8-4b40-bb82-34069b1dfd42 | juju-ci-engine-demo-machine-0 | berliet | m1.smaller
9ad3c85c-3766-4e2d-83eb-091e1135105a | juju-uci-britney-machine-22 | berliet | m1.smaller
213a6147-ccda-48e0-aaa3-dd4ebc892bae | juju-uci-britney-machine-21 | lawter | m1.smaller
cf354457-4544-4951-a496-1ba41150e736 | juju-uci-britney-machine-20 | berliet | m1.smaller
9cc6a010-5390-42db-a9f0-b930f51f7b95 | juju-uci-britney-machine-19 | berliet | m1.smaller
13f3b2e4-c791-4bfa-aee4-26bdecc17bce | juju-uci-britney-machine-0 | beggs | m1.smaller
a3cd2e46-9302-4905-b771-8ba501833f58 | juju-jenkins-stack-machine-17 | lawter | m1.medium

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

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

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

review: Approve (continuous-integration)
Revision history for this message
Vincent Ladeuil (vila) wrote :

Too bad it requires admin privileges ;)

But better hosting it here that nowhere.

review: Approve
Revision history for this message
Evan (ev) wrote :

Yeah, I'm trying to follow what we did for the Error Tracker where we dumped all our utility scripts in the branch and shared in the benefit. Desperately trying to avoid it becoming unclear what the individual scripts did, thus the verbose name and cover letter in the script itself.

Revision history for this message
Vincent Ladeuil (vila) wrote :

>>>>> Evan Dandrea <email address hidden> writes:

    > Yeah, I'm trying to follow what we did for the Error Tracker where we dumped
    > all our utility scripts in the branch and shared in the benefit. Desperately
    > trying to avoid it becoming unclear what the individual scripts did, thus
    > the verbose name and cover letter in the script itself.

Well done, +42

I should do the same with some cleaner scripts I wrote for uci-britney.

They are under version control already but mixed with "monitoring" data
I either injected in or extracted from uci-britney.

Offline work ftw ;)

Revision history for this message
Ubuntu CI Bot (uci-bot) wrote :
Download full text (118.2 KiB)

The attempt to merge lp:~ev/uci-engine/find-wrong-flavor-usage into lp:uci-engine failed. Below is the output from the failed tests.

Running cm...
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
Updating source dependencies...
uploading webui-content.tgz to swift
Updating source dependencies...
Checking juju status
Private PPAs: disabled
Preparing local branch upload...
Uploading local branch, fingerprint 596e464fdf1cafd2923de41f56a24ea9e94f53e3
Building charm: lander
Building charm: wsgi-app
Building charm: rabbitmq-worker
Building charm: chroot-builder
Building charm: key-secret-subordinate
Building charm: webui
Building charm: system-image-server
Installing keys from bzr+ssh://bazaar.launchpad.net/~ci-engineering-private/+junk/ci-airline-dev-keys/
Running juju-deployer -v -c /tmp/tmp4fP8Mm/deployer/relations.yaml -c /tmp/tmp4fP8Mm/deployer/services.yaml ci-airline
Tests running...
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testConnectFailed ... OK (0.001 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testProcessQueue ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testRunForever ... OK (0.102 secs)
ci-utils.ci_utils.tests.test_amqp.TestAMQP.testSent ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp.TestProgressTrigger.testProgress ... OK (0.001 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testCancel ... OK (0.104 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testNoQueue ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testNoTicket ... OK (0.003 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageCalledProcessError ... OK (0.005 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageFail ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageKilled ... OK (0.003 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageSimple ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testOnMessageUnexpected ... OK (0.003 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestAMQPWorker.testSaveLastRun ... OK (0.001 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestTimer.testCBRuns ... OK (0.021 secs)
ci-utils.ci_utils.tests.test_amqp_worker.TestTimer.testCanCancel ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreConfig.test_invalid_auth_config ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreConfig.test_valid_auth_config ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreFileName.test_abspath ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreFileName.test_basename ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_data_store.TestDataStoreFileName.test_relpath ... OK (0.000 secs)
ci-utils.ci_utils.tests.test_deployer.TestDeployer.test_load_empty_single_config ... OK (0.002 secs)
ci-utils.ci_utils.tests.test_deployer.TestDeployer.test_load_multiple_config ... OK (0.027 secs)
ci-utils.ci_utils.tests.test_deployer.TestDeployer.test_load_single_config ... OK (...

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

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

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

review: Approve (continuous-integration)

Unmerged revisions

904. By Evan

Clarifying comments.

903. By Evan

+x

902. By Evan

A small program to find wrong flavor usage.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'bin/find_wrong_flavor_usage.py'
2--- bin/find_wrong_flavor_usage.py 1970-01-01 00:00:00 +0000
3+++ bin/find_wrong_flavor_usage.py 2014-11-26 09:27:50 +0000
4@@ -0,0 +1,41 @@
5+#!/usr/bin/env python
6+#
7+# This program finds instances running in the production AZ that are using the
8+# wrong flavor type (production flavors have an explicit CPU overcommit set to
9+# 1.0, nova flavors do not). It needs to be run with OpenStack admin
10+# credentials.
11+
12+from novaclient.v1_1 import client
13+import os
14+import sys
15+
16+
17+def main():
18+ args = (os.environ['OS_USERNAME'], os.environ['OS_PASSWORD'],
19+ os.environ['OS_TENANT_NAME'], os.environ['OS_AUTH_URL'])
20+ nova_client = client.Client(*args)
21+ # Give me all the instances (admin only).
22+ # is_public is ternary - None means give all flavors.
23+ flavors = {fla.id: fla for fla in nova_client.flavors.list(is_public=None)}
24+ opts = {'all_tenants': True, 'status': 'ACTIVE'}
25+ for server in nova_client.servers.list(search_opts=opts):
26+ host = getattr(server, 'OS-EXT-SRV-ATTR:hypervisor_hostname')
27+ # hostname.bot-prototype
28+ host = host.split('.')[0]
29+ if host in ('beggs', 'berliet', 'gramm', 'lawter'):
30+ flavor_id = server.flavor['id']
31+ try:
32+ flavor = flavors[flavor_id]
33+ except KeyError:
34+ # Nova is strange.
35+ flavors[flavor_id] = nova_client.flavors.get(flavor_id)
36+ flavor = flavors[flavor_id]
37+
38+ if 'prod' not in flavor.name:
39+ args = server.id, server.name, host, flavor.name
40+ print ' | '.join(args)
41+ return 0
42+
43+
44+if __name__ == '__main__':
45+ sys.exit(main())

Subscribers

People subscribed via source and target branches

to all changes: