Skip to content

Commit f0ffed8

Browse files
hrwstephenfin
authored andcommitted
libvirt: check for AMD SEV only on x86-64
"kernel doesn't support AMD SEV" message on aarch64 does not make sense Closes-bug: #1873012 Change-Id: I1ae22197dc68751938f524d823f39e5c89cec7b0
1 parent 16cabdd commit f0ffed8

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

nova/tests/unit/virt/libvirt/test_host.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,6 +1342,21 @@ def test_unsupported_without_feature(self, fake_exists):
13421342
def test_unsupported_with_feature(self, fake_exists):
13431343
self.assertFalse(self.host.supports_amd_sev)
13441344

1345+
def test_non_x86_architecture(self):
1346+
fake_caps_xml = '''
1347+
<capabilities>
1348+
<host>
1349+
<uuid>cef19ce0-0ca2-11df-855d-b19fbce37686</uuid>
1350+
<cpu>
1351+
<arch>aarch64</arch>
1352+
</cpu>
1353+
</host>
1354+
</capabilities>'''
1355+
with mock.patch.object(fakelibvirt.virConnect, 'getCapabilities',
1356+
return_value=fake_caps_xml):
1357+
self.host._set_amd_sev_support()
1358+
self.assertFalse(self.host.supports_amd_sev)
1359+
13451360

13461361
class TestLibvirtSEVSupported(TestLibvirtSEV):
13471362
"""Libvirt driver tests for when AMD SEV support is present."""

nova/virt/libvirt/host.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
from nova import context as nova_context
5252
from nova import exception
5353
from nova.i18n import _
54+
from nova.objects import fields
5455
from nova import rpc
5556
from nova import utils
5657
from nova.virt import event as virtevent
@@ -1273,6 +1274,10 @@ def supports_amd_sev(self):
12731274
def _set_amd_sev_support(self):
12741275
self._supports_amd_sev = False
12751276

1277+
caps = self.get_capabilities()
1278+
if caps.host.cpu.arch != fields.Architecture.X86_64:
1279+
return
1280+
12761281
if not self._kernel_supports_amd_sev():
12771282
LOG.info("kernel doesn't support AMD SEV")
12781283
self._supports_amd_sev = False

0 commit comments

Comments
 (0)