thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
Blob Blame History Raw
From ec69926313e8edae11091849f536b1f16da53ab7 Mon Sep 17 00:00:00 2001
From: Fam Zheng <famz@redhat.com>
Date: Mon, 27 Jan 2014 07:46:43 +0100
Subject: [PATCH 19/22] qapi: Add "backing" to BlockStats

RH-Author: Fam Zheng <famz@redhat.com>
Message-id: <1390808803-6464-1-git-send-email-famz@redhat.com>
Patchwork-id: 56952
O-Subject: [RHEL-7 qemu-kvm PATCH] qapi: Add "backing" to BlockStats
Bugzilla: 1041564
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1041564
Brew:     https://brewweb.devel.redhat.com/taskinfo?taskID=6949016

Currently there is no way to query BlockStats of the backing chain. This
adds "backing" field into BlockStats to make it possible.

The comment of "parent" is reworded.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
(cherry picked from commit c8059b97e1f9b4635b836ee98373a0f72f9fc0b4)
Signed-off-by: Fam Zheng <famz@redhat.com>
---
 block/qapi.c     |  5 +++++
 qapi-schema.json | 10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 block/qapi.c     |    5 +++++
 qapi-schema.json |   10 ++++++----
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/block/qapi.c b/block/qapi.c
index 87423fb..77e1719 100644
--- a/block/qapi.c
+++ b/block/qapi.c
@@ -295,6 +295,11 @@ BlockStats *bdrv_query_stats(const BlockDriverState *bs)
         s->parent = bdrv_query_stats(bs->file);
     }
 
+    if (bs->backing_hd) {
+        s->has_backing = true;
+        s->backing = bdrv_query_stats(bs->backing_hd);
+    }
+
     return s;
 }
 
diff --git a/qapi-schema.json b/qapi-schema.json
index 6158ea5..8b257e2 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1007,15 +1007,17 @@
 #
 # @stats:  A @BlockDeviceStats for the device.
 #
-# @parent: #optional This may point to the backing block device if this is a
-#          a virtual block device.  If it's a backing block, this will point
-#          to the backing file is one is present.
+# @parent: #optional This describes the file block device if it has one.
+#
+# @backing: #optional This describes the backing block device if it has one.
+#           (Since 2.0)
 #
 # Since: 0.14.0
 ##
 { 'type': 'BlockStats',
   'data': {'*device': 'str', 'stats': 'BlockDeviceStats',
-           '*parent': 'BlockStats'} }
+           '*parent': 'BlockStats',
+           '*backing': 'BlockStats'} }
 
 ##
 # @query-blockstats:
-- 
1.7.1