From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ljg5s-0006JZ-0h for qemu-devel@nongnu.org; Tue, 17 Mar 2009 16:41:00 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ljg5n-0006I0-TR for qemu-devel@nongnu.org; Tue, 17 Mar 2009 16:40:59 -0400 Received: from [199.232.76.173] (port=57229 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ljg5n-0006Hv-PB for qemu-devel@nongnu.org; Tue, 17 Mar 2009 16:40:55 -0400 Received: from mx1.redhat.com ([66.187.233.31]:45014) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Ljg5n-0004HB-Bv for qemu-devel@nongnu.org; Tue, 17 Mar 2009 16:40:55 -0400 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n2HKetuw020169 for ; Tue, 17 Mar 2009 16:40:55 -0400 From: Uri Lublin Date: Tue, 17 Mar 2009 22:40:38 +0200 Message-Id: <1237322452-11337-1-git-send-email-uril@redhat.com> Subject: [Qemu-devel] [PATCH 00/14] block (mostly qcow2) changes (v6) Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Uri Lublin In this patchset there are three main features: 1. Introduce Qcow2 extensions. 2. Keep backing file format such that no probing is needed. 3. Keep track of highest-allocated-offset and report it upon a user request. 4. Add an open-flag to distinguish between a leaf image and a backing file (base image). Also keep the open-flags so we can later use them to close and reopen images. 1. Qcow2 extensions are build of magic (id) len (in bytes) and data. They reside between the end of the header and the backing filename (if exists). Unknown extensions are ignored (assumed to be added by a newer version) Based on a work done by Shahar Frank. 2. By keeping the backing file format we: a. Provide a way to know the backing file format without probing it (setting the format at creation time). b. Enable using qcow2 format over host block devices. (only if the user specifically asks for it, by providing the format at creation time). I've added bdrv_create2 and drv->bdrv_create2 (implemented only by block-qcow2 currently) to pass the backing-format to create. Also fixes a security flaw found by Daniel P. Berrange on [1] which summarizes: "Autoprobing: just say no." [1] http://lists.gnu.org/archive/html/qemu-devel/2008-12/msg01083.html 3. One of the main usage for highest-allocated-offset is to know and act upon a case of end-of-storage-space. Instead of waiting for -ENOSPACE (which now may cause the VM to stop), one can define a threshold and extend the diskspace allocated for the image. This info is also good for management systems, so they can report the user disk space status. 4. With bdrv_close and reopen capability we can possibly: a. Open backing files with read-only permission, and reopen with RW if needed. b. Reopen on destination side after migration before starting to run This solves a case where the source changes the disk (especially meta-data) while migration is in process. c. Check open-flags to keep track of highest-allocated-offset for only leaf images. Changes from v5: Patchset includes newly introduced qcow2 extensions. Usage of such qcow2 extensions for keeping both backing format and highest-allocated-offset. No scanning of qcow2 images upon open. Not yet support for num-free. Added bdrv_close_all + calling it at end of main. Support highest_alloc only for leaf images. Uri Lublin (14): Introducing qcow2 extensions block: support known backing format for image create and open block-qcow2: keep backing file format in a qcow2 extension qemu-img: adding a "-F base_fmt" option to "qemu-img create -b" block-qcow2: keep highest allocated offset block-qcow2: export highest-alloc through BlockDriverInfo and get_info() block: info blockstats: show highest_allocated if exists Add a bdrv_close_all() and call it at the end of main() block-qcow2: keep highest alloc offset in a qcow2 extension qemu-img: info: show highest_alloc if exists qcow2: qcow_read_extensions: make "advance offset over extension" common block: pass BDRV_BACKING flag to open of a backing file block: keep flags an image was opened with block-qcow2: do not keep track of highest-alloc for backing files