qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Wen Congyang <wency@cn.fujitsu.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Alberto Garcia <berto@igalia.com>,
	zhanghailiang <zhang.zhanghailiang@huawei.com>,
	qemu block <qemu-block@nongnu.org>,
	Jiang Yunhong <yunhong.jiang@intel.com>,
	Dong Eddie <eddie.dong@intel.com>,
	qemu devel <qemu-devel@nongnu.org>,
	Markus Armbruster <armbru@redhat.com>,
	Gonglei <arei.gonglei@huawei.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Yang Hongyang <yanghy@cn.fujitsu.com>
Subject: Re: [Qemu-devel] [PATCH v5 1/4] Add new block driver interface to add/delete a BDS's child
Date: Thu, 8 Oct 2015 19:44:33 +0100	[thread overview]
Message-ID: <20151008184432.GB12531@work-vm> (raw)
In-Reply-To: <5615CEFF.6060401@cn.fujitsu.com>

* Wen Congyang (wency@cn.fujitsu.com) wrote:
> On 10/08/2015 03:00 AM, Dr. David Alan Gilbert wrote:
> > * Wen Congyang (wency@cn.fujitsu.com) wrote:
> >> In some cases, we want to take a quorum child offline, and take
> >> another child online.
> > 
> > Hi,
> >   Have you checked the output of 'info block' after adding/deleting a child?
> > I'm using one of your older worlds (from a few months ago) and I found I had
> > to add a 
> > 
> >     bdrv_refresh_filename(bs);
> > 
> > to get the output of 'info block' to show the new child.
> > I don't see it in this version.
> 
> Max sent a patch series to drop BDS.filename, so I don't call bdrv_refresh_filename()
> here. If the BDS is not the top BDS, 'info block' still shows the wrong child.

Ah, so I guess you can just implement the exact_filename() function and that
will get it right?

Dave
> 
> Thanks
> Wen Congyang
> 
> > 
> > Dave
> > 
> > 
> >>
> >> Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
> >> Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
> >> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> >> Reviewed-by: Eric Blake <eblake@redhat.com>
> >> ---
> >>  block.c                   | 50 +++++++++++++++++++++++++++++++++++++++++++++++
> >>  include/block/block.h     |  5 +++++
> >>  include/block/block_int.h |  5 +++++
> >>  3 files changed, 60 insertions(+)
> >>
> >> diff --git a/block.c b/block.c
> >> index e815d73..1b25e43 100644
> >> --- a/block.c
> >> +++ b/block.c
> >> @@ -4265,3 +4265,53 @@ BlockAcctStats *bdrv_get_stats(BlockDriverState *bs)
> >>  {
> >>      return &bs->stats;
> >>  }
> >> +
> >> +/*
> >> + * Hot add/remove a BDS's child. So the user can take a child offline when
> >> + * it is broken and take a new child online
> >> + */
> >> +void bdrv_add_child(BlockDriverState *parent_bs, BlockDriverState *child_bs,
> >> +                    Error **errp)
> >> +{
> >> +
> >> +    if (!parent_bs->drv || !parent_bs->drv->bdrv_add_child) {
> >> +        error_setg(errp, "The BDS %s doesn't support adding a child",
> >> +                   bdrv_get_device_or_node_name(parent_bs));
> >> +        return;
> >> +    }
> >> +
> >> +    if (!QLIST_EMPTY(&child_bs->parents)) {
> >> +        error_setg(errp, "The BDS %s already has parent",
> >> +                   child_bs->node_name);
> >> +        return;
> >> +    }
> >> +
> >> +    parent_bs->drv->bdrv_add_child(parent_bs, child_bs, errp);
> >> +}
> >> +
> >> +void bdrv_del_child(BlockDriverState *parent_bs, BlockDriverState *child_bs,
> >> +                    Error **errp)
> >> +{
> >> +    BdrvChild *child;
> >> +
> >> +    if (!parent_bs->drv || !parent_bs->drv->bdrv_del_child) {
> >> +        error_setg(errp, "The BDS %s doesn't support removing a child",
> >> +                   bdrv_get_device_or_node_name(parent_bs));
> >> +        return;
> >> +    }
> >> +
> >> +    QLIST_FOREACH(child, &parent_bs->children, next) {
> >> +        if (child->bs == child_bs) {
> >> +            break;
> >> +        }
> >> +    }
> >> +
> >> +    if (!child) {
> >> +        error_setg(errp, "BDS %s is not a child of %s",
> >> +                   bdrv_get_device_or_node_name(child_bs),
> >> +                   bdrv_get_device_or_node_name(parent_bs));
> >> +        return;
> >> +    }
> >> +
> >> +    parent_bs->drv->bdrv_del_child(parent_bs, child_bs, errp);
> >> +}
> >> diff --git a/include/block/block.h b/include/block/block.h
> >> index ef67353..665c56f 100644
> >> --- a/include/block/block.h
> >> +++ b/include/block/block.h
> >> @@ -616,4 +616,9 @@ void bdrv_flush_io_queue(BlockDriverState *bs);
> >>  
> >>  BlockAcctStats *bdrv_get_stats(BlockDriverState *bs);
> >>  
> >> +void bdrv_add_child(BlockDriverState *parent, BlockDriverState *child,
> >> +                    Error **errp);
> >> +void bdrv_del_child(BlockDriverState *parent, BlockDriverState *child,
> >> +                    Error **errp);
> >> +
> >>  #endif
> >> diff --git a/include/block/block_int.h b/include/block/block_int.h
> >> index 2f2c47b..64cbc55 100644
> >> --- a/include/block/block_int.h
> >> +++ b/include/block/block_int.h
> >> @@ -288,6 +288,11 @@ struct BlockDriver {
> >>       */
> >>      int (*bdrv_probe_geometry)(BlockDriverState *bs, HDGeometry *geo);
> >>  
> >> +    void (*bdrv_add_child)(BlockDriverState *parent, BlockDriverState *child,
> >> +                           Error **errp);
> >> +    void (*bdrv_del_child)(BlockDriverState *parent, BlockDriverState *child,
> >> +                           Error **errp);
> >> +
> >>      QLIST_ENTRY(BlockDriver) list;
> >>  };
> >>  
> >> -- 
> >> 2.4.3
> >>
> > --
> > Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
> > .
> > 
> 
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK

  reply	other threads:[~2015-10-08 18:44 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-22  7:44 [Qemu-devel] [PATCH v5 0/4] qapi: child add/delete support Wen Congyang
2015-09-22  7:44 ` [Qemu-devel] [PATCH v5 1/4] Add new block driver interface to add/delete a BDS's child Wen Congyang
2015-10-07 13:35   ` Alberto Garcia
2015-10-08  2:05     ` Wen Congyang
2015-10-07 18:33   ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-10-08  2:06     ` Wen Congyang
2015-10-07 19:00   ` [Qemu-devel] " Dr. David Alan Gilbert
2015-10-08  2:03     ` Wen Congyang
2015-10-08 18:44       ` Dr. David Alan Gilbert [this message]
2015-09-22  7:44 ` [Qemu-devel] [PATCH v5 2/4] quorum: implement bdrv_add_child() and bdrv_del_child() Wen Congyang
2015-10-07 14:12   ` Alberto Garcia
2015-10-08  2:10     ` Wen Congyang
2015-10-07 18:51   ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-10-08  8:12     ` Alberto Garcia
2015-10-09 15:51       ` Max Reitz
2015-10-12 11:56         ` Alberto Garcia
2015-09-22  7:44 ` [Qemu-devel] [PATCH v5 3/4] qmp: add monitor command to add/remove a child Wen Congyang
2015-10-07 14:33   ` Alberto Garcia
2015-10-07 19:42   ` [Qemu-devel] [Qemu-block] " Max Reitz
2015-10-08  6:15     ` Markus Armbruster
2015-10-08  8:29       ` Alberto Garcia
2015-10-08 10:03         ` Kevin Wolf
2015-10-08 10:13           ` Alberto Garcia
2015-10-09 16:14         ` Max Reitz
2015-10-08 11:02       ` [Qemu-devel] Dynamic reconfiguration (was: qmp: add monitor command to add/remove a child) Kevin Wolf
2015-10-08 11:10         ` [Qemu-devel] [Qemu-block] " Kevin Wolf
2015-10-21  8:27           ` [Qemu-devel] [Qemu-block] Dynamic reconfiguration Markus Armbruster
2015-10-26  2:04             ` Wen Congyang
2015-10-26  7:24               ` Markus Armbruster
2015-10-26  7:25                 ` Wen Congyang
2015-10-09 16:13       ` [Qemu-devel] [Qemu-block] [PATCH v5 3/4] qmp: add monitor command to add/remove a child Max Reitz
2015-10-09 16:42         ` Dr. David Alan Gilbert
2015-10-09 18:24           ` Max Reitz
2015-10-12  8:07             ` Dr. David Alan Gilbert
2015-10-12  8:18             ` Kevin Wolf
2015-10-12  7:58           ` Markus Armbruster
2015-10-12  7:56         ` Markus Armbruster
2015-10-12 16:27     ` Max Reitz
2015-09-22  7:44 ` [Qemu-devel] [PATCH v5 4/4] hmp: " Wen Congyang
2015-10-07 14:38   ` Alberto Garcia
2015-09-22 11:15 ` [Qemu-devel] [PATCH v5 0/4] qapi: child add/delete support Dr. David Alan Gilbert
2015-09-23  1:08   ` Wen Congyang
2015-09-23  9:21     ` Dr. David Alan Gilbert
2015-09-23  9:30       ` Wen Congyang
2015-10-07  6:40 ` Wen Congyang

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=20151008184432.GB12531@work-vm \
    --to=dgilbert@redhat.com \
    --cc=arei.gonglei@huawei.com \
    --cc=armbru@redhat.com \
    --cc=berto@igalia.com \
    --cc=eddie.dong@intel.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=wency@cn.fujitsu.com \
    --cc=yanghy@cn.fujitsu.com \
    --cc=yunhong.jiang@intel.com \
    --cc=zhang.zhanghailiang@huawei.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).