Commit 33c6cae4 authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'kwolf/for-anthony' into staging



# By Max Reitz (30) and others
# Via Kevin Wolf
* kwolf/for-anthony: (61 commits)
  qemu-iotests: Add test for inactive L2 overlap
  qemu-io: Let "open" pass options to block driver
  vmdk: Fix vmdk_parse_extents
  blockdev: blockdev_init() error conversion
  blockdev: Don't disable COR automatically with blockdev-add
  blockdev: Remove 'media' parameter from blockdev_init()
  qemu-iotests: Check autodel behaviour for device_del
  blockdev: Remove IF_* check for read-only blockdev_init
  blockdev: Move virtio-blk device creation to drive_init
  blockdev: Move bus/unit/index processing to drive_init
  blockdev: Move parsing of 'boot' option to drive_init
  blockdev: Moving parsing of geometry options to drive_init
  blockdev: Move parsing of 'if' option to drive_init
  blockdev: Move parsing of 'media' option to drive_init
  blockdev: Pass QDict to blockdev_init()
  blockdev: Separate ID generation from DriveInfo creation
  blockdev: 'blockdev-add' QMP command
  blockdev: Introduce DriveInfo.enable_auto_del
  qapi-types/visit.py: Inheritance for structs
  qapi-types/visit.py: Pass whole expr dict for structs
  ...

Message-id: 1381503951-27985-1-git-send-email-kwolf@redhat.com
Signed-off-by: default avatarAnthony Liguori <aliguori@amazon.com>
parents 39c153b8 34eeb82d
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -246,7 +246,6 @@ clean:
	rm -f $(foreach f,$(GENERATED_SOURCES),$(f) $(f)-timestamp)
	rm -rf qapi-generated
	rm -rf qga/qapi-generated
	$(MAKE) -C tests/tcg clean
	for d in $(ALL_SUBDIRS); do \
	if test -d $$d; then $(MAKE) -C $$d $@ || exit 1; fi; \
	rm -f $$d/qemu-options.def; \
+48 −5
Original line number Diff line number Diff line
@@ -769,13 +769,22 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,
    bs->read_only = !(open_flags & BDRV_O_RDWR);

    if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) {
        error_setg(errp, "Driver '%s' is not whitelisted", drv->format_name);
        error_setg(errp,
                   !bs->read_only && bdrv_is_whitelisted(drv, true)
                        ? "Driver '%s' can only be used for read-only devices"
                        : "Driver '%s' is not whitelisted",
                   drv->format_name);
        return -ENOTSUP;
    }

    assert(bs->copy_on_read == 0); /* bdrv_new() and bdrv_close() make it so */
    if (!bs->read_only && (flags & BDRV_O_COPY_ON_READ)) {
    if (flags & BDRV_O_COPY_ON_READ) {
        if (!bs->read_only) {
            bdrv_enable_copy_on_read(bs);
        } else {
            error_setg(errp, "Can't use copy-on-read on read-only device");
            return -EINVAL;
        }
    }

    if (filename != NULL) {
@@ -881,7 +890,7 @@ int bdrv_file_open(BlockDriverState **pbs, const char *filename,
    /* Find the right block driver */
    drvname = qdict_get_try_str(options, "driver");
    if (drvname) {
        drv = bdrv_find_whitelisted_format(drvname, !(flags & BDRV_O_RDWR));
        drv = bdrv_find_format(drvname);
        if (!drv) {
            error_setg(errp, "Unknown driver '%s'", drvname);
        }
@@ -1123,7 +1132,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
    /* Find the right image format driver */
    drvname = qdict_get_try_str(options, "driver");
    if (drvname) {
        drv = bdrv_find_whitelisted_format(drvname, !(flags & BDRV_O_RDWR));
        drv = bdrv_find_format(drvname);
        qdict_del(options, "driver");
    }

@@ -3147,6 +3156,12 @@ static int64_t coroutine_fn bdrv_co_get_block_status(BlockDriverState *bs,
        return ret;
    }

    if (ret & BDRV_BLOCK_RAW) {
        assert(ret & BDRV_BLOCK_OFFSET_VALID);
        return bdrv_get_block_status(bs->file, ret >> BDRV_SECTOR_BITS,
                                     *pnum, pnum);
    }

    if (!(ret & BDRV_BLOCK_DATA)) {
        if (bdrv_has_zero_init(bs)) {
            ret |= BDRV_BLOCK_ZERO;
@@ -3322,6 +3337,15 @@ int bdrv_get_info(BlockDriverState *bs, BlockDriverInfo *bdi)
    return drv->bdrv_get_info(bs, bdi);
}

ImageInfoSpecific *bdrv_get_specific_info(BlockDriverState *bs)
{
    BlockDriver *drv = bs->drv;
    if (drv && drv->bdrv_get_specific_info) {
        return drv->bdrv_get_specific_info(bs);
    }
    return NULL;
}

int bdrv_save_vmstate(BlockDriverState *bs, const uint8_t *buf,
                      int64_t pos, int size)
{
@@ -4632,3 +4656,22 @@ int bdrv_amend_options(BlockDriverState *bs, QEMUOptionParameter *options)
    }
    return bs->drv->bdrv_amend_options(bs, options);
}

ExtSnapshotPerm bdrv_check_ext_snapshot(BlockDriverState *bs)
{
    if (bs->drv->bdrv_check_ext_snapshot) {
        return bs->drv->bdrv_check_ext_snapshot(bs);
    }

    if (bs->file && bs->file->drv && bs->file->drv->bdrv_check_ext_snapshot) {
        return bs->file->drv->bdrv_check_ext_snapshot(bs);
    }

    /* external snapshots are allowed by default */
    return EXT_SNAPSHOT_ALLOWED;
}

ExtSnapshotPerm bdrv_check_ext_snapshot_forbidden(BlockDriverState *bs)
{
    return EXT_SNAPSHOT_FORBIDDEN;
}
+3 −3
Original line number Diff line number Diff line
@@ -202,9 +202,9 @@ static void backup_iostatus_reset(BlockJob *job)
    bdrv_iostatus_reset(s->target);
}

static const BlockJobType backup_job_type = {
static const BlockJobDriver backup_job_driver = {
    .instance_size  = sizeof(BackupBlockJob),
    .job_type       = "backup",
    .job_type       = BLOCK_JOB_TYPE_BACKUP,
    .set_speed      = backup_set_speed,
    .iostatus_reset = backup_iostatus_reset,
};
@@ -370,7 +370,7 @@ void backup_start(BlockDriverState *bs, BlockDriverState *target,
        return;
    }

    BackupBlockJob *job = block_job_create(&backup_job_type, bs, speed,
    BackupBlockJob *job = block_job_create(&backup_job_driver, bs, speed,
                                           cb, opaque, errp);
    if (!job) {
        return;
+4 −4
Original line number Diff line number Diff line
@@ -362,8 +362,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
    opts = qemu_opts_create_nofail(&runtime_opts);
    qemu_opts_absorb_qdict(opts, options, &local_err);
    if (error_is_set(&local_err)) {
        qerror_report_err(local_err);
        error_free(local_err);
        error_propagate(errp, local_err);
        ret = -EINVAL;
        goto fail;
    }
@@ -373,6 +372,7 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
    if (config) {
        ret = read_config(s, config);
        if (ret < 0) {
            error_setg_errno(errp, -ret, "Could not read blkdebug config file");
            goto fail;
        }
    }
@@ -383,14 +383,14 @@ static int blkdebug_open(BlockDriverState *bs, QDict *options, int flags,
    /* Open the backing file */
    filename = qemu_opt_get(opts, "x-image");
    if (filename == NULL) {
        error_setg(errp, "Could not retrieve image file name");
        ret = -EINVAL;
        goto fail;
    }

    ret = bdrv_file_open(&bs->file, filename, NULL, flags, &local_err);
    if (ret < 0) {
        qerror_report_err(local_err);
        error_free(local_err);
        error_propagate(errp, local_err);
        goto fail;
    }

+7 −6
Original line number Diff line number Diff line
@@ -128,8 +128,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
    opts = qemu_opts_create_nofail(&runtime_opts);
    qemu_opts_absorb_qdict(opts, options, &local_err);
    if (error_is_set(&local_err)) {
        qerror_report_err(local_err);
        error_free(local_err);
        error_propagate(errp, local_err);
        ret = -EINVAL;
        goto fail;
    }
@@ -137,20 +136,21 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
    /* Parse the raw image filename */
    raw = qemu_opt_get(opts, "x-raw");
    if (raw == NULL) {
        error_setg(errp, "Could not retrieve raw image filename");
        ret = -EINVAL;
        goto fail;
    }

    ret = bdrv_file_open(&bs->file, raw, NULL, flags, &local_err);
    if (ret < 0) {
        qerror_report_err(local_err);
        error_free(local_err);
        error_propagate(errp, local_err);
        goto fail;
    }

    /* Open the test file */
    filename = qemu_opt_get(opts, "x-image");
    if (filename == NULL) {
        error_setg(errp, "Could not retrieve test image filename");
        ret = -EINVAL;
        goto fail;
    }
@@ -158,8 +158,7 @@ static int blkverify_open(BlockDriverState *bs, QDict *options, int flags,
    s->test_file = bdrv_new("");
    ret = bdrv_open(s->test_file, filename, NULL, flags, NULL, &local_err);
    if (ret < 0) {
        qerror_report_err(local_err);
        error_free(local_err);
        error_propagate(errp, local_err);
        bdrv_unref(s->test_file);
        s->test_file = NULL;
        goto fail;
@@ -417,6 +416,8 @@ static BlockDriver bdrv_blkverify = {
    .bdrv_aio_readv         = blkverify_aio_readv,
    .bdrv_aio_writev        = blkverify_aio_writev,
    .bdrv_aio_flush         = blkverify_aio_flush,

    .bdrv_check_ext_snapshot = bdrv_check_ext_snapshot_forbidden,
};

static void bdrv_blkverify_init(void)
Loading