Hi,
one of our tests was complaining that after an attach-device
followed by detach-device, the device was still in the vm's
apparmor whitelist. It turns out the device actually also
still in the device's xml. qemuDomainDetachVirtioDiskDevice()
is calling
if (!qemuDomainWaitForDeviceRemoval(vm))
qemuDomainRemoveDiskDevice(driver, vm, detach);
ret = 0;
Return values for qemuDomainWaitForDeviceRemoval are:
* -1 on error
* 0 when DEVICE_DELETED event is unsupported
* 1 when device removal finished
* 2 device removal did not finish in QEMU_REMOVAL_WAIT_TIME
Those don't seem in line with how the return value is used. (According
to gdb, it is returning 2 in my case.) I don't understand how the async
device removal proceeds, but if qemuDomainWaitForDeviceRemoval()
returned an error (-1 or 2) should qemuDomainDetachVirtioDiskDevice() at
least return an error, assuming it's not safe to call
qemuDomainRemoveDiskDevice()?
As it is, I get
# serge@t1:~/qa-regression-testing/scripts$ virsh detach-device qatest-i386
/tmp/tmpivE45x/device.xml
# Device detached successfully
but the device is actually still in qatest-i386's xml. Seems like the
caller should be informed that the device is still attached. Assuming
I'm not completely mis-reading the situation.
thanks,
-serge