summaryrefslogtreecommitdiffstats
path: root/block.c
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2015-03-03 01:28:54 +0000
committerPeter Maydell <peter.maydell@linaro.org>2015-03-03 01:28:54 +0000
commit5efde22aa781d37df58f0060430f459491dcfd62 (patch)
tree49fa5a0ded22f789863a85bc27e42d4165e442ec /block.c
parent0856579cac2f1dacecd847cfcd89680d26ff78f5 (diff)
parentb3adf5acb57dee14a74e57ab4f16cd1a83e5a7d2 (diff)
downloadhqemu-5efde22aa781d37df58f0060430f459491dcfd62.zip
hqemu-5efde22aa781d37df58f0060430f459491dcfd62.tar.gz
Merge remote-tracking branch 'remotes/armbru/tags/pull-error-2015-02-26' into staging
QemuOpts: Convert various setters to Error # gpg: Signature made Thu Feb 26 13:56:43 2015 GMT using RSA key ID EB918653 # gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" # gpg: aka "Markus Armbruster <armbru@pond.sub.org>" * remotes/armbru/tags/pull-error-2015-02-26: qtest: Use qemu_opt_set() instead of qemu_opts_parse() pc: Use qemu_opt_set() instead of qemu_opts_parse() qemu-sockets: Simplify setting numeric and boolean options block: Simplify setting numeric options qemu-img: Suppress unhelpful extra errors in convert, amend QemuOpts: Propagate errors through opts_parse() QemuOpts: Propagate errors through opts_do_parse() QemuOpts: Drop qemu_opt_set(), rename qemu_opt_set_err(), fix use block: Suppress unhelpful extra errors in bdrv_img_create() qemu-img: Suppress unhelpful extra errors in convert, resize QemuOpts: Convert qemu_opts_set() to Error, fix its use QemuOpts: Convert qemu_opt_set_number() to Error, fix its use QemuOpts: Convert qemu_opt_set_bool() to Error, fix its use Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'block.c')
-rw-r--r--block.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/block.c b/block.c
index 9b707e3..28ea19a 100644
--- a/block.c
+++ b/block.c
@@ -1364,7 +1364,7 @@ int bdrv_append_temp_snapshot(BlockDriverState *bs, int flags, Error **errp)
opts = qemu_opts_create(bdrv_qcow2.create_opts, NULL, 0,
&error_abort);
- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, total_size);
+ qemu_opt_set_number(opts, BLOCK_OPT_SIZE, total_size, &error_abort);
ret = bdrv_create(&bdrv_qcow2, tmp_filename, opts, &local_err);
qemu_opts_del(opts);
if (ret < 0) {
@@ -5649,18 +5649,22 @@ void bdrv_img_create(const char *filename, const char *fmt,
/* Create parameter list with default values */
opts = qemu_opts_create(create_opts, NULL, 0, &error_abort);
- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, img_size);
+ qemu_opt_set_number(opts, BLOCK_OPT_SIZE, img_size, &error_abort);
/* Parse -o options */
if (options) {
- if (qemu_opts_do_parse(opts, options, NULL) != 0) {
+ qemu_opts_do_parse(opts, options, NULL, &local_err);
+ if (local_err) {
+ error_report_err(local_err);
+ local_err = NULL;
error_setg(errp, "Invalid options for file format '%s'", fmt);
goto out;
}
}
if (base_filename) {
- if (qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename)) {
+ qemu_opt_set(opts, BLOCK_OPT_BACKING_FILE, base_filename, &local_err);
+ if (local_err) {
error_setg(errp, "Backing file not supported for file format '%s'",
fmt);
goto out;
@@ -5668,7 +5672,8 @@ void bdrv_img_create(const char *filename, const char *fmt,
}
if (base_fmt) {
- if (qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt)) {
+ qemu_opt_set(opts, BLOCK_OPT_BACKING_FMT, base_fmt, &local_err);
+ if (local_err) {
error_setg(errp, "Backing file format not supported for file "
"format '%s'", fmt);
goto out;
@@ -5731,7 +5736,7 @@ void bdrv_img_create(const char *filename, const char *fmt,
goto out;
}
- qemu_opt_set_number(opts, BLOCK_OPT_SIZE, size);
+ qemu_opt_set_number(opts, BLOCK_OPT_SIZE, size, &error_abort);
bdrv_unref(bs);
} else {
OpenPOWER on IntegriCloud