From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIlVG-0002AN-9u for qemu-devel@nongnu.org; Thu, 10 Dec 2009 11:04:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIlVB-00025t-Kv for qemu-devel@nongnu.org; Thu, 10 Dec 2009 11:04:29 -0500 Received: from [199.232.76.173] (port=52459 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIlVB-00025n-BK for qemu-devel@nongnu.org; Thu, 10 Dec 2009 11:04:25 -0500 Received: from e38.co.us.ibm.com ([32.97.110.159]:46750) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1NIlVB-0005bu-HW for qemu-devel@nongnu.org; Thu, 10 Dec 2009 11:04:25 -0500 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e38.co.us.ibm.com (8.14.3/8.13.1) with ESMTP id nBAFxVi7028053 for ; Thu, 10 Dec 2009 08:59:31 -0700 Received: from d03av05.boulder.ibm.com (d03av05.boulder.ibm.com [9.17.195.85]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id nBAG4JQk210702 for ; Thu, 10 Dec 2009 09:04:19 -0700 Received: from d03av05.boulder.ibm.com (loopback [127.0.0.1]) by d03av05.boulder.ibm.com (8.14.3/8.13.1/NCO v10.0 AVout) with ESMTP id nBAG47au026513 for ; Thu, 10 Dec 2009 09:04:07 -0700 Message-ID: <4B211BE2.60907@linux.vnet.ibm.com> Date: Thu, 10 Dec 2009 10:03:46 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject References: <1260376078-8694-1-git-send-email-lcapitulino@redhat.com> <1260376078-8694-11-git-send-email-lcapitulino@redhat.com> <20091210095237.38cafe5c@doriath> <4B20F003.6070409@linux.vnet.ibm.com> <4B2119F9.6010003@redhat.com> In-Reply-To: <4B2119F9.6010003@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Avi Kivity Cc: qemu-devel@nongnu.org, Markus Armbruster , Luiz Capitulino Avi Kivity wrote: > On 12/10/2009 02:56 PM, Anthony Liguori wrote: >> >> I'd prefer an empty dict. I actually prefer that over null. >> > > Depends. Key not present suggests the feature is not implemented. > Value is null suggests the feature is not used. Both key and value > present suggest the feature is in implemented and active. What I suggested to Luiz was that all info commands return a dictionary. The main reason was that for most commands, we can extend the commands in a compatible way by adding new fields to the dictionary. My expectation is that there will be a lot of client code that does: hpet_info = qmp.info_hpet() if hpet_info.has_key('period'): period = hpet_info['period'] else: period = 100 # old qemu's has a fixed period of 100ns So in keeping with this idiom, I think that checking name_info.has_key('name') is a more meaningful way to determine whether the virtual machine has been given a name vs comparing name_info['name'] == None. -- Regards, Anthony Liguori