Merge "libvirt: check for AMD SEV only on x86-64"
This commit is contained in:
commit
97729aabaa
@ -1342,6 +1342,21 @@ class TestLibvirtSEVUnsupported(TestLibvirtSEV):
|
||||
def test_unsupported_with_feature(self, fake_exists):
|
||||
self.assertFalse(self.host.supports_amd_sev)
|
||||
|
||||
def test_non_x86_architecture(self):
|
||||
fake_caps_xml = '''
|
||||
<capabilities>
|
||||
<host>
|
||||
<uuid>cef19ce0-0ca2-11df-855d-b19fbce37686</uuid>
|
||||
<cpu>
|
||||
<arch>aarch64</arch>
|
||||
</cpu>
|
||||
</host>
|
||||
</capabilities>'''
|
||||
with mock.patch.object(fakelibvirt.virConnect, 'getCapabilities',
|
||||
return_value=fake_caps_xml):
|
||||
self.host._set_amd_sev_support()
|
||||
self.assertFalse(self.host.supports_amd_sev)
|
||||
|
||||
|
||||
class TestLibvirtSEVSupported(TestLibvirtSEV):
|
||||
"""Libvirt driver tests for when AMD SEV support is present."""
|
||||
|
@ -51,6 +51,7 @@ import nova.conf
|
||||
from nova import context as nova_context
|
||||
from nova import exception
|
||||
from nova.i18n import _
|
||||
from nova.objects import fields
|
||||
from nova import rpc
|
||||
from nova import utils
|
||||
from nova.virt import event as virtevent
|
||||
@ -1273,6 +1274,10 @@ class Host(object):
|
||||
def _set_amd_sev_support(self):
|
||||
self._supports_amd_sev = False
|
||||
|
||||
caps = self.get_capabilities()
|
||||
if caps.host.cpu.arch != fields.Architecture.X86_64:
|
||||
return
|
||||
|
||||
if not self._kernel_supports_amd_sev():
|
||||
LOG.info("kernel doesn't support AMD SEV")
|
||||
self._supports_amd_sev = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user