@@ -1561,10 +1561,32 @@ def check_certificates(machine):
15611561
15621562 check_certificates (computeVM )
15631563
1564+ def test_cpu_models (self ):
1565+ """
1566+ This tests checks that cpu-models API call is implemented and returns
1567+ at least a sapphire-rapids model.
1568+ Further, we check that the domcapabilities API call returns the
1569+ expected CPU profile as usable.
1570+ Both is required to be able to use the specific CPU profile.
1571+ While the 'virsh cpu-models' call only lists the CPU profiles the VMM
1572+ supports, the 'virsh domcapabilities' call takes into account the hosts
1573+ architecture. Thus, the latter reports what CPU profile actually can be
1574+ used in the current environment.
1575+ """
1576+ out = controllerVM .succeed ("virsh cpu-models x86_64" )
1577+ self .assertIn ("sapphire-rapids" , out )
1578+
1579+ out = controllerVM .succeed ("virsh domcapabilities" )
1580+ self .assertIn (
1581+ "<model usable='yes' vendor='Intel' canonical='sapphire-rapids'>sapphire-rapids</model>" ,
1582+ out ,
1583+ )
1584+
15641585
15651586def suite ():
15661587 # Test cases in alphabetical order
15671588 testcases = [
1589+ LibvirtTests .test_cpu_models ,
15681590 LibvirtTests .test_disk_is_locked ,
15691591 LibvirtTests .test_disk_resize_qcow2 ,
15701592 LibvirtTests .test_disk_resize_raw ,
0 commit comments