Merge lp:~allenap/maas/power-poll-fewer--bug-1389007 into lp:maas/trunk

Proposed by Gavin Panella
Status: Merged
Approved by: Gavin Panella
Approved revision: 3420
Merged at revision: 4076
Proposed branch: lp:~allenap/maas/power-poll-fewer--bug-1389007
Merge into: lp:maas/trunk
Diff against target: 1586 lines (+998/-184)
16 files modified
HACKING.txt (+9/-3)
src/maasserver/migrations/0150_power_parameters_and_state_updated_field.py (+515/-0)
src/maasserver/models/node.py (+13/-3)
src/maasserver/models/tests/test_node.py (+8/-0)
src/maasserver/models/timestampedmodel.py (+1/-0)
src/maasserver/rpc/nodes.py (+88/-22)
src/maasserver/rpc/tests/test_nodes.py (+133/-22)
src/maasserver/rpc/tests/test_regionservice.py (+9/-2)
src/maasserver/testing/factory.py (+23/-9)
src/maasserver/websockets/handlers/device.py (+1/-0)
src/maasserver/websockets/handlers/node.py (+3/-0)
src/provisioningserver/pserv_services/node_power_monitor_service.py (+31/-39)
src/provisioningserver/pserv_services/tests/test_node_power_monitor_service.py (+35/-47)
src/provisioningserver/rpc/power.py (+45/-32)
src/provisioningserver/rpc/region.py (+10/-5)
src/provisioningserver/rpc/tests/test_power.py (+74/-0)
To merge this branch: bzr merge lp:~allenap/maas/power-poll-fewer--bug-1389007
Reviewer Review Type Date Requested Status
Gavin Panella (community) Approve
Review via email: mp+263550@code.launchpad.net

This proposal supersedes a proposal from 2014-11-24.

Commit message

Query node power states in smaller batches.

Description of the change

Big diff because migrations!

This branch was previously reviewed by Graham Binns, and approved. It
has changed only a little since then, but I'd appreciate a sanity check
before I land it.

This branch adds a power_state_updated field to Node, which records when
the power state was last checked, regardless of success or failure. It's
a simple way to rate-limit checks.

The reason it's needed is because ListNodePowerParameters now only
returns a subset of all queryable nodes (at least for a large
installation). Each time it's called it returns a list of those nodes
that need checking *in priority order*. Nodes that have never had their
power state checked are done first, then the ones that have been queried
least recently.

We /could/ later use this new field to trigger an immediate check via
the API or UI; set it to NULL and it'll be in the next set of checks.
That's a bit of an abuse though.

In any case, this branch is meant to be a most-bang-for-the-least-buck
kind of thing. It doesn't back us into a corner, but does solve the
immediate problem in what I hope is an elegant and effective way.

Thanks!

To post a comment you must log in.
Revision history for this message
Graham Binns (gmb) wrote : Posted in a previous version of this proposal

LGTM. I have some questions and concerns, but nothing to hold the branch back.

review: Approve
Revision history for this message
Gavin Panella (allenap) wrote : Posted in a previous version of this proposal

Ta muchly!

Revision history for this message
MAAS Lander (maas-lander) wrote : Posted in a previous version of this proposal
Download full text (4.6 MiB)

The attempt to merge lp:~allenap/maas/power-poll-fewer--bug-1389007 into lp:maas failed. Below is the output from the failed tests.

Ign http://security.ubuntu.com trusty-security InRelease
Get:1 http://security.ubuntu.com trusty-security Release.gpg [933 B]
Ign http://nova.clouds.archive.ubuntu.com trusty InRelease
Get:2 http://security.ubuntu.com trusty-security Release [62.0 kB]
Ign http://nova.clouds.archive.ubuntu.com trusty-updates InRelease
Hit http://nova.clouds.archive.ubuntu.com trusty Release.gpg
Get:3 http://nova.clouds.archive.ubuntu.com trusty-updates Release.gpg [933 B]
Hit http://nova.clouds.archive.ubuntu.com trusty Release
Get:4 http://nova.clouds.archive.ubuntu.com trusty-updates Release [62.0 kB]
Get:5 http://security.ubuntu.com trusty-security/main Sources [51.5 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty/main Sources
Get:6 http://security.ubuntu.com trusty-security/universe Sources [17.4 kB]
Get:7 http://security.ubuntu.com trusty-security/main amd64 Packages [162 kB]
Get:8 http://security.ubuntu.com trusty-security/universe amd64 Packages [72.6 kB]
Hit http://security.ubuntu.com trusty-security/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Sources
Hit http://security.ubuntu.com trusty-security/universe Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/main amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/universe amd64 Packages
Hit http://nova.clouds.archive.ubuntu.com trusty/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en
Get:9 http://nova.clouds.archive.ubuntu.com trusty-updates/main Sources [142 kB]
Get:10 http://nova.clouds.archive.ubuntu.com trusty-updates/universe Sources [91.8 kB]
Get:11 http://nova.clouds.archive.ubuntu.com trusty-updates/main amd64 Packages [367 kB]
Get:12 http://nova.clouds.archive.ubuntu.com trusty-updates/universe amd64 Packages [220 kB]
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/main Translation-en
Hit http://nova.clouds.archive.ubuntu.com trusty-updates/universe Translation-en
Ign http://nova.clouds.archive.ubuntu.com trusty/main Translation-en_US
Ign http://nova.clouds.archive.ubuntu.com trusty/universe Translation-en_US
Fetched 1,250 kB in 2s (437 kB/s)
Reading package lists...
sudo DEBIAN_FRONTEND=noninteractive apt-get -y \
     --no-install-recommends install apache2 authbind bind9 bind9utils build-essential bzr-builddeb curl daemontools debhelper dh-apport distro-info dnsutils firefox freeipmi-tools gjs ipython isc-dhcp-common libjs-raphael libjs-yui3-full libjs-yui3-min libpq-dev make pep8 postgresql pyflakes python-amqplib python-bzrlib python-celery python-convoy python-crochet python-cssselect python-curtin python-dev python-distro-info python-django python-django-piston python-django-south python-djorm-ext-pgarray python-docutils python-extras python-fixtures python-flake8 python-formencode python-hivex python-httplib2 python-jinja2 python-jsonschema python-lockfile python-lxml python-mimeparse python-mock python-netaddr python-netifaces python-nose python-oauth python-oops python-oops-amqp python-oops-datedir-repo python-oops-twisted python-oops-wsgi ...