All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2] Display logical disk size in 'info block' output
@ 2011-09-02 16:38 Daniel P. Berrange
  2011-09-03 14:01 ` Stefan Hajnoczi
  2011-09-05 12:44 ` Kevin Wolf
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel P. Berrange @ 2011-09-02 16:38 UTC (permalink / raw)
  To: qemu-devel; +Cc: Daniel P. Berrange

From: "Daniel P. Berrange" <dan@berrange.com>

To aid in knowing whether a 'block_resize' was succesful, display
the logical disk size in bytes, in the 'info block' output

In v2:
  - Replace sectors with bytes

Signed-off-by: Daniel P. Berrange <dan@berrange.com>
---
 block.c         |    6 ++++--
 qmp-commands.hx |    1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/block.c b/block.c
index 03a21d8..03102ad 100644
--- a/block.c
+++ b/block.c
@@ -1844,6 +1844,7 @@ static void bdrv_print_dict(QObject *obj, void *opaque)
 
         monitor_printf(mon, " file=");
         monitor_print_filename(mon, qdict_get_str(qdict, "file"));
+        monitor_printf(mon, " length=%" PRId64, qdict_get_int(qdict, "length"));
         if (qdict_haskey(qdict, "backing_file")) {
             monitor_printf(mon, " backing_file=");
             monitor_print_filename(mon, qdict_get_str(qdict, "backing_file"));
@@ -1884,10 +1885,11 @@ void bdrv_info(Monitor *mon, QObject **ret_data)
             QDict *bs_dict = qobject_to_qdict(bs_obj);
 
             obj = qobject_from_jsonf("{ 'file': %s, 'ro': %i, 'drv': %s, "
-                                     "'encrypted': %i }",
+                                     "'encrypted': %i, 'length': %" PRId64 " }",
                                      bs->filename, bs->read_only,
                                      bs->drv->format_name,
-                                     bdrv_is_encrypted(bs));
+                                     bdrv_is_encrypted(bs),
+                                     bdrv_getlength(bs));
             if (bs->backing_file[0] != '\0') {
                 QDict *qdict = qobject_to_qdict(obj);
                 qdict_put(qdict, "backing_file",
diff --git a/qmp-commands.hx b/qmp-commands.hx
index 27cc66e..d185504 100644
--- a/qmp-commands.hx
+++ b/qmp-commands.hx
@@ -1134,6 +1134,7 @@ Each json-object contain the following:
 - "inserted": only present if the device is inserted, it is a json-object
    containing the following:
          - "file": device file name (json-string)
+         - "length": logical disk size in bytes (json-int)
          - "ro": true if read-only, false otherwise (json-bool)
          - "drv": driver format name (json-string)
              - Possible values: "blkdebug", "bochs", "cloop", "cow", "dmg",
-- 
1.7.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] Display logical disk size in 'info block' output
  2011-09-02 16:38 [Qemu-devel] [PATCH v2] Display logical disk size in 'info block' output Daniel P. Berrange
@ 2011-09-03 14:01 ` Stefan Hajnoczi
  2011-09-05 12:44 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2011-09-03 14:01 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: qemu-devel

On Fri, Sep 2, 2011 at 5:38 PM, Daniel P. Berrange <dan@berrange.com> wrote:
> From: "Daniel P. Berrange" <dan@berrange.com>
>
> To aid in knowing whether a 'block_resize' was succesful, display
> the logical disk size in bytes, in the 'info block' output
>
> In v2:
>  - Replace sectors with bytes
>
> Signed-off-by: Daniel P. Berrange <dan@berrange.com>
> ---
>  block.c         |    6 ++++--
>  qmp-commands.hx |    1 +
>  2 files changed, 5 insertions(+), 2 deletions(-)

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Qemu-devel] [PATCH v2] Display logical disk size in 'info block' output
  2011-09-02 16:38 [Qemu-devel] [PATCH v2] Display logical disk size in 'info block' output Daniel P. Berrange
  2011-09-03 14:01 ` Stefan Hajnoczi
@ 2011-09-05 12:44 ` Kevin Wolf
  1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2011-09-05 12:44 UTC (permalink / raw)
  To: Daniel P. Berrange; +Cc: qemu-devel

Am 02.09.2011 18:38, schrieb Daniel P. Berrange:
> From: "Daniel P. Berrange" <dan@berrange.com>
> 
> To aid in knowing whether a 'block_resize' was succesful, display
> the logical disk size in bytes, in the 'info block' output
> 
> In v2:
>   - Replace sectors with bytes
> 
> Signed-off-by: Daniel P. Berrange <dan@berrange.com>
> ---
>  block.c         |    6 ++++--
>  qmp-commands.hx |    1 +
>  2 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/block.c b/block.c
> index 03a21d8..03102ad 100644
> --- a/block.c
> +++ b/block.c
> @@ -1844,6 +1844,7 @@ static void bdrv_print_dict(QObject *obj, void *opaque)
>  
>          monitor_printf(mon, " file=");
>          monitor_print_filename(mon, qdict_get_str(qdict, "file"));
> +        monitor_printf(mon, " length=%" PRId64, qdict_get_int(qdict, "length"));

What about using get_human_readable_size() here? Or maybe we should
rather introduce an option that selects readable units or bytes for all
of the statistics? (The latter would be a separate patch, obviously)

Looks good to me otherwise, so if you don't like my suggestion I'll
merge it as it is.

Kevin

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-09-05 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-02 16:38 [Qemu-devel] [PATCH v2] Display logical disk size in 'info block' output Daniel P. Berrange
2011-09-03 14:01 ` Stefan Hajnoczi
2011-09-05 12:44 ` Kevin Wolf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.