Received: from eggs.gnu.org ([208.118.235.92]:52505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGQFf-00063e-Lg for qemu-devel@nongnu.org; Fri, 15 Mar 2013 04:44:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UGQFZ-0000FO-BF for qemu-devel@nongnu.org; Fri, 15 Mar 2013 04:44:35 -0400 Received: from mail-bk0-x22c.google.com ([2a00:1450:4008:c01::22c]:55777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UGQFZ-0000FD-4e for qemu-devel@nongnu.org; Fri, 15 Mar 2013 04:44:29 -0400 Received: by mail-bk0-f44.google.com with SMTP id j4so1397084bkw.3 for ; Fri, 15 Mar 2013 01:44:28 -0700 (PDT) Date: Fri, 15 Mar 2013 09:44:25 +0100 From: Stefan Hajnoczi Message-ID: <20130315084425.GB3943@stefanha-thinkpad.redhat.com> References: <1363000996-13221-1-git-send-email-xiawenc@linux.vnet.ibm.com> <20130312100754.GC19624@stefanha-thinkpad.redhat.com> <513F54EE.1050205@redhat.com> <513FEA7A.7000102@linux.vnet.ibm.com> <20130313113408.GA30532@stefanha-thinkpad.muc.redhat.com> <5140711E.5090900@redhat.com> <20130313124048.GA31109@stefanha-thinkpad.muc.redhat.com> <5142BA85.6090706@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5142BA85.6090706@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH V9 00/14] qmp/hmp interfaces for internal snapshot info List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Wenchao Xia Cc: kwolf@redhat.com, armbru@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com, pbonzini@redhat.com On Fri, Mar 15, 2013 at 02:07:01PM +0800, Wenchao Xia wrote: > 于 2013-3-13 20:40, Stefan Hajnoczi 写道: > >This is why I asked about the array. A dict of ImageInfos is needed, > >they can refer to each other by key. > > > >If we go with an array we're painting ourselves into a corner. > > > >If we go with a dict it's more complicated and may not be used much. > > > >I'd go for the dict but we need a policy for choosing keys (names) for > >the ImageInfo elements. Perhaps BlockDeviceInfo['file'] is the key for > >the top-level image and then ImageInfo['backing-filename'] for the > >backing chain. > > > >Stefan > > > > Since ImageInfo already have key 'backing-filename', which stands for > the information got in this image, not from the backing image, > add a new key 'bakcing-image' for recursive linking: > > { 'type': 'ImageInfo', > 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool', > '*actual-size': 'int', 'virtual-size': 'int', > '*cluster-size': 'int', '*encrypted': 'bool', > '*backing-filename': 'str', '*full-backing-filename': 'str', > '*backing-filename-format': 'str', > '*backing-image": 'ImageInfo', > '*snapshots': ['SnapshotInfo'] } } > > Then insert ImageInfo into BlockDeviceInfo, with key 'images', since > 'file' is already used which may break compatibility if we change it. > 'images' uses an array for the case when multiple images exist in > top level, not for backing chain. > > { 'type': 'BlockDeviceInfo', > 'data': { 'file': 'str', 'ro': 'bool', 'drv': 'str', > '*backing_file': 'str', 'backing_file_depth': 'int', > 'encrypted': 'bool', 'encryption_key_missing': 'bool', > 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int', > 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int', > 'images': ['ImageInfo']} }} Sounds good. Stefan