On Fri, 11 Nov 2011 15:39:29 +0530 Supriya Kannery <supri...@linux.vnet.ibm.com> wrote:
> On 11/11/2011 12:17 PM, Supriya Kannery wrote: > > Enhance "info block" to display hostcache setting for each > > block device. > > > > > > ## > > Index: qemu/qapi-types.h > > =================================================================== > > --- qemu.orig/qapi-types.h > > +++ qemu/qapi-types.h > > @@ -383,6 +383,7 @@ struct BlockInfo > > { > > char * device; > > char * type; > > + bool hostcache; > > bool removable; > > bool locked; > > bool has_inserted; > > Index: qemu/block.c > > hostcache gets added to qapi-types.h from > the change done in qapi-schema.json. Hence > above change has to be ignored. Pls find > updated patch. git am says this patch is corrupted. Otherwise the QAPI changes look ok to me. > > > ********************************************************************* > Enhance "info block" to display hostcache setting for each > block device. > > Example: > (qemu) info block > ide0-hd0: removable=0 file=../rhel6-32.raw ro=0 drv=raw encrypted=0 > > Enhanced to display "hostcache" setting: > (qemu) info block > ide0-hd0: removable=0 hostcache=1 file=../rhel6-32.raw ro=0 drv=raw > encrypted=0 > > Signed-off-by: Supriya Kannery <supri...@linux.vnet.ibm.com> > > --- > block.c | 20 ++++++++++++++++---- > qmp-commands.hx | 2 ++ > 2 files changed, 18 insertions(+), 4 deletions(-) > > Index: qemu/qapi-schema.json > =================================================================== > --- qemu.orig/qapi-schema.json > +++ qemu/qapi-schema.json > @@ -409,6 +409,8 @@ > # @locked: True if the guest has locked this device from having its media > # removed > # > +# @hostcache: True if host pagecache is enabled. > +# > # @tray_open: #optional True if the device has a tray and it is open > # (only present if removable is true) > # > @@ -422,7 +424,7 @@ > ## > { 'type': 'BlockInfo', > 'data': {'device': 'str', 'type': 'str', 'removable': 'bool', > - 'locked': 'bool', '*inserted': 'BlockDeviceInfo', > + 'locked': 'bool','hostcache': 'bool', '*inserted': > 'BlockDeviceInfo', > '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus'} } > > ## > Index: qemu/block.c > =================================================================== > --- qemu.orig/block.c > +++ qemu/block.c > @@ -1839,6 +1839,7 @@ BlockInfoList *qmp_query_block(Error **e > info->value->device = g_strdup(bs->device_name); > info->value->type = g_strdup("unknown"); > info->value->locked = bdrv_dev_is_medium_locked(bs); > + info->value->hostcache = !(bs->open_flags & BDRV_O_NOCACHE); > info->value->removable = bdrv_dev_has_removable_media(bs); > > if (bdrv_dev_has_removable_media(bs)) { > Index: qemu/hmp.c > =================================================================== > --- qemu.orig/hmp.c > +++ qemu/hmp.c > @@ -199,6 +199,8 @@ void hmp_info_block(Monitor *mon) > monitor_printf(mon, " tray-open=%d", info->value->tray_open); > } > > + monitor_printf(mon, " hostcache=%d", info->value->hostcache); > + > if (info->value->has_io_status) { > monitor_printf(mon, " io-status=%s", > > BlockDeviceIoStatus_lookup[info->value->io_status]); > >