Hi all, I use libvirt-go in my agent to attach rbd volumes. I ofen suffer the issue of incosistent of domain dump xml and domain persistent xml file. For example, when I try to attach volume, the the domain by ?virConnectListAllDomains? api from libvirt tell me the vdf or 0x0a is empty, but when attach it with the vdf device or 0x0a address, qemu return the error duplicated with vdf or PCI address are double used: 2021-09-28T16:00:03.816682107-07:00 stderr F I0928 23:00:03.816558 1 cephvolume.go:73] attach disk &{XMLName:{Space: Local:} Device:disk RawIO: SGIO: Snapshot: Model: Driver:0xc00073b420 Auth:0xc000f49e40 Source:0xc000159860 BackingStore:<nil> Geometry:<nil> BlockIO:<nil> Mirror:<nil> Target:0xc000a58b40 IOTune:0xc00019b970 ReadOnly:<nil> Shareable:<nil> Transient:<nil> Serial:pvc-33003998-6624-4ac9-a923-d94f9401abdf WWN: Vendor: Product: Encryption:<nil> Boot:<nil> Alias:<nil> Address:0xc001420b40} error: virError(Code=27, Domain=20, Message='XML error: target 'vdf' duplicated for disk sources 'volume-0aab375c-1858-4f09-b276-ea297cd29a3d' and 'volume-63ef92c4-a027-476c-a2de-9fcf501dd4de'') ??I0330 00:28:55.070331 1 cephvolume.go:73] attach disk &{XMLName:{Space: Local:} Device:disk RawIO: SGIO: Snapshot: Model: Driver:0xc000024380 Auth:0xc006a51600 Source:0xc000640cd0 BackingStore:<nil> Geometry:<nil> BlockIO:<nil> Mirror:<nil> Target:0xc00342db80 IOTune:0xc005071c30 ReadOnly:<nil> Shareable:<nil> Transient:<nil> Serial:pvc-39c80157-0862-433c-a1ec-49475db818cf WWN: Vendor: Product: Encryption:<nil> Boot:<nil> Alias:<nil> Address:0xc000f5e240} error: virError(Code=27, Domain=20, Message='XML error: Attempted double use of PCI Address 0000:00:0a.0') In first case of ?target 'vdf' duplicated? , I find the volume is in the dump xml by ?virsh dumpxml? but not in the persistent xml at /etc/libvirt/qemu/xxx.xml or ?virsh edit?. But the second case of ?double use of PCI Address? I found the volume is on the persistent xml but not int the duml xml. I think there is a middle state that qemu try to attach or detach but not finished. But what is the api to get the different domain state except ?virConnectListAllDomains?? The reversed case is that when I try to detach volume, the domain tell me the volume is allocated at vde, but I detach the volume with vde, it also return the error ?vde not found?: I0330 00:38:54.615254 1 cephvolume.go:227] detach disk &{XMLName:{Space: Local:disk} Device:disk RawIO: SGIO: Snapshot: Model: Driver:0xc000736540 Auth:0xc0027b68a0 Source:0xc000641040 BackingStore:<nil> Geometry:<nil> BlockIO:<nil> Mirror:<nil> Target:0xc004557640 IOTune:0xc0006e4370 ReadOnly:<nil> Shareable:<nil> Transient:<nil> Serial:pvc-febae406-15ad-4d05-9c93-b2d09c197840 WWN: Vendor: Product: Encryption:<nil> Boot:<nil> Alias:<nil> Address:0xc00709cba0} error: virError(Code=9, Domain=10, Message='operation failed: disk vde not found') In this case, I found the volume is not in dump but in the persistent. All my volume api are use persistent operation. So I want to know 1. What is the state return by ?virConnectListAllDomains? ? 2. What is the detail of state and how the state transition of qemu/libvirt? 3. Any way in libvirt api to get the different state of domain? Thanks, Tao -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20230330/b4774361/attachment-0001.htm>