From: Peter Maydell Date: Thu, 20 Feb 2014 12:04:02 +0000 (+0000) Subject: Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging X-Git-Tag: qemu-xen-4.5.0-rc1~190 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4c0c9bbe78901a706497a8fa1a27935bafc20cf7;p=qemu-xen.git Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging * remotes/qmp-unstable/queue/qmp: monitor: Add object_add class argument completion. monitor: Add object_del id argument completion. monitor: Add device_add device argument completion. monitor: Add device_del id argument completion. qmp: expose list of supported character device backends Use error_is_set() only when necessary QMP: allow JSON dict arguments in qmp-shell hmp: migrate command (without -d) now blocks correctly Conflicts: blockdev.c [PMM: resolved trivial conflict in blockdev.c] Signed-off-by: Peter Maydell --- 4c0c9bbe78901a706497a8fa1a27935bafc20cf7 diff --cc blockdev.c index dfb5ec7529,be05a581a0..1c64bdae18 --- a/blockdev.c +++ b/blockdev.c @@@ -436,8 -437,13 +436,8 @@@ static DriveInfo *blockdev_init(const c on_write_error = BLOCKDEV_ON_ERROR_ENOSPC; if ((buf = qemu_opt_get(opts, "werror")) != NULL) { - if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && type != IF_NONE) { - error_setg(errp, "werror is not supported by this bus type"); - goto early_err; - } - on_write_error = parse_block_error_action(buf, 0, &error); - if (error_is_set(&error)) { + if (error) { error_propagate(errp, error); goto early_err; } @@@ -445,8 -451,13 +445,8 @@@ on_read_error = BLOCKDEV_ON_ERROR_REPORT; if ((buf = qemu_opt_get(opts, "rerror")) != NULL) { - if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && type != IF_NONE) { - error_report("rerror is not supported by this bus type"); - goto early_err; - } - on_read_error = parse_block_error_action(buf, 1, &error); - if (error_is_set(&error)) { + if (error) { error_propagate(errp, error); goto early_err; } @@@ -875,31 -872,10 +875,31 @@@ DriveInfo *drive_init(QemuOpts *all_opt filename = qemu_opt_get(legacy_opts, "file"); + /* Check werror/rerror compatibility with if=... */ + werror = qemu_opt_get(legacy_opts, "werror"); + if (werror != NULL) { + if (type != IF_IDE && type != IF_SCSI && type != IF_VIRTIO && + type != IF_NONE) { + error_report("werror is not supported by this bus type"); + goto fail; + } + qdict_put(bs_opts, "werror", qstring_from_str(werror)); + } + + rerror = qemu_opt_get(legacy_opts, "rerror"); + if (rerror != NULL) { + if (type != IF_IDE && type != IF_VIRTIO && type != IF_SCSI && + type != IF_NONE) { + error_report("rerror is not supported by this bus type"); + goto fail; + } + qdict_put(bs_opts, "rerror", qstring_from_str(rerror)); + } + /* Actual block device init: Functionality shared with blockdev-add */ - dinfo = blockdev_init(filename, bs_opts, type, &local_err); + dinfo = blockdev_init(filename, bs_opts, &local_err); if (dinfo == NULL) { - if (error_is_set(&local_err)) { + if (local_err) { qerror_report_err(local_err); error_free(local_err); } @@@ -2299,8 -2276,8 +2299,8 @@@ void qmp_blockdev_add(BlockdevOptions * qdict_flatten(qdict); - blockdev_init(NULL, qdict, IF_NONE, &local_err); + blockdev_init(NULL, qdict, &local_err); - if (error_is_set(&local_err)) { + if (local_err) { error_propagate(errp, local_err); goto fail; }