[libvirt] [PATCH] qemu: hotplug: unify "not found" logs when detaching device
chen_han_xiao at 126.com
Wed Dec 20 08:54:19 UTC 2017
At 2017-12-18 21:57:11, "John Ferlan" <jferlan at redhat.com> wrote:
>On 12/15/2017 09:50 PM, Chen Hanxiao wrote:
>> At 2017-12-16 09:26:32, "John Ferlan" <jferlan at redhat.com> wrote:
>>> On 12/14/2017 06:16 AM, Chen Hanxiao wrote:
>>>> From: Chen Hanxiao <chenhanxiao at gmail.com>
>>>> Some services, such as Nova, check whether device was not found
>>>> by errror messages "not found". 
>>>> This patch unify logs of qemuDomainDetachDeviceLive, which will be helpful.
>>>>  https://github.com/openstack/nova/blob/master/nova/virt/libvirt/guest.py#L406
>>>> Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
>>>> src/qemu/qemu_hotplug.c | 18 +++++++++++-------
>>>> 1 file changed, 11 insertions(+), 7 deletions(-)
>>> Something about a tool that parses the error message(s) looking for a
>>> specific message string in English and needing to alter libvirt sources
>>> to match that tools' needs strikes me as incorrect and a "slippery
>>> slope" to follow.
>>> I'm not in favor of this because we'll be constantly chasing these types
>>> of bugs to match some other tools' (what I think is) incorrect means to
>>> handle errors.
>> But we don't have enough error code to cover all of scenario.
>Then there'd be a "different" fix required - adding an error code...
>Perhaps VIR_ERR_NO_DEVICE which would have error text "device %s not found"?
Thanks for the review.
I'll post a patch to throw VIR_ERR_NO_DEVICE for hot_plug cases.
>Of course that would require up the stack source code changes as well.
>Still better than scanning the error message which only works for a
>specific language set. IOW: how would this work for non "English" languages?
>> For qemuDomainDetachDeviceDiskLive, VIR_ERR_OPERATION_FAILED can be
>> "disk not found", also can be "cannot hot unplug multifunction PCI device"
>> in the following call of qemuDomainDetachVirtioDiskDevice.
>So it's "OK" to have a different operational failure? I assume that'll
>cause a failure elsewhere in the code. I didn't go digging on the source
>code - just a quick look at the _try_detach_device method from the above
>> So the tools powered by libvirt had to find a workaround by
>> analyzing error messages...
>Again, wouldn't those tools be broken without the right language set
Thanks for the detail clarification.
Checking words in error log is a bad way to catch errors and should be fixed.
More information about the libvir-list