Ignore instances in the ERROR state.

Fixes bug 1064472.

The compute pollster should not query libvirt for instances
that are ERROR'd out.

Change-Id: I8748694453ba6d9d58dc0555ed996fcd9400ad05
This commit is contained in:
Eoghan Glynn 2012-10-09 16:12:28 +01:00
parent 57f353541f
commit e4ad2ce4ad
2 changed files with 6 additions and 3 deletions

View File

@ -80,4 +80,5 @@ class AgentManager(manager.Manager):
# FIXME(dhellmann): How do we get a list of instances without
# talking directly to the database?
for instance in self.db.instance_get_all_by_host(context, self.host):
self.poll_instance(context, instance)
if instance['vm_state'] != 'error':
self.poll_instance(context, instance)

View File

@ -68,18 +68,20 @@ class TestRunTasks(base.TestCase):
# Set up a fake instance value to be returned by
# instance_get_all_by_host() so when the manager gets the list
# of instances to poll we can control the results.
self.instance = 'faux instance'
self.instance = {'name': 'faux', 'vm_state': 'active'}
stillborn_instance = {'name': 'stillborn', 'vm_state': 'error'}
self.mox.StubOutWithMock(self.mgr.db, 'instance_get_all_by_host')
self.mgr.db.instance_get_all_by_host(
None,
self.mgr.host,
).AndReturn([self.instance])
).AndReturn([self.instance, stillborn_instance])
self.mox.ReplayAll()
# Invoke the periodic tasks to call the pollsters.
self.mgr.periodic_tasks(None)
def test_message(self):
assert len(self.Pollster.counters) == 1
assert self.Pollster.counters[0][1] is self.instance
def test_notifications(self):