hardware: Use image_meta.id within get_mem_encryption_constraint
This change resolves bug #1928063 by replacing the use of image_meta.name with image_meta.id as I55d66c3a6cbd50da90065f4a58f77b5cd29ce9ea should ensure it is always available. The removal of other references to image_meta.name within virt.hardware is left for follow ups to keep this change small and backportable. Closes-Bug: #1928063 Change-Id: I66299e97bdb5b95e149b1780231a1c1bbdbd9865
This commit is contained in:
@@ -17,7 +17,6 @@ from oslo_utils.fixture import uuidsentinel as uuids
|
||||
|
||||
from nova import test
|
||||
from nova.tests.fixtures import libvirt as fakelibvirt
|
||||
from nova.tests.functional.api import client
|
||||
from nova.tests.functional.libvirt import base
|
||||
from nova.virt.libvirt.host import SEV_KERNEL_PARAM_FILE
|
||||
|
||||
@@ -58,12 +57,5 @@ class TestSEVInstanceReboot(base.ServersTestBase):
|
||||
networks='none'
|
||||
)
|
||||
|
||||
# FIXME(lyarwood): This is bug #1928063, the instance fails to reboot
|
||||
# due to a NotImplementedError exception being raised when we try to
|
||||
# access image_meta.name as this isn't stashed in the system_metadata
|
||||
# of the instance and as a result is not provided in the image_meta
|
||||
# associated with the instance during this flow.
|
||||
ex = self.assertRaises(
|
||||
client.OpenStackApiException,
|
||||
self._reboot_server, server, hard=True)
|
||||
self.assertEqual(500, ex.response.status_code)
|
||||
# Hard reboot the server
|
||||
self._reboot_server(server, hard=True)
|
||||
|
@@ -5421,7 +5421,7 @@ class MemEncryptionRequestedWithoutUEFITestCase(
|
||||
for image_prop in ('1', 'true', 'True'):
|
||||
self._test_encrypted_memory_support_no_uefi(
|
||||
None, image_prop,
|
||||
"hw_mem_encryption property of image %s" % self.image_name)
|
||||
"hw_mem_encryption property of image %s" % self.image_id)
|
||||
|
||||
def test_flavor_image_require_encrypted_memory_support_no_uefi(self):
|
||||
for extra_spec in ('1', 'true', 'True'):
|
||||
@@ -5430,7 +5430,7 @@ class MemEncryptionRequestedWithoutUEFITestCase(
|
||||
extra_spec, image_prop,
|
||||
"hw:mem_encryption extra spec in %s flavor and "
|
||||
"hw_mem_encryption property of image %s"
|
||||
% (self.flavor_name, self.image_name))
|
||||
% (self.flavor_name, self.image_id))
|
||||
|
||||
|
||||
class MemEncryptionRequestedWithInvalidMachineTypeTestCase(
|
||||
@@ -5508,7 +5508,7 @@ class MemEncryptionRequiredTestCase(test.NoDBTestCase):
|
||||
self._test_encrypted_memory_support_required(
|
||||
{},
|
||||
{'hw_mem_encryption': image_prop},
|
||||
"hw_mem_encryption property of image %s" % self.image_name
|
||||
"hw_mem_encryption property of image %s" % self.image_id
|
||||
)
|
||||
|
||||
def test_require_encrypted_memory_support_both_required(self):
|
||||
@@ -5519,7 +5519,7 @@ class MemEncryptionRequiredTestCase(test.NoDBTestCase):
|
||||
{'hw_mem_encryption': image_prop},
|
||||
"hw:mem_encryption extra spec in %s flavor and "
|
||||
"hw_mem_encryption property of image %s" %
|
||||
(self.flavor_name, self.image_name)
|
||||
(self.flavor_name, self.image_id)
|
||||
)
|
||||
|
||||
|
||||
|
@@ -1313,7 +1313,7 @@ def get_mem_encryption_constraint(
|
||||
flavor.name)
|
||||
if image_mem_enc:
|
||||
requesters.append("hw_mem_encryption property of image %s" %
|
||||
image_meta.name)
|
||||
image_meta.id)
|
||||
|
||||
_check_mem_encryption_uses_uefi_image(requesters, image_meta)
|
||||
_check_mem_encryption_machine_type(image_meta, machine_type)
|
||||
|
Reference in New Issue
Block a user