On 09/20/2016 11:54 AM, Michal Privoznik wrote:
> On 20.09.2016 12:43, Joao Martins wrote:
>> On 09/20/2016 05:14 AM, Michal Privoznik wrote:
>>> On 20.09.2016 00:04, Jim Fehlig wrote:
>>>> On 09/16/2016 05:43 PM, Joao Martins wrote:
>>>>> Hey,
>>>>>  Additionally what does "state"
>>>>> signify for virtio case: is it that the guest agent is connected, or that 
>>>>> the
>>>>> virtio serial is connected? Looking at the qemu driver on
>>>>> processSerialChangedEvent it sounds to me like it's about the serial 
>>>>> state.
>>>> AFAICT you are right, but perhaps Michal is kind enough to confirm. I 
>>>> think he
>>>> is familiar with this code.
>>> That attribute is put by libvirt into live XML so that mgmt apps can
>>> query for it. The attribute says whether the guest part of channel is
>>> opened by a process running within guest. In case of the qemu-ga whether
>>> we have the guest agent up & running. Whenever the guest end of a
>>> channel is opened/closed, qemu sends us an event so we can update our
>>> internal state and put the correct value when formatting live XML.
>>> Therefore, it makes no sense to make this attribute RW (meaning users
>>> could set it), obviously.
>> Hmm if it refers to qemu agent actually (dis)connected from guest side it 
>> might
>> be difficult to provide the same "state" semantics in libxl driver at least
>> without changes on the toolstack. If it referring to virtio-serial state we
>> could easily do that by periodically calling libxl_channel_getinfo until 
>> state
>> is 4 (connected). But it's the actual agent process state as connected in 
>> which
>> case to have "state" attribute we would need to add similar to libxl event
>> DOMAIN_CREATE_CONSOLE_AVAILABLE but instead referring to the guest channel.
> Well, in qemu it really just means that somebody is listening. Note that
> I say "somebody". That is if you kill qemu-ga in the guest and just 'cat
> /dev/virtio-ports/org.qemu-ga.' we will report state='connected' (or
> what's the path, and yes you can't use cat, but you get my point).
Yeap I understand. Looking at both libvirt, qemu  it looks like the event
commit 15bbaaf01 ("qemu: Add handling for VSERPORT_CHANGE event") and qemu
commit e2ae6159d ("virtio-serial: report frontend connection state via
monitor"). Looking at the frontend driver it has the granularity of sending port
open/close events (quite nice!), which I assume it's what qemu is using as info
to propagate these events to libvirt. Although this looks very specific to
virtio workings, which might not be possible to get the equivalent with the Xen
console. So perhaps having a periodical (with a timeout) guest-ping would be the
best course of action I guess?

> We don't do any checks whether it is actual qemu-ga listening. Moreover, we
> report that for all the channels, not just the one used by the guest
> agent. So it really means that there is somebody listening in the guest.
Yeap that's what I understood from your comment. I mentioned qemu aguest agent
also as an example.

Thanks for the clarifications!

libvir-list mailing list

Reply via email to