From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:51341) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRI5S-0003rw-Qj for qemu-devel@nongnu.org; Thu, 25 Oct 2012 03:42:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRI5R-0004Sd-QH for qemu-devel@nongnu.org; Thu, 25 Oct 2012 03:42:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34369) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRI5R-0004SY-IG for qemu-devel@nongnu.org; Thu, 25 Oct 2012 03:42:41 -0400 Message-ID: <5088ED6D.5030805@redhat.com> Date: Thu, 25 Oct 2012 09:42:37 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <93cf825d-ecca-4367-8b74-4a69c53b5801@mailpro> In-Reply-To: <93cf825d-ecca-4367-8b74-4a69c53b5801@mailpro> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] qemu-img convert with block driver without .bdrv_create (like iscsi) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexandre DERUMIER Cc: kwolf@redhat.com, qemu-devel , ronnie sahlberg 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