From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50401) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdeGO-0006yO-BE for qemu-devel@nongnu.org; Tue, 05 Nov 2013 05:53:44 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VdeGF-0005ro-SW for qemu-devel@nongnu.org; Tue, 05 Nov 2013 05:53:36 -0500 Received: from mail-qa0-x235.google.com ([2607:f8b0:400d:c00::235]:55001) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VdeGF-0005rh-Nr for qemu-devel@nongnu.org; Tue, 05 Nov 2013 05:53:27 -0500 Received: by mail-qa0-f53.google.com with SMTP id k4so919701qaq.19 for ; Tue, 05 Nov 2013 02:53:27 -0800 (PST) Sender: Paolo Bonzini Message-ID: <5278CE21.5030204@redhat.com> Date: Tue, 05 Nov 2013 11:53:21 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1383611706-22107-1-git-send-email-mreitz@redhat.com> In-Reply-To: <1383611706-22107-1-git-send-email-mreitz@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 0/2] block/drive-mirror: Check for NULL backing_hd List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: Kevin Wolf , qemu-devel@nongnu.org, Stefan Hajnoczi Il 05/11/2013 01:35, Max Reitz ha scritto: > It should be possible to execute the QMP "drive-mirror" command in > "none" sync mode and "absolute-paths" mode even for block devices > lacking a backing file. > > "absolute-paths" does in fact not require a backing file to be present, > as can be seen from the "top" sync mode code path. "top" basically > states that the device should indeed have a backing file - however, the > current code catches the case if it doesn't and then simply treats it as > "full" sync mode, creating a target image without a backing file (in > "absolute-paths" mode). Thus, "absolute-paths" does not imply the target > file must indeed have a backing file. > > Therefore, the target file may be left unbacked in case of "none" sync > mode as well, if the specified device is not backed either. Currently, > qemu will crash trying to dereference the backing file pointer since it > assumes that it will always be non-NULL in that case ("none" with > "absolute-paths"). > > The first patch in this series adds a check whether the specified block > device is backed or not (creating an unbacked target image, if required); > the second patch adds a test case for mirroring unbacked block devices. > > > Max Reitz (2): > block/drive-mirror: Check for NULL backing_hd > qemu-iotests: Add test for unbacked mirroring > > blockdev.c | 4 +- > tests/qemu-iotests/070 | 91 ++++++++++++++++++++++++++++++++++++++++++++++ > tests/qemu-iotests/070.out | 33 +++++++++++++++++ > tests/qemu-iotests/group | 1 + > 4 files changed, 127 insertions(+), 2 deletions(-) > create mode 100755 tests/qemu-iotests/070 > create mode 100644 tests/qemu-iotests/070.out > Patch 1 is fine. For patch 2, there are existing drive-mirror tests written in Python. I'll let the maintainers whether they are fine with a new test, or prefer to extend those with a new testcase. Paolo