Merge "Add attribute 'state' to meter metadata when source is polling"
This commit is contained in:
commit
72eb6985c4
@ -41,6 +41,7 @@ def _get_metadata_from_object(instance):
|
||||
'host': instance.hostId,
|
||||
'flavor': instance.flavor,
|
||||
'status': instance.status.lower(),
|
||||
'state': getattr(instance, 'OS-EXT-STS:vm_state', u''),
|
||||
}
|
||||
|
||||
# Image properties
|
||||
|
@ -30,6 +30,8 @@ class TestPollsterBase(base.BaseTestCase):
|
||||
self.instance.name = 'instance-00000001'
|
||||
setattr(self.instance, 'OS-EXT-SRV-ATTR:instance_name',
|
||||
self.instance.name)
|
||||
setattr(self.instance, 'OS-EXT-STS:vm_state',
|
||||
'active')
|
||||
self.instance.id = 1
|
||||
self.instance.flavor = {'name': 'm1.small', 'id': 2, 'vcpus': 1,
|
||||
'ram': 512, 'disk': 20, 'ephemeral': 0}
|
||||
|
@ -40,6 +40,7 @@ class TestInstancePollster(base.TestPollsterBase):
|
||||
self.assertEqual(20, samples[0].resource_metadata['root_gb'])
|
||||
self.assertEqual(0, samples[0].resource_metadata['ephemeral_gb'])
|
||||
self.assertEqual('active', samples[0].resource_metadata['status'])
|
||||
self.assertEqual('active', samples[0].resource_metadata['state'])
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def test_get_reserved_metadata_with_keys(self):
|
||||
|
Loading…
Reference in New Issue
Block a user