Expose 'host' field via image API

The 'host' field has been added to image table [1] and this
commit expose this field via REST API so that API users can
consume this field.

[1] https://review.openstack.org/#/c/592871/

Change-Id: Ia5e38a049770ccacc8aa91d611129d3b42315549
This commit is contained in:
Hongbin Lu 2018-10-19 03:04:04 +00:00
parent c90642c4b2
commit f6daf3ed08
2 changed files with 6 additions and 1 deletions

View File

@ -23,7 +23,8 @@ _basic_keys = (
'tag',
'size',
'project_id',
'image_pull_policy'
'image_pull_policy',
'host'
)

View File

@ -125,6 +125,8 @@ class TestImageController(api_base.FunctionalTest):
self.assertEqual(1, len(actual_images))
self.assertEqual(test_image['uuid'],
actual_images[0].get('uuid'))
self.assertEqual(test_image['host'],
actual_images[0].get('host'))
@patch('zun.common.policy.enforce')
@patch('zun.objects.Image.get_by_uuid')
@ -141,6 +143,8 @@ class TestImageController(api_base.FunctionalTest):
self.assertEqual(200, response.status_int)
self.assertEqual(test_image['uuid'],
response.json['uuid'])
self.assertEqual(test_image['host'],
response.json['host'])
@mock.patch('zun.common.policy.enforce', return_value=True)
@patch('zun.objects.Image.list')