diff options
author | Luiz Capitulino <lcapitulino@redhat.com> | 2013-06-07 14:33:48 -0400 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2013-06-17 11:01:14 -0400 |
commit | 0eef407c7b4130d13138c1f75d9975165433f654 (patch) | |
tree | 34bb0c4b6ecc559b6947c2c63c40ea1c07104c64 | |
parent | dacc26aae5d291317a3277970a4f39a562939a78 (diff) |
blockdev: use error_setg_file_open()
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
-rw-r--r-- | blockdev.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/blockdev.c b/blockdev.c index 9937311aac..5975dde5d0 100644 --- a/blockdev.c +++ b/blockdev.c @@ -899,7 +899,7 @@ static void external_snapshot_prepare(BlkTransactionStates *common, ret = bdrv_open(states->new_bs, new_image_file, NULL, flags | BDRV_O_NO_BACKING, drv); if (ret != 0) { - error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file); + error_setg_file_open(errp, -ret, new_image_file); } } @@ -1062,8 +1062,11 @@ static void qmp_bdrv_open_encrypted(BlockDriverState *bs, const char *filename, int bdrv_flags, BlockDriver *drv, const char *password, Error **errp) { - if (bdrv_open(bs, filename, NULL, bdrv_flags, drv) < 0) { - error_set(errp, QERR_OPEN_FILE_FAILED, filename); + int ret; + + ret = bdrv_open(bs, filename, NULL, bdrv_flags, drv); + if (ret < 0) { + error_setg_file_open(errp, -ret, filename); return; } @@ -1483,7 +1486,7 @@ void qmp_drive_mirror(const char *device, const char *target, if (ret < 0) { bdrv_delete(target_bs); - error_set(errp, QERR_OPEN_FILE_FAILED, target); + error_setg_file_open(errp, -ret, target); return; } |