|
|
9ae3a8 |
From 7f2252627e64e975707b01eb1f4da7c2015ca457 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Date: Mon, 2 Jun 2014 13:54:43 +0200
|
|
|
9ae3a8 |
Subject: [PATCH 26/31] qcow: correctly propagate errors
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1401717288-3918-2-git-send-email-kwolf@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 59096
|
|
|
9ae3a8 |
O-Subject: [RHEL-7.1/7.0.z qemu-kvm PATCH 1/6] qcow: correctly propagate errors
|
|
|
9ae3a8 |
Bugzilla: 1097229 1097230
|
|
|
9ae3a8 |
RH-Acked-by: Max Reitz <mreitz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
From: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1097230
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Fam Zheng <famz@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit b6d5066d32f9e6c3d7508c1af9ae78327a927120)
|
|
|
9ae3a8 |
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/qcow.c | 12 ++++++------
|
|
|
9ae3a8 |
1 file changed, 6 insertions(+), 6 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
block/qcow.c | 12 ++++++------
|
|
|
9ae3a8 |
1 files changed, 6 insertions(+), 6 deletions(-)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/block/qcow.c b/block/qcow.c
|
|
|
9ae3a8 |
index c470e05..b57b900 100644
|
|
|
9ae3a8 |
--- a/block/qcow.c
|
|
|
9ae3a8 |
+++ b/block/qcow.c
|
|
|
9ae3a8 |
@@ -119,17 +119,19 @@ static int qcow_open(BlockDriverState *bs, QDict *options, int flags,
|
|
|
9ae3a8 |
if (header.version != QCOW_VERSION) {
|
|
|
9ae3a8 |
char version[64];
|
|
|
9ae3a8 |
snprintf(version, sizeof(version), "QCOW version %d", header.version);
|
|
|
9ae3a8 |
- qerror_report(QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
|
|
9ae3a8 |
- bs->device_name, "qcow", version);
|
|
|
9ae3a8 |
+ error_set(errp, QERR_UNKNOWN_BLOCK_FORMAT_FEATURE,
|
|
|
9ae3a8 |
+ bs->device_name, "qcow", version);
|
|
|
9ae3a8 |
ret = -ENOTSUP;
|
|
|
9ae3a8 |
goto fail;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
if (header.size <= 1 || header.cluster_bits < 9) {
|
|
|
9ae3a8 |
+ error_setg(errp, "invalid value in qcow header");
|
|
|
9ae3a8 |
ret = -EINVAL;
|
|
|
9ae3a8 |
goto fail;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
if (header.crypt_method > QCOW_CRYPT_AES) {
|
|
|
9ae3a8 |
+ error_setg(errp, "invalid encryption method in qcow header");
|
|
|
9ae3a8 |
ret = -EINVAL;
|
|
|
9ae3a8 |
goto fail;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
@@ -686,15 +688,13 @@ static int qcow_create(const char *filename, QEMUOptionParameter *options,
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
ret = bdrv_create_file(filename, options, &local_err);
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
- qerror_report_err(local_err);
|
|
|
9ae3a8 |
- error_free(local_err);
|
|
|
9ae3a8 |
+ error_propagate(errp, local_err);
|
|
|
9ae3a8 |
return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
ret = bdrv_file_open(&qcow_bs, filename, NULL, BDRV_O_RDWR, &local_err);
|
|
|
9ae3a8 |
if (ret < 0) {
|
|
|
9ae3a8 |
- qerror_report_err(local_err);
|
|
|
9ae3a8 |
- error_free(local_err);
|
|
|
9ae3a8 |
+ error_propagate(errp, local_err);
|
|
|
9ae3a8 |
return ret;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.7.1
|
|
|
9ae3a8 |
|