$ dpkg -l | grep libvirt
ii libvirt-clients 8.0.0-1ubuntu7.9 ...
ii libvirt-daemon 8.0.0-1ubuntu7.9 ...
ii libvirt-daemon-config-network 8.0.0-1ubuntu7.9 ...
ii libvirt-daemon-config-nwfilter 8.0.0-1ubuntu7.9 ...
ii libvirt-daemon-dbgsym 8.0.0-1ubuntu7.9 ...
ii libvirt-daemon-driver-qemu 8.0.0-1ubuntu7.9 ...
ii libvirt-daemon-driver-qemu-dbgsym 8.0.0-1ubuntu7.9 ...
ii libvirt-daemon-system 8.0.0-1ubuntu7.9 ...
ii libvirt-daemon-system-systemd 8.0.0-1ubuntu7.9 ...
ii libvirt0:amd64 8.0.0-1ubuntu7.9 ...
ii libvirt0-dbgsym:amd64 8.0.0-1ubuntu7.9 ...
...
Repeat the 'Steps to reproduce' in comment #1, until this point,
and notice the differences from here.
...
Check there are 2 threads: cleanup and domain status XML save
Steps with test packages on Jammy
---
Test packages built successfully in all architectures
with -proposed enabled in Launchpad PPA mfo/lp2059272.
https:/ /launchpad. net/~mfo/ +archive/ ubuntu/ lp2059272
Upgrade the libvirt packages and install debug symbols
$ sudo add-apt-repository -y -c 'main' -c 'main/debug' ppa:mfo/lp2059272 0,-daemon{ ,-driver- qemu}}{ ,-dbgsym}
$ sudo apt install --yes libvirt{
$ dpkg -l | grep libvirt daemon- config- network 8.0.0-1ubuntu7.9 ... daemon- config- nwfilter 8.0.0-1ubuntu7.9 ... daemon- dbgsym 8.0.0-1ubuntu7.9 ... daemon- driver- qemu 8.0.0-1ubuntu7.9 ... daemon- driver- qemu-dbgsym 8.0.0-1ubuntu7.9 ... daemon- system 8.0.0-1ubuntu7.9 ... daemon- system- systemd 8.0.0-1ubuntu7.9 ... dbgsym: amd64 8.0.0-1ubuntu7.9 ...
ii libvirt-clients 8.0.0-1ubuntu7.9 ...
ii libvirt-daemon 8.0.0-1ubuntu7.9 ...
ii libvirt-
ii libvirt-
ii libvirt-
ii libvirt-
ii libvirt-
ii libvirt-
ii libvirt-
ii libvirt0:amd64 8.0.0-1ubuntu7.9 ...
ii libvirt0-
...
Repeat the 'Steps to reproduce' in comment #1, until this point,
and notice the differences from here.
...
Check there are 2 threads: cleanup and domain status XML save
(gdb) i th qemu/qemu_ driver. c:1070 4040, xmlopt= 0x7f1e6c028010, statusDir= 0x7f1e6c03b3d0 "/run/libvirt/ qemu") at ../../src/ conf/domain_ conf.c: 28879
Id Target Id Frame
1 Thread 0x7f1e79642ac0 (LWP 4404) "libvirtd" qemuStateCleanup () at ../../src/
18 Thread 0x7f1e507f8640 (LWP 4424) "gmain" (running)
19 Thread 0x7f1e4fff7640 (LWP 4425) "gdbus" (running)
20 Thread 0x7f1e4f7f6640 (LWP 4426) "udev-event" (running)
26 Thread 0x7f1e50ff9640 (LWP 4496) "vm-test-vm" (running)
27 Thread 0x7f1e4e7f4640 (LWP 4506) "qemu-event" virDomainObjSave (obj=0x7f1e6c07
Confirm the qemu driver's domain xml formatter/options is set/referenced:
t 27
(gdb) p xmlopt. privateData. format ivateDataFormat Func) 0x7f1e7054ada0 <qemuDomainObjP rivateXMLFormat >
$1 = (virDomainXMLPr
(gdb) p xmlopt. parent. parent_ instance
$2 = {g_type_instance = {g_class = 0x7f1e6c052000}, ref_count = 1, qdata = 0x0}
Let the cleanup function and shutdown path finish
t 1
c &
Check the formatter/options again; it is *STILL* referenced:
(gdb) p xmlopt. privateData. format ivateDataFormat Func) 0x7f1e7054ada0 <qemuDomainObjP rivateXMLFormat >
$3 = (virDomainXMLPr
(gdb) p xmlopt. parent. parent_ instance
$4 = {g_type_instance = {g_class = 0x7f1e6c052000}, ref_count = 1, qdata = 0x0}
So, we keep `xmlopt. privateData. format` as it is
(and NOT set it to `0` as in Steps to Reproduce).
Check the VM status XML *before* the save function finishes:
$ sudo grep -e '<domstatus' -e '<domain' -e 'monitor path' /run/libvirt/ qemu/test- vm.xml var/lib/ libvirt/ qemu/domain- 4-test- vm/monitor. sock' type='unix'/>
<domstatus state='running' reason='booted' pid='4493'>
<monitor path='/
<domain type='qemu' id='4'>
Let the save function continue, and libvirt finishes shutting down:
(gdb) c
Continuing.
...
[Inferior 1 (process 4404) exited normally]
Check the VM status XML *after*:
$ sudo grep -e '<domstatus' -e '<domain' -e 'monitor path' /run/libvirt/ qemu/test- vm.xml var/lib/ libvirt/ qemu/domain- 4-test- vm/monitor. sock' type='unix'/>
<domstatus state='running' reason='booted' pid='4493'>
<monitor path='/
<domain type='qemu' id='4'>
It *CONTINUES* to have the 'monitor path' tag/field.
Now, the next time libvirtd starts, it *CORRECTLY* parses that XML:
$ sudo systemctl start libvirtd.service
$ journalctl -b -u libvirtd.service | tail
< no errors >
And libvirt is now aware of the domain, and can manage it:
$ virsh list ------- ------- -----
Id Name State
------
4 test-vm running
$ virsh destroy test-vm
Domain 'test-vm' destroyed