[Top][All Lists]
[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: |
Avi Kivity |
Subject: |
Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject |
Date: |
Thu, 10 Dec 2009 18:10:23 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091203 Fedora/3.0-3.13.rc2.fc12 Thunderbird/3.0 |
On 12/10/2009 06:03 PM, Anthony Liguori wrote:
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.
Oh yes.
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.
But we have two null conditions to check for, in an extendible dictionary:
1. The feature is unknown to qemu
2. The feature is known to qemu, but disabled
So, "if 'field' in result:" tests the former, and "if result['field']:"
tests the latter.
In your example, a period of None makes no sense, so it would be
sufficient to
period = hpet_info.get('period', 0.100)
--
error compiling committee.c: too many arguments to function
- Re: [Qemu-devel] [PATCH 06/19] monitor: do_info_cpus(): Use QBool, (continued)
- [Qemu-devel] [PATCH 07/19] monitor: do_info_version(): Use QDict, Luiz Capitulino, 2009/12/09
- [Qemu-devel] [PATCH 08/19] monitor: Convert do_info_status() to QObject, Luiz Capitulino, 2009/12/09
- [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Luiz Capitulino, 2009/12/09
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Markus Armbruster, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Luiz Capitulino, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Anthony Liguori, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Avi Kivity, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Avi Kivity, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Anthony Liguori, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject,
Avi Kivity <=
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Anthony Liguori, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Avi Kivity, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Luiz Capitulino, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Avi Kivity, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Luiz Capitulino, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Daniel P. Berrange, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Luiz Capitulino, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Daniel P. Berrange, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Luiz Capitulino, 2009/12/11
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Anthony Liguori, 2009/12/11