diff options
author | Anthony Liguori <aliguori@us.ibm.com> | 2012-12-13 14:32:28 -0600 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-12-13 14:32:28 -0600 |
commit | e376a788ae130454ad5e797f60cb70d0308babb6 (patch) | |
tree | 9d2c8de79443bcbaad87e03fa2eb7267366608ea /blockdev.c | |
parent | df9330070e671134544f872dc5c027443878b764 (diff) | |
parent | 226c3c26b9800b7c6a8d3100e1faad6d2b97b0f5 (diff) |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
* kwolf/for-anthony: (43 commits)
qcow2: Factor out handle_dependencies()
qcow2: Execute run_dependent_requests() without lock
qcow2: Enable dirty flag in qcow2_alloc_cluster_link_l2
qcow2: Allocate l2meta only for cluster allocations
qcow2: Drop l2meta.cluster_offset
qcow2: Allocate l2meta dynamically
qcow2: Introduce Qcow2COWRegion
qcow2: Round QCowL2Meta.offset down to cluster boundary
atapi: reset cdrom tray statuses on ide_reset
qemu-iotests: Test concurrent cluster allocations
qcow2: Move BLKDBG_EVENT out of the lock
qemu-io: Add AIO debugging commands
blkdebug: Implement suspend/resume of AIO requests
blkdebug: Factor out remove_rule()
blkdebug: Allow usage without config file
create new function: qemu_opt_set_number
use qemu_opts_create_nofail
introduce qemu_opts_create_nofail function
qemu-option: qemu_opt_set_bool(): fix code duplication
qemu-option: qemu_opts_validate(): fix duplicated code
...
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/blockdev.c b/blockdev.c index e73fd6e388..9a05e57009 100644 --- a/blockdev.c +++ b/blockdev.c @@ -275,7 +275,7 @@ static bool do_check_io_limits(BlockIOLimit *io_limits) return true; } -DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) +DriveInfo *drive_init(QemuOpts *opts, BlockInterfaceType block_default_type) { const char *buf; const char *file = NULL; @@ -325,7 +325,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) return NULL; } } else { - type = default_to_scsi ? IF_SCSI : IF_IDE; + type = block_default_type; } max_devs = if_max_devs[type]; @@ -568,7 +568,7 @@ DriveInfo *drive_init(QemuOpts *opts, int default_to_scsi) break; case IF_VIRTIO: /* add virtio block device */ - opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0, NULL); + opts = qemu_opts_create_nofail(qemu_find_opts("device")); if (arch_type == QEMU_ARCH_S390X) { qemu_opt_set(opts, "driver", "virtio-blk-s390"); } else { @@ -707,6 +707,7 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) int ret = 0; BlockdevActionList *dev_entry = dev_list; BlkTransactionStates *states, *next; + Error *local_err = NULL; QSIMPLEQ_HEAD(snap_bdrv_states, BlkTransactionStates) snap_bdrv_states; QSIMPLEQ_INIT(&snap_bdrv_states); @@ -786,12 +787,12 @@ void qmp_transaction(BlockdevActionList *dev_list, Error **errp) /* create new image w/backing file */ if (mode != NEW_IMAGE_MODE_EXISTING) { - ret = bdrv_img_create(new_image_file, format, - states->old_bs->filename, - states->old_bs->drv->format_name, - NULL, -1, flags); - if (ret) { - error_set(errp, QERR_OPEN_FILE_FAILED, new_image_file); + bdrv_img_create(new_image_file, format, + states->old_bs->filename, + states->old_bs->drv->format_name, + NULL, -1, flags, &local_err); + if (error_is_set(&local_err)) { + error_propagate(errp, local_err); goto delete_and_fail; } } @@ -1263,8 +1264,8 @@ void qmp_drive_mirror(const char *device, const char *target, assert(format && drv); bdrv_get_geometry(bs, &size); size *= 512; - ret = bdrv_img_create(target, format, - NULL, NULL, NULL, size, flags); + bdrv_img_create(target, format, + NULL, NULL, NULL, size, flags, &local_err); } else { switch (mode) { case NEW_IMAGE_MODE_EXISTING: @@ -1272,18 +1273,18 @@ void qmp_drive_mirror(const char *device, const char *target, break; case NEW_IMAGE_MODE_ABSOLUTE_PATHS: /* create new image with backing file */ - ret = bdrv_img_create(target, format, - source->filename, - source->drv->format_name, - NULL, -1, flags); + bdrv_img_create(target, format, + source->filename, + source->drv->format_name, + NULL, -1, flags, &local_err); break; default: abort(); } } - if (ret) { - error_set(errp, QERR_OPEN_FILE_FAILED, target); + if (error_is_set(&local_err)) { + error_propagate(errp, local_err); return; } |