qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [V4 Patch 3/4]Qemu: Command "block_set" for dynamic blo


From: Stefan Hajnoczi
Subject: Re: [Qemu-devel] [V4 Patch 3/4]Qemu: Command "block_set" for dynamic block params change
Date: Mon, 4 Jul 2011 13:35:04 +0100

On Mon, Jul 4, 2011 at 11:43 AM, Supriya Kannery
<address@hidden> wrote:
> +int bdrv_reopen(BlockDriverState *bs, int bdrv_flags)
> +{
> +    BlockDriver *drv = bs->drv;
> +    int ret = 0;
> +
> +    /* Quiesce IO for the given block device */
> +    qemu_aio_flush();
> +    if (bdrv_flush(bs)) {
> +        qerror_report(QERR_DATA_SYNC_FAILED, bs->device_name);
> +        return ret;
> +    }
> +    bdrv_close(bs);
> +
> +    ret = bdrv_open(bs, bs->filename, bdrv_flags, drv);
> +
> +    /*
> +     * A failed attempt to reopen the image file must lead to 'abort()'
> +    */
> +    if (ret != 0) {
> +        qerror_report(QERR_REOPEN_FILE_FAILED, bs->filename);
> +        abort();

I think it is still worth trying to reopen with the old flags.  If you
specialy hostcache=off for a file on tmpfs then the open will fail
(tmpfs doesn't support O_DIRECT), but we can still save ourselves by
reopening with the old flags.

Ideally we'd probably treat this condition just like ENOSPC and keep
the VM paused until the administrator has taken action, and then
retry.

BTW qerror_report() followed by abort(3) does not actually report the
error because we exit before QMP has a chance to send out the error.

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]