qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObjec


From: Anthony Liguori
Subject: Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject
Date: Thu, 10 Dec 2009 10:03:46 -0600
User-agent: Thunderbird 2.0.0.23 (X11/20090825)

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





reply via email to

[Prev in Thread] Current Thread [Next in Thread]