diff --git a/ceilometer/api/controllers/v2.py b/ceilometer/api/controllers/v2.py index 67867d63b..368d94449 100644 --- a/ceilometer/api/controllers/v2.py +++ b/ceilometer/api/controllers/v2.py @@ -897,6 +897,9 @@ class Resource(_Base): links = [Link] "A list containing a self link and associated meter links" + source = wtypes.text + "The source where the resource come from" + def __init__(self, metadata={}, **kwds): metadata = _flatten_metadata(metadata) super(Resource, self).__init__(metadata=metadata, **kwds) @@ -907,6 +910,7 @@ class Resource(_Base): project_id='35b17138-b364-4e6a-a131-8f3099c5be68', user_id='efd87807-12d2-4b38-9c70-5f5c2ac427ff', timestamp=datetime.datetime.utcnow(), + source="openstack", metadata={'name1': 'value1', 'name2': 'value2'}, links=[Link(href=('http://localhost:8777/v2/resources/' diff --git a/tests/api/v2/test_list_resources_scenarios.py b/tests/api/v2/test_list_resources_scenarios.py index 7c869dda3..06d1015dc 100644 --- a/tests/api/v2/test_list_resources_scenarios.py +++ b/tests/api/v2/test_list_resources_scenarios.py @@ -201,6 +201,8 @@ class TestListResources(FunctionalTest, }]) ids = [r['resource_id'] for r in data] self.assertEqual(['resource-id'], ids) + sources = [r['source'] for r in data] + self.assertEqual(['test_list_resources'], sources) def test_with_invalid_resource_id(self): sample1 = sample.Sample(