[libvirt] [PATCH RFC 2/4] qemu_agent: ignore requests echoed back by guest

Joao Martins posted 4 patches 9 years ago
[libvirt] [PATCH RFC 2/4] qemu_agent: ignore requests echoed back by guest
Posted by Joao Martins 9 years ago
Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
---
 src/util/virqemuagent.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/util/virqemuagent.c b/src/util/virqemuagent.c
index caabae0..ffb3489 100644
--- a/src/util/virqemuagent.c
+++ b/src/util/virqemuagent.c
@@ -333,7 +333,8 @@ qemuAgentIOProcessLine(qemuAgentPtr mon,
         goto cleanup;
     }
 
-    if (virJSONValueObjectHasKey(obj, "QMP") == 1) {
+    if (virJSONValueObjectHasKey(obj, "QMP") == 1 ||
+        virJSONValueObjectHasKey(obj, "execute") == 1) {
         ret = 0;
     } else if (virJSONValueObjectHasKey(obj, "event") == 1) {
         ret = qemuAgentIOProcessEvent(mon, obj);
-- 
2.1.4

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC 2/4] qemu_agent: ignore requests echoed back by guest
Posted by Jim Fehlig 8 years, 11 months ago
On 02/08/2017 09:44 AM, Joao Martins wrote:
> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>

Since it wasn't needed before, I think it is helpful for the commit message to 
describe why the change is needed now.

> ---
>  src/util/virqemuagent.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/util/virqemuagent.c b/src/util/virqemuagent.c
> index caabae0..ffb3489 100644
> --- a/src/util/virqemuagent.c
> +++ b/src/util/virqemuagent.c
> @@ -333,7 +333,8 @@ qemuAgentIOProcessLine(qemuAgentPtr mon,
>          goto cleanup;
>      }
>
> -    if (virJSONValueObjectHasKey(obj, "QMP") == 1) {
> +    if (virJSONValueObjectHasKey(obj, "QMP") == 1 ||
> +        virJSONValueObjectHasKey(obj, "execute") == 1) {

And a brief comment in the code, e.g. along the lines of the commit summary.

Regards,
Jim

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC 2/4] qemu_agent: ignore requests echoed back by guest
Posted by Daniel P. Berrange 8 years, 11 months ago
On Thu, Mar 02, 2017 at 11:10:10AM -0700, Jim Fehlig wrote:
> On 02/08/2017 09:44 AM, Joao Martins wrote:
> > Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
> 
> Since it wasn't needed before, I think it is helpful for the commit message
> to describe why the change is needed now.

I'm open to being convinced otherwise, but I'd say that if the guest
is echo'ing back commands the host sends, then the guest is broken
and we shouldn't workaround that in libvirt. Or perhaps something
about the hypervisor data channel over which the guest agent is
running is running.

Seeing data echo'd back suggests use of a PTY which has not been
put into raw mode, or something like that.

 
Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://entangle-photo.org       -o-    http://search.cpan.org/~danberr/ :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC 2/4] qemu_agent: ignore requests echoed back by guest
Posted by Joao Martins 8 years, 11 months ago
On 03/02/2017 06:16 PM, Daniel P. Berrange wrote:
> On Thu, Mar 02, 2017 at 11:10:10AM -0700, Jim Fehlig wrote:
>> On 02/08/2017 09:44 AM, Joao Martins wrote:
>>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
>>
>> Since it wasn't needed before, I think it is helpful for the commit message
>> to describe why the change is needed now.
> 
> I'm open to being convinced otherwise, but I'd say that if the guest
> is echo'ing back commands the host sends, then the guest is broken
> and we shouldn't workaround that in libvirt. Or perhaps something
> about the hypervisor data channel over which the guest agent is
> running is running.
>
> Seeing data echo'd back suggests use of a PTY which has not been
> put into raw mode, or something like that.

OK, Thanks for the pointers.

This is one of the biggest reasons this is an RFC, as I haven't investigated
this properly yet. My gut feeling was that this could be on the device model
side (i.e. qemu) or even xenconsole handling side - and this was happening on
both socket and pty channel types. Anyhow, I can't make the argument/case for
inclusion of this patch yet, but being a one-liner I thought of including it for
purposes of a working RFC/prototype.

Joao

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH RFC 2/4] qemu_agent: ignore requests echoed back by guest
Posted by Joao Martins 8 years, 11 months ago

On 03/02/2017 06:10 PM, Jim Fehlig wrote:
> On 02/08/2017 09:44 AM, Joao Martins wrote:
>> Signed-off-by: Joao Martins <joao.m.martins@oracle.com>
> 
> Since it wasn't needed before, I think it is helpful for the commit message to 
> describe why the change is needed now.

True, my apologies. I should have included at least the sentence I had on the
cover letter regarding this commit (same for patch 3).

>> ---
>>  src/util/virqemuagent.c | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/src/util/virqemuagent.c b/src/util/virqemuagent.c
>> index caabae0..ffb3489 100644
>> --- a/src/util/virqemuagent.c
>> +++ b/src/util/virqemuagent.c
>> @@ -333,7 +333,8 @@ qemuAgentIOProcessLine(qemuAgentPtr mon,
>>          goto cleanup;
>>      }
>>
>> -    if (virJSONValueObjectHasKey(obj, "QMP") == 1) {
>> +    if (virJSONValueObjectHasKey(obj, "QMP") == 1 ||
>> +        virJSONValueObjectHasKey(obj, "execute") == 1) {
> 
> And a brief comment in the code, e.g. along the lines of the commit summary.

/nods

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list