From nobody Sun Feb 8 16:05:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1567519734; cv=none; d=zoho.com; s=zohoarc; b=W90A99IDeuDpJaW9zRzwOsyNRzA4XLAETzYQNkjzHOFE2MoMGIblNL/YnBg65R+HFFKDfXR7yZbAissiaKAZBJBTjC7kdEBkHV3VO3bty+4Qirg7e/05gQFgpXFBUVh7jYR60Op3CLbXBkn1xSLNsV552+9xWbG/+lX1vOZmfb4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1567519734; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Lt9nVtXWj0oz1bKmQeCsSGYw+LI/o4QdRmIKs31ADIc=; b=FfZJWaecQtS/9b8WKI+WIp9gG+5ef7jELj76eL+9P/075PLDXmJ6ORzIdE1sit5HRErurUC0GGVASwN5Nso/QnwUSc4dQLfGRqd0TVEw3h2afpeSUA1p+cEnKjAPnqDV30kz7Q+vTsMNRTJ0Y576UeeG0IgQeUiZb1uEetbr1Bk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1567519734682497.8606643299895; Tue, 3 Sep 2019 07:08:54 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4F238C05975D; Tue, 3 Sep 2019 14:08:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 265895D6D0; Tue, 3 Sep 2019 14:08:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id DB81F180BA9C; Tue, 3 Sep 2019 14:08:52 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x83E8SJe009705 for ; Tue, 3 Sep 2019 10:08:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id 54A4F10016EB; Tue, 3 Sep 2019 14:08:28 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1946100195C for ; Tue, 3 Sep 2019 14:08:27 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 3 Sep 2019 16:08:09 +0200 Message-Id: <992efc60bf5267bcdae8a6c263c05d89a232ad34.1567519340.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v3 16/18] qemu: snapshot: Skip overlay file creation/interogation if unsupported X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Tue, 03 Sep 2019 14:08:53 +0000 (UTC) With blockdev we'll be able to support protocols which are not supported by the storage backends in libvirt. This means that we have to be able to skip the creation and relative storage path reading if it's not supported. This will make it impossible to use relative backing for network protocols but that would be almost insane anyways. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 53 ++++++++++++++++++++++++------------------ 1 file changed, 31 insertions(+), 22 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 39d9118953..8a0f1697cb 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15316,6 +15316,8 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr d= river, { char *backingStoreStr; virDomainDiskDefPtr persistdisk; + bool supportsCreate; + bool supportsBacking; dd->disk =3D disk; @@ -15340,31 +15342,38 @@ qemuDomainSnapshotDiskPrepareOne(virQEMUDriverPtr= driver, return -1; } - if (qemuDomainStorageFileInit(driver, vm, dd->src, NULL) < 0) - return -1; - - dd->initialized =3D true; + supportsCreate =3D virStorageFileSupportsCreate(dd->src); + supportsBacking =3D virStorageFileSupportsBackingChainTraversal(dd->sr= c); - /* relative backing store paths need to be updated so that relative - * block commit still works */ - if (reuse) { - if (virStorageFileGetBackingStoreStr(dd->src, &backingStoreStr) < = 0) + if (supportsCreate || supportsBacking) { + if (qemuDomainStorageFileInit(driver, vm, dd->src, NULL) < 0) return -1; - if (backingStoreStr !=3D NULL) { - if (virStorageIsRelative(backingStoreStr)) - VIR_STEAL_PTR(dd->relPath, backingStoreStr); - else - VIR_FREE(backingStoreStr); - } - } else { - /* pre-create the image file so that we can label it before handin= g it to qemu */ - if (dd->src->type !=3D VIR_STORAGE_TYPE_BLOCK) { - if (virStorageFileCreate(dd->src) < 0) { - virReportSystemError(errno, _("failed to create image file= '%s'"), - NULLSTR(dd->src->path)); - return -1; + + dd->initialized =3D true; + + /* relative backing store paths need to be updated so that relative + * block commit still works */ + if (reuse) { + if (supportsBacking) { + if (virStorageFileGetBackingStoreStr(dd->src, &backingStor= eStr) < 0) + return -1; + if (backingStoreStr !=3D NULL) { + if (virStorageIsRelative(backingStoreStr)) + VIR_STEAL_PTR(dd->relPath, backingStoreStr); + else + VIR_FREE(backingStoreStr); + } + } + } else { + /* pre-create the image file so that we can label it before ha= nding it to qemu */ + if (supportsCreate && dd->src->type !=3D VIR_STORAGE_TYPE_BLOC= K) { + if (virStorageFileCreate(dd->src) < 0) { + virReportSystemError(errno, _("failed to create image = file '%s'"), + NULLSTR(dd->src->path)); + return -1; + } + dd->created =3D true; } - dd->created =3D true; } } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list