qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] quorum: add child name into filename


From: Wen Congyang
Subject: [Qemu-devel] [PATCH] quorum: add child name into filename
Date: Fri, 18 Mar 2016 11:21:34 +0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

The monitor command 'query-block' or 'info block' will output the filename.
So we can get each children's child-name after this patch. This useful for
dynamic reconfiguration.

Signed-off-by: Wen Congyang <address@hidden>
---
 block/quorum.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/block/quorum.c b/block/quorum.c
index da15465..182766a 100644
--- a/block/quorum.c
+++ b/block/quorum.c
@@ -1036,9 +1036,13 @@ static void quorum_refresh_filename(BlockDriverState 
*bs, QDict *options)
 
     children = qlist_new();
     for (i = 0; i < s->num_children; i++) {
-        QINCREF(s->children[i]->bs->full_open_options);
-        qlist_append_obj(children,
-                         QOBJECT(s->children[i]->bs->full_open_options));
+        QDict *child_opts;
+        const char *child_name = s->children[i]->name;
+
+        child_opts = 
qdict_clone_shallow(s->children[i]->bs->full_open_options);
+        qdict_put_obj(child_opts, "child-name",
+                      QOBJECT(qstring_from_str(child_name)));
+        qlist_append_obj(children, QOBJECT(child_opts));
     }
 
     opts = qdict_new();
-- 
2.5.0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]