Test the test to be helpful:

Run guest a defined model like:
 23   <cpu mode='custom' match='exact' check='partial'>                         
     
 24     <model fallback='forbid'>SandyBridge-IBRS</model>                       
     
 25     <vendor>Intel</vendor>                                                  
     
 26   </cpu>

In the guest check the cache file update time:
$ sudo ls -laF /var/cache/libvirt/qemu/capabilities/
-rw------- 1 root         root 75171 Sep  2 08:58 
926803a9278e445ec919c2b6cbd8c1c449c75b26dcb1686b774314180376c725.xml
-rw------- 1 root         root 85376 Sep  2 08:58 
f11008721aacc79c97e592178e61264d75be551864cd79cc41fe820e31262f27.xml
$ virsh domcapabilities > dpre
$ virsh capabilities > cpre
$ head -n5 /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 42
model name      : Intel Xeon E312xx (Sandy Bridge, IBRS update)


Then shutdown and change that to IvyBridge-IBRS (similar but not the same)
When again started it should refresh the cache, as the CPU changed.
But without the fix it hasn't.

While cpuinfo changed, the cache and results didn't.

$ head -n5 /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 58
model name      : Intel Xeon E3-12xx v2 (Ivy Bridge, IBRS)
$ virsh domcapabilities > dpost
$ virsh capabilities > cpost
$ md5sum cp* dp*
f0df917463798992d5842297fa039f86  cpost
4f214575cab864502576a0da1bceb031  cpre
94d6fe53ee5f9f6270e001788a225328  dpost
94d6fe53ee5f9f6270e001788a225328  dpre


With the fix:

-rw------- 1 root         root 75171 Sep  2 09:04 
926803a9278e445ec919c2b6cbd8c1c449c75b26dcb1686b774314180376c725.xml
-rw------- 1 root         root 85376 Sep  2 09:04 
f11008721aacc79c97e592178e61264d75be551864cd79cc41fe820e31262f27.xml

And after reboot into the other type we see the host section updated.
$ md5sum cp* dp*
4f214575cab864502576a0da1bceb031  cpost
f0df917463798992d5842297fa039f86  cpre
94d6fe53ee5f9f6270e001788a225328  dpost
94d6fe53ee5f9f6270e001788a225328  dpre
-rw------- 1 root         root 75171 Sep  2 09:04 
926803a9278e445ec919c2b6cbd8c1c449c75b26dcb1686b774314180376c725.xml
-rw------- 1 root         root 85376 Sep  2 09:04 
f11008721aacc79c97e592178e61264d75be551864cd79cc41fe820e31262f27.xml

$ diff -Naur cpre cpost
--- cpre        2020-09-02 09:04:41.058583142 +0000
+++ cpost       2020-09-02 09:05:50.652000000 +0000
@@ -4,10 +4,11 @@
     <uuid>058268cb-6229-46c7-84f8-5cd8edac4c5d</uuid>
     <cpu>
       <arch>x86_64</arch>
-      <model>IvyBridge-IBRS</model>
+      <model>SandyBridge-IBRS</model>
       <vendor>Intel</vendor>
       <microcode version='1'/>
       <topology sockets='1' cores='1' threads='1'/>
+      <feature name='vme'/>
       <feature name='osxsave'/>
       <feature name='hypervisor'/>
       <feature name='arat'/>

There are more complex feature checks that might go deeper e.g. when
actually starting a guest and deriving host-model. But this should be ok
as a test of the area I hope.

P.S. I've yet to see the "Outdated capabilities for '%s': host CPU
changed" message in a debug log, maybe the tests needs to be further
adapted for the specific case.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1874647

Title:
  [Ubuntu 20.04] Stale libvirt cache leads to VM startup failures

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-z-systems/+bug/1874647/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to