From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60268) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yg6xh-00083g-Vq for qemu-devel@nongnu.org; Thu, 09 Apr 2015 03:33:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yg6xe-00052c-N5 for qemu-devel@nongnu.org; Thu, 09 Apr 2015 03:33:17 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:35830) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yg6xe-00052S-GW for qemu-devel@nongnu.org; Thu, 09 Apr 2015 03:33:14 -0400 Received: by wgyo15 with SMTP id o15so100181405wgy.2 for ; Thu, 09 Apr 2015 00:33:13 -0700 (PDT) Message-ID: <1428564790.14213.2.camel@profitbricks.com> From: Paulo Ricardo Paz Vital Date: Thu, 09 Apr 2015 09:33:10 +0200 In-Reply-To: <5525546E.5020109@redhat.com> References: <1746798507.1094444.1428413473548.JavaMail.open-xchange@oxbaltgw09.schlund.de> <1428414139.25243.1.camel@profitbricks.com> <668770373.39977.1428509418086.JavaMail.open-xchange@oxbaltgw07.schlund.de> <5525546E.5020109@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] Getting VM state from outside QEMU? Reply-To: paulo.vital@profitbricks.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Erik Rull , "qemu-devel@nongnu.org" Sorry guys only checked the emails this morning :-D On Wed, 2015-04-08 at 10:16 -0600, Eric Blake 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! That's an interesting point to see. I'm going to take a look on this and submit a patch until next week, probably good to 2.4 release. > > 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. > -- Paulo Ricardo Paz Vital ProfitBricks GmbH