qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create


From: Paolo Bonzini
Subject: Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi)
Date: Thu, 25 Oct 2012 09:42:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1

Il 25/10/2012 09:25, Alexandre DERUMIER ha scritto:
> What is the best way to get it working ?
> 
> 1)add a .bdrv_create in block/iscsi.c ? 
> 
> (like host_device block driver, only open/close the device and check if size 
> if big enough)
> 
>     if (fstat(fd, &stat_buf) < 0)
>         ret = -errno;
>     else if (!S_ISBLK(stat_buf.st_mode) && !S_ISCHR(stat_buf.st_mode))
>         ret = -ENODEV;

I'm not even sure this S_ISBLK/S_ISCHR test is necessary.

>     else if (lseek(fd, 0, SEEK_END) < total_size * BDRV_SECTOR_SIZE)
>         ret = -ENOSPC;
> 
>     qemu_close(fd);
>     return ret;
> }
> 
> 
> 2)or add a fallback in qemu-img, if bdrv_create doesn't exist, use bdrv_open 
> to see if the backend device is pre-existing ?

Or even add it in block.c, so that it also applies to live snapshots etc.

Paolo



reply via email to

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