File tree Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Expand file tree Collapse file tree 2 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -1342,6 +1342,21 @@ def test_unsupported_without_feature(self, fake_exists):
1342
1342
def test_unsupported_with_feature (self , fake_exists ):
1343
1343
self .assertFalse (self .host .supports_amd_sev )
1344
1344
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
+
1345
1360
1346
1361
class TestLibvirtSEVSupported (TestLibvirtSEV ):
1347
1362
"""Libvirt driver tests for when AMD SEV support is present."""
Original file line number Diff line number Diff line change 51
51
from nova import context as nova_context
52
52
from nova import exception
53
53
from nova .i18n import _
54
+ from nova .objects import fields
54
55
from nova import rpc
55
56
from nova import utils
56
57
from nova .virt import event as virtevent
@@ -1273,6 +1274,10 @@ def supports_amd_sev(self):
1273
1274
def _set_amd_sev_support (self ):
1274
1275
self ._supports_amd_sev = False
1275
1276
1277
+ caps = self .get_capabilities ()
1278
+ if caps .host .cpu .arch != fields .Architecture .X86_64 :
1279
+ return
1280
+
1276
1281
if not self ._kernel_supports_amd_sev ():
1277
1282
LOG .info ("kernel doesn't support AMD SEV" )
1278
1283
self ._supports_amd_sev = False
You can’t perform that action at this time.
0 commit comments