qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wen Congyang <wency@cn.fujitsu.com>
To: Alberto Garcia <berto@igalia.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, qemu-devl <qemu-devel@nongnu.org>
Cc: Changlong Xie <xiecl.fnst@cn.fujitsu.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH] quorum: add child name into filename
Date: Fri, 18 Mar 2016 11:21:34 +0800	[thread overview]
Message-ID: <56EB743E.8060500@cn.fujitsu.com> (raw)

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 <wency@cn.fujitsu.com>
---
 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	other threads:[~2016-03-18  3:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-18  3:21 Wen Congyang [this message]
2016-03-23 20:45 ` [Qemu-devel] [PATCH] quorum: add child name into filename Max Reitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56EB743E.8060500@cn.fujitsu.com \
    --to=wency@cn.fujitsu.com \
    --cc=berto@igalia.com \
    --cc=dgilbert@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=xiecl.fnst@cn.fujitsu.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).