Received: from eggs.gnu.org ([2001:4830:134:3::10]:44107) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1br8Xi-00011d-2y for qemu-devel@nongnu.org; Mon, 03 Oct 2016 15:04:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1br8Xc-0004Ex-Vm for qemu-devel@nongnu.org; Mon, 03 Oct 2016 15:04:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60188) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1br8Xc-0004Ed-OT for qemu-devel@nongnu.org; Mon, 03 Oct 2016 15:04:44 -0400 Date: Mon, 3 Oct 2016 16:04:42 -0300 From: Eduardo Habkost Message-ID: <20161003190442.GE3877@thinpad.lan.raisama.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] QMP stubs: how to return "not implemented" errors? List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, Markus Armbruster Cc: "Jason J. Herne" , libvir-list@redhat.com, David Hildenbrand , Jiri Denemark Hi, When adding new QMP commands that are implemented by arch-specific code, we have been adding stubs that report QERR_UNSUPPORTED (see stubs/arch-query-cpu-model-expansion.c for an example). But we are using GenericError for that, and this prevents clients from reliably checking if the command is really implemented by the QEMU binary. What should be the right solution for this? Some of the options I have considered are: 1) Using CommandNotFound as the error class in the stubs. This sounds wrong because the command exists (it is present in query-commands and in the QAPI schema). 2) Creating a CommandNotImplemented error class. Simple to do, but it would require clients to make two separate checks, before concluding that the command is available (checking query-commands or query-qmp-schema, and then checking for CommandNotImplemented errors). 3.1) Removing the command from query-commands and from the QAPI schema on binaries that don't implement the command. Needlessly complex? 3.2) Removing the unimplemented command from query-commands only (by calling qmp_disable_command()), but keeping it on the QAPI schema. I am not sure it's OK to do that. If it is, this sounds like the simplest solution. Any ideas? -- Eduardo