Merge "Enable trusted certificates support"

This commit is contained in:
Zuul 2018-08-06 09:36:18 +00:00 committed by Gerrit Code Review
commit 155fb10c20
4 changed files with 11 additions and 4 deletions

View File

@ -105,6 +105,7 @@ class HyperVDriver(driver.ComputeDriver):
"supports_tagged_attach_volume": True,
"supports_extend_volume": True,
"supports_multiattach": False,
"supports_trusted_certs": True,
}
def __init__(self, virtapi):

View File

@ -121,7 +121,8 @@ class ImageCache(imagecache.ImageCacheManager):
if not image_path:
try:
images.fetch(context, image_id, base_image_path)
images.fetch(context, image_id, base_image_path,
instance.trusted_certs)
if image_type == 'iso':
format_ext = 'iso'
else:

View File

@ -40,6 +40,7 @@ def fake_db_instance(**updates):
'flavor': flavorinfo,
'numa_topology': None,
'vcpu_model': None,
'trusted_certs': None,
},
'tags': [],
'services': []

View File

@ -49,7 +49,9 @@ class ImageCacheTestCase(test_base.HyperVBaseTestCase):
super(ImageCacheTestCase, self).setUp()
self.context = 'fake-context'
self.instance = fake_instance.fake_instance_obj(self.context)
self.instance = fake_instance.fake_instance_obj(
self.context,
expected_attrs=['trusted_certs'])
self.imagecache = imagecache.ImageCache()
self.tmpdir = self.useFixture(fixtures.TempDir()).path
@ -120,7 +122,8 @@ class ImageCacheTestCase(test_base.HyperVBaseTestCase):
self.assertEqual(expected_image_path, result)
mock_fetch.assert_called_once_with(self.context, self.FAKE_IMAGE_REF,
expected_path)
expected_path,
self.instance.trusted_certs)
self.imagecache._vhdutils.get_vhd_format.assert_called_once_with(
expected_path)
self.imagecache._pathutils.rename.assert_called_once_with(
@ -178,7 +181,8 @@ class ImageCacheTestCase(test_base.HyperVBaseTestCase):
mock_fetch.assert_called_once_with(self.context,
fake_rescue_image_id,
expected_path)
expected_path,
self.instance.trusted_certs)
self.imagecache._vhdutils.get_vhd_info.assert_called_once_with(
expected_vhd_path)