From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40248) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ye7j3-00064J-FF for qemu-devel@nongnu.org; Fri, 03 Apr 2015 15:57:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ye7j2-0006Mx-5R for qemu-devel@nongnu.org; Fri, 03 Apr 2015 15:57:57 -0400 Date: Fri, 3 Apr 2015 15:57:47 -0400 From: Jeff Cody Message-ID: <20150403195747.GA8600@localhost.localdomain> References: <20150330153634.GC4305@noname.redhat.com> <551BB9DA.7030309@msgid.tls.msk.ru> <551BC040.9000806@msgid.tls.msk.ru> <20150401123417.GF3593@noname.str.redhat.com> <551D20EB.8060800@msgid.tls.msk.ru> <20150402112402.GG6541@noname.str.redhat.com> <551D3032.5080307@msgid.tls.msk.ru> <551D3F0B.6000703@redhat.com> <20150403042816.GE27096@localhost.localdomain> <551EEEAD.4050209@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <551EEEAD.4050209@redhat.com> Subject: Re: [Qemu-devel] block-commit & dropping privs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: Kevin Wolf , Michael Tokarev , qemu-devel , qemu-block@nongnu.org On Fri, Apr 03, 2015 at 01:49:01PM -0600, Eric Blake wrote: > On 04/02/2015 10:28 PM, Jeff Cody wrote: > > >> > >> Basically, once a commit crosses more than one file, all intermediate > >> files are useless and might as well be discarded. > > That's if you do a job-complete operation. But if you do a job-abort > operation, the chain is left intact. What we should probably add is a > way to do a job-abort operation that leaves the active file intact, but > which also simultaneously rewrites the backing file of the active image > to point back to the base image and skip over the intermediate files > that are now broken. > > >> But you've pointed out > >> that by rewriting the backing file of C, we CAN make C still be > >> consistent and tracking the change since the commit: > >> > > > > Currently, when we do a commit we drop in the chain all the > > invalidated intermediate images, and the committed image as well > > (which is what introduced the bdrv_swap craziness): > > > > [base] <--- [snapA] <--- [snapB] <--- [snapC] > > > > Committing snapB down to the base: > > > > [base] <--- [snapC] > > > > snapB and snapA are discarded. > > Are we actually changing the backing file metadata of snapC when doing > this? And if so, can management applications control the text being > written (so that it is absolute or relative as desired)? > Yes, and yes: in the QMP block-commit command, there is the optional argument "backing-file". If provided, that exact string is written into snapC as the backing filename. If not provided, then we use the "filename" member of the BDS for 'base' (e.g. base_bs->filename); > > > > In the active layer commit, the 'base' that is the recipient of data > > becomes the new active layer, and we drop all the overlays above it. > > > > If we allow emptying images, we need to either A) empty all images > > that would have otherwise been dropped, or B) empty the current active > > layer, and drop the intermediates. > > > > At first blush, have empty intermediates makes no sense. But if we > > consider multi-parent chains, as can be introduced with blockdev-add, > > perhaps it might: > > > > /-- [snapE] > > / > > [base] <--- [snapA] <--- [snapB] <--- [snapC] <----- [snapD] > > > > > > Say, for performance or cleanup reasons, we want to push snapC into > > base. This action invalidates neither snapE or snapD, in theory. > > > > However, in current practice, we drop snapC, snapB, and snapA from > > the chain. Then either snapE or snapD is now orphaned or worse, > > depending from which "perspective" the block-commit was done. But > > if we just empty snapC, then everything automagically works even in > > multi-parent chains: > > > > /-- [snapE] > > / > > [base] <--- [snapC] <---- [snapD] > > (empty) > > > > So I think it makes sense to provide an option even for the non-active > > layer block commit case to empty the topmost committed overlay, while > > dropping the other intermediates. > > At any rate, I'm glad I've got you thinking about it. > > -- > -- > Eric Blake eblake redhat com +1-919-301-3266 > Libvirt virtualization library http://libvirt.org >