[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Getting VM state from outside QEMU?
From: |
Erik Rull |
Subject: |
Re: [Qemu-devel] Getting VM state from outside QEMU? |
Date: |
Wed, 8 Apr 2015 18:21:23 +0200 (CEST) |
Hi Eric,
> On April 8, 2015 at 6:16 PM Eric Blake <address@hidden> wrote:
>
>
> On 04/08/2015 10:10 AM, Erik Rull wrote:
> >>
> >> My suggestion is to create a script that sends the QMP command
> >> "query-status" an then parse the result. The syntax and output is:
> >>
> >> -> { "execute": "query-status" }
> >> <- { "return": { "running": true, "singlestep": false, "status":
> >> "running" } }
> >>
> >
> > Sounds good - I tried that - but all attempts return that the command has
> > not
> > been found. I added the following command line snippet and the results are:
> > [...] -qmp tcp:localhost:4444,server,nowait [...]
> >
> > 172.17.48.45 ~ # telnet 127.0.0.1 4444
> > {"QMP": {"version": {"qemu": {"micro": 0, "minor": 1, "major": 2},
> > "package":
> > ""}, "capabilities": []}}
>
> You HAVE to use {"execute":"qmp_capabilities"} (possibly with an
> "id":...) as your first command on the monitor, before you can issue any
> other command. I really wish we could improve the error message:
>
> >
> > { "execute": "query-status" }
> > {"error": {"class": "CommandNotFound", "desc": "The command query-status has
> > not
> > been found"}}
>
> it would be a LOT nicer if we reported 'still in negotiation phase;
> "qmp_capabilities" expected' than a bland "CommandNotFound". Of course,
> patches are welcome to improve the experience there!
>
> Similarly, once you are NOT in capabilities negotiation, any subsequent
> use of "qmp_capabilities" fails. That's also something where the error
> message could be improved.
>
> --
> Eric Blake eblake redhat com +1-919-301-3266
> Libvirt virtualization library http://libvirt.org
Thanks! That fixed it - even if I don't know why this was actually necessary :-)
{"execute":"qmp_capabilities"}
{"return": {}}
{ "execute": "query-status" }
{"return": {"status": "running", "singlestep": false, "running": true}}
Best regards,
Erik
Re: [Qemu-devel] Getting VM state from outside QEMU?, John Snow, 2015/04/07