[libvirt-users] Device lease hot unplug and events

Hi, when working on hot unplugs of various devices, I've found out that hot unplugging <lease> device doesn't generate VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED event. <lease> also doesn't have an alias, so it wouldn't be identifiable in the corresponding callback. Is this difference from other hotpluggable devices intentional? If yes, is there any better way of checking that <lease> removal is completed than querying and examining the domain XML? From user's point of view, it would be best if I could simply handle the device removal event the same way as with other devices. Thanks, Milan

On Fri, Oct 12, 2018 at 19:33:54 +0200, Milan Zamazal wrote:
Hi, when working on hot unplugs of various devices, I've found out that hot unplugging <lease> device doesn't generate VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED event. <lease> also doesn't have an alias, so it wouldn't be identifiable in the corresponding callback.
Is this difference from other hotpluggable devices intentional? If yes,
Well a "lease" is not a device per-se. It's just libvirt putting it with devices. Currently the "lease" is always successfully removed/unplugged if the API returns success as there is no cooperation with qemu necessary so the semantics of asking the guest OS to do something don't apply.
is there any better way of checking that <lease> removal is completed than querying and examining the domain XML? From user's point of view, it would be best if I could simply handle the device removal event the same way as with other devices.
Yes, we probably should add the event and synthetize it for "lease" since we will not get one from qemu. Also we'll need to add alias for the lease so that the event can be used.

Peter Krempa <pkrempa@redhat.com> writes:
On Fri, Oct 12, 2018 at 19:33:54 +0200, Milan Zamazal wrote:
Hi, when working on hot unplugs of various devices, I've found out that hot unplugging <lease> device doesn't generate VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED event. <lease> also doesn't have an alias, so it wouldn't be identifiable in the corresponding callback.
Is this difference from other hotpluggable devices intentional? If yes,
Well a "lease" is not a device per-se. It's just libvirt putting it with devices. Currently the "lease" is always successfully removed/unplugged if the API returns success as there is no cooperation with qemu necessary so the semantics of asking the guest OS to do something don't apply.
I see, thank you for explanation. Can we rely on the fact that lease removal is and remains synchronous or is it a property that can change in the future?
is there any better way of checking that <lease> removal is completed than querying and examining the domain XML? From user's point of view, it would be best if I could simply handle the device removal event the same way as with other devices.
Yes, we probably should add the event and synthetize it for "lease" since we will not get one from qemu. Also we'll need to add alias for the lease so that the event can be used.
Since this is what an uninformed user expects (and I believe libvirt documentation doesn't contradict), I'd like to have the event + alias. Should I file a corresponding bug or RFE? Thanks, Milan

On Mon, Oct 15, 2018 at 09:56:39 +0200, Milan Zamazal wrote:
Peter Krempa <pkrempa@redhat.com> writes:
On Fri, Oct 12, 2018 at 19:33:54 +0200, Milan Zamazal wrote:
Hi, when working on hot unplugs of various devices, I've found out that hot unplugging <lease> device doesn't generate VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED event. <lease> also doesn't have an alias, so it wouldn't be identifiable in the corresponding callback.
Is this difference from other hotpluggable devices intentional? If yes,
Well a "lease" is not a device per-se. It's just libvirt putting it with devices. Currently the "lease" is always successfully removed/unplugged if the API returns success as there is no cooperation with qemu necessary so the semantics of asking the guest OS to do something don't apply.
I see, thank you for explanation. Can we rely on the fact that lease removal is and remains synchronous or is it a property that can change in the future?
In case of the current implementation I don't see a reason why we'd have to change it. If so it would be for a different "model". Generally we can't guarantee that some usage will not eventually need it but we should not change this behaviour, or at least I don't expect us to.
is there any better way of checking that <lease> removal is completed than querying and examining the domain XML? From user's point of view, it would be best if I could simply handle the device removal event the same way as with other devices.
Yes, we probably should add the event and synthetize it for "lease" since we will not get one from qemu. Also we'll need to add alias for the lease so that the event can be used.
Since this is what an uninformed user expects (and I believe libvirt documentation doesn't contradict), I'd like to have the event + alias. Should I file a corresponding bug or RFE?
Yes please.

Peter Krempa <pkrempa@redhat.com> writes:
On Mon, Oct 15, 2018 at 09:56:39 +0200, Milan Zamazal wrote:
Peter Krempa <pkrempa@redhat.com> writes:
On Fri, Oct 12, 2018 at 19:33:54 +0200, Milan Zamazal wrote:
Hi, when working on hot unplugs of various devices, I've found out that hot unplugging <lease> device doesn't generate VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED event. <lease> also doesn't have an alias, so it wouldn't be identifiable in the corresponding callback.
Is this difference from other hotpluggable devices intentional? If yes,
Well a "lease" is not a device per-se. It's just libvirt putting it with devices. Currently the "lease" is always successfully removed/unplugged if the API returns success as there is no cooperation with qemu necessary so the semantics of asking the guest OS to do something don't apply.
I see, thank you for explanation. Can we rely on the fact that lease removal is and remains synchronous or is it a property that can change in the future?
In case of the current implementation I don't see a reason why we'd have to change it. If so it would be for a different "model".
Generally we can't guarantee that some usage will not eventually need it but we should not change this behaviour, or at least I don't expect us to.
is there any better way of checking that <lease> removal is completed than querying and examining the domain XML? From user's point of view, it would be best if I could simply handle the device removal event the same way as with other devices.
Yes, we probably should add the event and synthetize it for "lease" since we will not get one from qemu. Also we'll need to add alias for the lease so that the event can be used.
Since this is what an uninformed user expects (and I believe libvirt documentation doesn't contradict), I'd like to have the event + alias. Should I file a corresponding bug or RFE?
Yes please.
OK, done: https://bugzilla.redhat.com/1639228
participants (2)
-
Milan Zamazal
-
Peter Krempa