Message ID | 1343219765-12297-3-git-send-email-benoit@irqsave.net |
---|---|
State | New |
Headers | show |
On 07/25/2012 06:36 AM, benoit.canet@gmail.com wrote: > From: Benoît Canet <benoit@irqsave.net> > > Use the dedicated counting function in qmp_query_block in order to > propagate the backing file count to HMP. > > Signed-off-by: Benoit Canet <benoit@irqsave.net> > +++ b/qapi-schema.json > @@ -398,6 +398,8 @@ > # > # @backing_file: #optional the name of the backing file (for copy-on-write) > # > +# @backing_file_ancestors_count: #the count of ancestors backing files (since: 1.2) s/ancestors/ancestor's/ ? s/#// You are making it sound like this is the count of ancestors of the backing file (that is, 'base <- sn1 <- sn2' would have a count of 1, since there is 1 ancestor of the backing file sn1; and what if I have no backing file?), rather than a count of ancestors of this file (base has a count of 0, base <- sn1 has a count of 1). Maybe a better wording is: @backing_file_depth: number of files in the backing file chain (since: 1.2)
On 07/25/2012 06:36 AM, benoit.canet@gmail.com wrote: > +++ b/qapi-schema.json > @@ -398,6 +398,8 @@ > # > # @backing_file: #optional the name of the backing file (for copy-on-write) > # > +# @backing_file_ancestors_count: #the count of ancestors backing files (since: 1.2) > +# > # @encrypted: true if the backing device is encrypted > # > # @bps: total throughput limit in bytes per second is specified > @@ -418,9 +420,10 @@ > ## > { 'type': 'BlockDeviceInfo', > 'data': { 'file': 'str', 'ro': 'bool', 'drv': 'str', > - '*backing_file': 'str', 'encrypted': 'bool', > - 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int', > - 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int'} } > + '*backing_file': 'str', 'backing_file_ancestors_count': 'int', I hit send too soon. QMP prefers '-' over '_', so the new parameter should be 'backing-file-ancestors-count' (or with my proposal, 'backing-file-depth'). Yes, this particular struct has some _ for historical reasons, but that doesn't mean that new elements must share the misery.
Le Wednesday 25 Jul 2012 à 10:37:53 (-0600), Eric Blake a écrit : > On 07/25/2012 06:36 AM, benoit.canet@gmail.com wrote: > > From: Benoît Canet <benoit@irqsave.net> > > > > Use the dedicated counting function in qmp_query_block in order to > > propagate the backing file count to HMP. > > > > Signed-off-by: Benoit Canet <benoit@irqsave.net> > > > +++ b/qapi-schema.json > > @@ -398,6 +398,8 @@ > > # > > # @backing_file: #optional the name of the backing file (for copy-on-write) > > # > > +# @backing_file_ancestors_count: #the count of ancestors backing files (since: 1.2) > > s/ancestors/ancestor's/ ? > > s/#// > > You are making it sound like this is the count of ancestors of the > backing file (that is, 'base <- sn1 <- sn2' would have a count of 1, > since there is 1 ancestor of the backing file sn1; and what if I have no > backing file?), rather than a count of ancestors of this file (base has > a count of 0, base <- sn1 has a count of 1). Maybe a better wording is: > > @backing_file_depth: number of files in the backing file chain (since: 1.2) I'll change it Benoît > > -- > Eric Blake eblake@redhat.com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >
Le Wednesday 25 Jul 2012 à 10:39:11 (-0600), Eric Blake a écrit : > On 07/25/2012 06:36 AM, benoit.canet@gmail.com wrote: > > > +++ b/qapi-schema.json > > @@ -398,6 +398,8 @@ > > # > > # @backing_file: #optional the name of the backing file (for copy-on-write) > > # > > +# @backing_file_ancestors_count: #the count of ancestors backing files (since: 1.2) > > +# > > # @encrypted: true if the backing device is encrypted > > # > > # @bps: total throughput limit in bytes per second is specified > > @@ -418,9 +420,10 @@ > > ## > > { 'type': 'BlockDeviceInfo', > > 'data': { 'file': 'str', 'ro': 'bool', 'drv': 'str', > > - '*backing_file': 'str', 'encrypted': 'bool', > > - 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int', > > - 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int'} } > > + '*backing_file': 'str', 'backing_file_ancestors_count': 'int', > > I hit send too soon. QMP prefers '-' over '_', so the new parameter > should be 'backing-file-ancestors-count' (or with my proposal, > 'backing-file-depth'). Yes, this particular struct has some _ for > historical reasons, but that doesn't mean that new elements must share > the misery. I'll change it too. Benoît > > -- > Eric Blake eblake@redhat.com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >
diff --git a/block.c b/block.c index 03e0860..929605d 100644 --- a/block.c +++ b/block.c @@ -2450,6 +2450,9 @@ BlockInfoList *qmp_query_block(Error **errp) info->value->inserted->backing_file = g_strdup(bs->backing_file); } + info->value->inserted->backing_file_ancestors_count = + bdrv_get_backing_file_ancestors_count(bs); + if (bs->io_limits_enabled) { info->value->inserted->bps = bs->io_limits.bps[BLOCK_IO_LIMIT_TOTAL]; diff --git a/qapi-schema.json b/qapi-schema.json index a92adb1..21c1c2a 100644 --- a/qapi-schema.json +++ b/qapi-schema.json @@ -398,6 +398,8 @@ # # @backing_file: #optional the name of the backing file (for copy-on-write) # +# @backing_file_ancestors_count: #the count of ancestors backing files (since: 1.2) +# # @encrypted: true if the backing device is encrypted # # @bps: total throughput limit in bytes per second is specified @@ -418,9 +420,10 @@ ## { 'type': 'BlockDeviceInfo', 'data': { 'file': 'str', 'ro': 'bool', 'drv': 'str', - '*backing_file': 'str', 'encrypted': 'bool', - 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int', - 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int'} } + '*backing_file': 'str', 'backing_file_ancestors_count': 'int', + 'encrypted': 'bool', 'bps': 'int', 'bps_rd': 'int', + 'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', + 'iops_wr': 'int'} } ## # @BlockDeviceIoStatus: