Re: [PATCH v3] qemu_hotplug: Do not report unknown error when hot-unplugging non-existing device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Tuesday in 2024, Martin Kletzander wrote:
When qemuDomainDeleteDevice() gets "DeviceNotFound" error it is a
special case as we're trying to remove a device which does not exists
any more.  Such occasion is indicated by the return value -2.

Callers of the aforementioned function ought to base their behaviour on
the return value.  However not all callers take as much care for the
return value as one could realistically anticipate.

Follow the usual direction of removing possible backend object (in case
of character devices), remove the device from its XML without waiting
for the device removal from QEMU (since it is already not there) and
basically follow the same algorithm as there is when the device was
removed, skipping over the wait for the device removal.

The overall return value also needs to be adjusted since
qemuDomainDeleteDevice() does not set an error on the -2 return value
and would otherwise trigger an unknown error being reported to the user
or management application.

Signed-off-by: Martin Kletzander <mkletzan@xxxxxxxxxx>
---
v3:
- Skip qemuDomainWaitForDeviceRemoval() when the vCPU does not exist, as
  written in the commit message

- Do all the other necessary things when the vCPU is missing

I stared at the condition for so long I did not notice this being
skipped in v2 *facepalm*


v2:
- Adjust for -2 return value in callers

src/qemu/qemu_hotplug.c | 32 +++++++++++++++++++-------------
1 file changed, 19 insertions(+), 13 deletions(-)


Reviewed-by: Ján Tomko <jtomko@xxxxxxxxxx>

Jano

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux