cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone
0a122b
From ec69926313e8edae11091849f536b1f16da53ab7 Mon Sep 17 00:00:00 2001
0a122b
From: Fam Zheng <famz@redhat.com>
0a122b
Date: Mon, 27 Jan 2014 07:46:43 +0100
0a122b
Subject: [PATCH 19/22] qapi: Add "backing" to BlockStats
0a122b
0a122b
RH-Author: Fam Zheng <famz@redhat.com>
0a122b
Message-id: <1390808803-6464-1-git-send-email-famz@redhat.com>
0a122b
Patchwork-id: 56952
0a122b
O-Subject: [RHEL-7 qemu-kvm PATCH] qapi: Add "backing" to BlockStats
0a122b
Bugzilla: 1041564
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
0a122b
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
0a122b
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1041564
0a122b
Brew:     https://brewweb.devel.redhat.com/taskinfo?taskID=6949016
0a122b
0a122b
Currently there is no way to query BlockStats of the backing chain. This
0a122b
adds "backing" field into BlockStats to make it possible.
0a122b
0a122b
The comment of "parent" is reworded.
0a122b
0a122b
Signed-off-by: Fam Zheng <famz@redhat.com>
0a122b
Reviewed-by: Benoit Canet <benoit@irqsave.net>
0a122b
Reviewed-by: Eric Blake <eblake@redhat.com>
0a122b
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
0a122b
(cherry picked from commit c8059b97e1f9b4635b836ee98373a0f72f9fc0b4)
0a122b
Signed-off-by: Fam Zheng <famz@redhat.com>
0a122b
---
0a122b
 block/qapi.c     |  5 +++++
0a122b
 qapi-schema.json | 10 ++++++----
0a122b
 2 files changed, 11 insertions(+), 4 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 block/qapi.c     |    5 +++++
0a122b
 qapi-schema.json |   10 ++++++----
0a122b
 2 files changed, 11 insertions(+), 4 deletions(-)
0a122b
0a122b
diff --git a/block/qapi.c b/block/qapi.c
0a122b
index 87423fb..77e1719 100644
0a122b
--- a/block/qapi.c
0a122b
+++ b/block/qapi.c
0a122b
@@ -295,6 +295,11 @@ BlockStats *bdrv_query_stats(const BlockDriverState *bs)
0a122b
         s->parent = bdrv_query_stats(bs->file);
0a122b
     }
0a122b
 
0a122b
+    if (bs->backing_hd) {
0a122b
+        s->has_backing = true;
0a122b
+        s->backing = bdrv_query_stats(bs->backing_hd);
0a122b
+    }
0a122b
+
0a122b
     return s;
0a122b
 }
0a122b
 
0a122b
diff --git a/qapi-schema.json b/qapi-schema.json
0a122b
index 6158ea5..8b257e2 100644
0a122b
--- a/qapi-schema.json
0a122b
+++ b/qapi-schema.json
0a122b
@@ -1007,15 +1007,17 @@
0a122b
 #
0a122b
 # @stats:  A @BlockDeviceStats for the device.
0a122b
 #
0a122b
-# @parent: #optional This may point to the backing block device if this is a
0a122b
-#          a virtual block device.  If it's a backing block, this will point
0a122b
-#          to the backing file is one is present.
0a122b
+# @parent: #optional This describes the file block device if it has one.
0a122b
+#
0a122b
+# @backing: #optional This describes the backing block device if it has one.
0a122b
+#           (Since 2.0)
0a122b
 #
0a122b
 # Since: 0.14.0
0a122b
 ##
0a122b
 { 'type': 'BlockStats',
0a122b
   'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
0a122b
-           '*parent': 'BlockStats'} }
0a122b
+           '*parent': 'BlockStats',
0a122b
+           '*backing': 'BlockStats'} }
0a122b
 
0a122b
 ##
0a122b
 # @query-blockstats:
0a122b
-- 
0a122b
1.7.1
0a122b