From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YdfBi-0002EV-S4 for qemu-devel@nongnu.org; Thu, 02 Apr 2015 09:29:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YdfBf-0008PR-Gk for qemu-devel@nongnu.org; Thu, 02 Apr 2015 09:29:38 -0400 Date: Thu, 2 Apr 2015 15:28:57 +0200 From: Alberto Garcia Message-ID: <20150402132857.GA26513@igalia.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Subject: [Qemu-devel] [RFC] Intermediate block mirroring List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-block@nongnu.org Hi, I'm interested in adding the possibility to mirror an intermediate node in a disk image chain, but I would like to have some feedback before sending any patches. The goal would be to convert this: [A] -> [B] -> [C] -> [D] into this: [A] -> [B] -> [X] -> [D] where [D] is the active image and [X] would be a copy of [C]. The latter would be unlinked from the chain. A use case would be to move disk images across different storage backends. My idea is to extend the drive-mirror command. Similar to what we discussed in the case of the intermediate block streaming, I can reuse the 'device' parameter to refer to a node name. So the API doesn't need any changes other than the extended semantics for this parameter. One difference with the current functionality is that once the block job is completed, the node above the mirrored one would have to change its backing image to point to the new one. One solution is to iterate over all devices (bdrv_next()) and check which ones are connected directly or indirectly to the mirrored node (bdrv_find_overlay()). drive-mirror has three different sync modes: top, full and none. This would be the chain from the example using each one of these modes: top: [A] -> [B] -> [X] -> [D] full: [X] -> [D] none: [A] -> [B] -> [C] -> [X] -> [D] My understanding is that in the 'sync=full' case, [A] and [B] would also need to be blocked during the operation since they are going to disappear from the chain. I have some code and in principle everything seems to be working fine, but I'd like to test it a bit more. What's anyway your opinion about this proposal? Thanks, Berto