提交 0eac5986 编写于 作者: P Peter Maydell

Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

# gpg: Signature made Wed 02 Sep 2015 17:01:33 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/block-pull-request:
  block: more check for replaced node
  MAINTAINERS: add responsible person for Parallels format driver
Signed-off-by: NPeter Maydell <peter.maydell@linaro.org>
...@@ -1307,6 +1307,7 @@ F: block/dmg.c ...@@ -1307,6 +1307,7 @@ F: block/dmg.c
parallels parallels
M: Stefan Hajnoczi <stefanha@redhat.com> M: Stefan Hajnoczi <stefanha@redhat.com>
M: Denis V. Lunev <den@openvz.org>
L: qemu-block@nongnu.org L: qemu-block@nongnu.org
S: Supported S: Supported
F: block/parallels.c F: block/parallels.c
......
...@@ -4077,7 +4077,8 @@ bool bdrv_is_first_non_filter(BlockDriverState *candidate) ...@@ -4077,7 +4077,8 @@ bool bdrv_is_first_non_filter(BlockDriverState *candidate)
return false; return false;
} }
BlockDriverState *check_to_replace_node(const char *node_name, Error **errp) BlockDriverState *check_to_replace_node(BlockDriverState *parent_bs,
const char *node_name, Error **errp)
{ {
BlockDriverState *to_replace_bs = bdrv_find_node(node_name); BlockDriverState *to_replace_bs = bdrv_find_node(node_name);
AioContext *aio_context; AioContext *aio_context;
...@@ -4100,7 +4101,7 @@ BlockDriverState *check_to_replace_node(const char *node_name, Error **errp) ...@@ -4100,7 +4101,7 @@ BlockDriverState *check_to_replace_node(const char *node_name, Error **errp)
* Another benefit is that this tests exclude backing files which are * Another benefit is that this tests exclude backing files which are
* blocked by the backing blockers. * blocked by the backing blockers.
*/ */
if (!bdrv_is_first_non_filter(to_replace_bs)) { if (!bdrv_recurse_is_first_non_filter(parent_bs, to_replace_bs)) {
error_setg(errp, "Only top most non filter can be replaced"); error_setg(errp, "Only top most non filter can be replaced");
to_replace_bs = NULL; to_replace_bs = NULL;
goto out; goto out;
......
...@@ -644,9 +644,9 @@ static void mirror_complete(BlockJob *job, Error **errp) ...@@ -644,9 +644,9 @@ static void mirror_complete(BlockJob *job, Error **errp)
if (s->replaces) { if (s->replaces) {
AioContext *replace_aio_context; AioContext *replace_aio_context;
s->to_replace = check_to_replace_node(s->replaces, &local_err); s->to_replace = bdrv_find_node(s->replaces);
if (!s->to_replace) { if (!s->to_replace) {
error_propagate(errp, local_err); error_setg(errp, "Node name '%s' not found", s->replaces);
return; return;
} }
......
...@@ -2760,7 +2760,7 @@ void qmp_drive_mirror(const char *device, const char *target, ...@@ -2760,7 +2760,7 @@ void qmp_drive_mirror(const char *device, const char *target,
goto out; goto out;
} }
to_replace_bs = check_to_replace_node(replaces, &local_err); to_replace_bs = check_to_replace_node(bs, replaces, &local_err);
if (!to_replace_bs) { if (!to_replace_bs) {
error_propagate(errp, local_err); error_propagate(errp, local_err);
......
...@@ -317,7 +317,8 @@ bool bdrv_recurse_is_first_non_filter(BlockDriverState *bs, ...@@ -317,7 +317,8 @@ bool bdrv_recurse_is_first_non_filter(BlockDriverState *bs,
bool bdrv_is_first_non_filter(BlockDriverState *candidate); bool bdrv_is_first_non_filter(BlockDriverState *candidate);
/* check if a named node can be replaced when doing drive-mirror */ /* check if a named node can be replaced when doing drive-mirror */
BlockDriverState *check_to_replace_node(const char *node_name, Error **errp); BlockDriverState *check_to_replace_node(BlockDriverState *parent_bs,
const char *node_name, Error **errp);
/* async block I/O */ /* async block I/O */
typedef void BlockDriverDirtyHandler(BlockDriverState *bs, int64_t sector, typedef void BlockDriverDirtyHandler(BlockDriverState *bs, int64_t sector,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册