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:
parent
57f353541f
commit
e4ad2ce4ad
@ -80,4 +80,5 @@ class AgentManager(manager.Manager):
|
|||||||
# FIXME(dhellmann): How do we get a list of instances without
|
# FIXME(dhellmann): How do we get a list of instances without
|
||||||
# talking directly to the database?
|
# talking directly to the database?
|
||||||
for instance in self.db.instance_get_all_by_host(context, self.host):
|
for instance in self.db.instance_get_all_by_host(context, self.host):
|
||||||
|
if instance['vm_state'] != 'error':
|
||||||
self.poll_instance(context, instance)
|
self.poll_instance(context, instance)
|
||||||
|
@ -68,18 +68,20 @@ class TestRunTasks(base.TestCase):
|
|||||||
# Set up a fake instance value to be returned by
|
# Set up a fake instance value to be returned by
|
||||||
# instance_get_all_by_host() so when the manager gets the list
|
# instance_get_all_by_host() so when the manager gets the list
|
||||||
# of instances to poll we can control the results.
|
# 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.mox.StubOutWithMock(self.mgr.db, 'instance_get_all_by_host')
|
||||||
self.mgr.db.instance_get_all_by_host(
|
self.mgr.db.instance_get_all_by_host(
|
||||||
None,
|
None,
|
||||||
self.mgr.host,
|
self.mgr.host,
|
||||||
).AndReturn([self.instance])
|
).AndReturn([self.instance, stillborn_instance])
|
||||||
|
|
||||||
self.mox.ReplayAll()
|
self.mox.ReplayAll()
|
||||||
# Invoke the periodic tasks to call the pollsters.
|
# Invoke the periodic tasks to call the pollsters.
|
||||||
self.mgr.periodic_tasks(None)
|
self.mgr.periodic_tasks(None)
|
||||||
|
|
||||||
def test_message(self):
|
def test_message(self):
|
||||||
|
assert len(self.Pollster.counters) == 1
|
||||||
assert self.Pollster.counters[0][1] is self.instance
|
assert self.Pollster.counters[0][1] is self.instance
|
||||||
|
|
||||||
def test_notifications(self):
|
def test_notifications(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user