diff options
author | Kevin Wolf <kwolf@redhat.com> | 2014-03-12 15:59:16 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2014-03-19 09:39:41 +0100 |
commit | 5a8a30db4771675480829d7d3bf35a138e9c35f1 (patch) | |
tree | f9ea39c07db48ca7edd89c462e45a2451682014e /block/qed.c | |
parent | 059b3527f0229f4d60fd77a317503d42abd5e50f (diff) |
block: Add error handling to bdrv_invalidate_cache()
If it returns an error, the migrated VM will not be started, but qemu
exits with an error message.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Benoit Canet <benoit@irqsave.net>
Diffstat (limited to 'block/qed.c')
-rw-r--r-- | block/qed.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/block/qed.c b/block/qed.c index 837accd39b..3bd9db9c85 100644 --- a/block/qed.c +++ b/block/qed.c @@ -1558,16 +1558,31 @@ static int bdrv_qed_change_backing_file(BlockDriverState *bs, return ret; } -static void bdrv_qed_invalidate_cache(BlockDriverState *bs) +static void bdrv_qed_invalidate_cache(BlockDriverState *bs, Error **errp) { BDRVQEDState *s = bs->opaque; + Error *local_err = NULL; + int ret; bdrv_qed_close(bs); - bdrv_invalidate_cache(bs->file); + bdrv_invalidate_cache(bs->file, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } memset(s, 0, sizeof(BDRVQEDState)); - bdrv_qed_open(bs, NULL, bs->open_flags, NULL); + ret = bdrv_qed_open(bs, NULL, bs->open_flags, &local_err); + if (local_err) { + error_setg(errp, "Could not reopen qed layer: %s", + error_get_pretty(local_err)); + error_free(local_err); + return; + } else if (ret < 0) { + error_setg_errno(errp, -ret, "Could not reopen qed layer"); + return; + } } static int bdrv_qed_check(BlockDriverState *bs, BdrvCheckResult *result, |