From nobody Thu Apr 25 12:34:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 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=1575035073; cv=none; d=zohomail.com; s=zohoarc; b=XDaoMG8SFG1BGumqeQh5dIG9julniLMOHf3lDkAChpKR/8e242ycwJMPi2rwg5ioNT5k0Qs5A2PONdNNG6zOr6byqHM166zp2AIva0wMKRsBz1DkSu4ztrKUCmPFyp3s1z7YwZI+8o4buE/IqY95ggHixQzBqcbL5dkxDvHVohI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575035073; 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; bh=Lfck8OugsOikei74WjZrOAbZPxhFvrGlIBuY86b2t+Y=; b=Ngmx+eZ9jHfiv20r2gPH8YZFvxZzxv3J5wdnjzdrsHliLU2b3i/VY6/gyuZDh8LwVOEHTpnzmEfvET28M3t6GDyrslfY4KH2P+uWYT/n7KGRmb1RyCLYdHxsAy9F/Ptnvreu//mC4eBcAVtZ4kUCgOdAGNqJrbj1LXE0lUDK+dc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 1575035073503226.48208743398072; Fri, 29 Nov 2019 05:44:33 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-385-YiRf93jxN62I2zI1t1sehw-1; Fri, 29 Nov 2019 08:44:30 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A47011005502; Fri, 29 Nov 2019 13:44:23 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A2ED19C5B; Fri, 29 Nov 2019 13:44:23 +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 3619B4E567; Fri, 29 Nov 2019 13:44:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xATDi4JU017809 for ; Fri, 29 Nov 2019 08:44:04 -0500 Received: by smtp.corp.redhat.com (Postfix) id 6F17719C58; Fri, 29 Nov 2019 13:44:04 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id EC25B19C4F for ; Fri, 29 Nov 2019 13:44:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575035072; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Lfck8OugsOikei74WjZrOAbZPxhFvrGlIBuY86b2t+Y=; b=VLzO9EQLni8bHzpi+3PKDFt8CASzG1uZa3UVUOae1PvodEZElvD2kW+HmWNVn+n6nRrjgm l3RszOMssBmNhi7iQoD5NbOP+KJ0z7cuvmIAARL4N6pOH/ALthWgn3qFrB0ryDXxTRWFAC PFDgLpxpW3GeCO7hn3e/1WPNrqD8mv0= From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 29 Nov 2019 14:43:59 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/2] qemu: blockcopy: Report error on image format detection failure 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-MC-Unique: YiRf93jxN62I2zI1t1sehw-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We tolerate image format detection during block copy in very specific circumstances, but the code didn't error out on failure of the format detection. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 18bd0101e7..e43d6554a1 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18104,15 +18104,14 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, if (!mirror_reuse) { mirror->format =3D disk->src->format; } else { - if (mirror_initialized && - virStorageSourceIsLocalStorage(mirror)) { - /* If the user passed the REUSE_EXT flag, then either they - * can also pass the RAW flag or use XML to tell us the fo= rmat. - * So if we get here, we assume it is safe for us to probe= the - * format from the file that we will be using. */ - mirror->format =3D virStorageFileProbeFormat(mirror->path,= cfg->user, - cfg->group); - } else { + /* If the user passed the REUSE_EXT flag, then either they + * can also pass the RAW flag or use XML to tell us the format. + * So if we get here, we assume it is safe for us to probe the + * format from the file that we will be using. */ + if (!mirror_initialized || + !virStorageSourceIsLocalStorage(mirror) || + (mirror->format =3D virStorageFileProbeFormat(mirror->path= , cfg->user, + cfg->group)) <= 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("reused mirror destination format must be= specified")); goto endjob; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 12:34:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) client-ip=205.139.110.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 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=1575035057; cv=none; d=zohomail.com; s=zohoarc; b=gC+87uVAvudQyU2ByRZc3LFgTGy6+MxvJoln3DCcgT8jUVbee5nwpq86Si+mSgC7NiOowVZMyIMxKJX4XVOnB64RL7gmc5juNL+m0LlpumM/EBz98jniNUoVzQPu9xEoHEBabtQapYTxAp963FNoYGqzqg8+msJwFHN9Dtdmhk0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1575035057; 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; bh=sGccXMIKSrQJilwn1g/ExtE7t76xwXPr6hm0YoLUMVk=; b=YwKbcYWKiZIzlQPLtWuUmiBoOU0gtDWJ/M2InKbPW+G9GAUKlsQEWcctVW1rQ+a54ahMKHZaAVqH9K0IaUpMMy978YHLqCMvEJvfCKRFA+dJb3pF4NxrYs+Os6OFraKuEoxcS16iizA/b3qlvtFbqL5mT+Ri+Yp81EiaDUXr8vs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by mx.zohomail.com with SMTPS id 1575035057322904.5194553397425; Fri, 29 Nov 2019 05:44:17 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-364-k5gKt4uhP5mh4TrTx9lVvA-1; Fri, 29 Nov 2019 08:44:14 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 64DB1DB20; Fri, 29 Nov 2019 13:44:09 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38C9F1001281; Fri, 29 Nov 2019 13:44:09 +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 60D784BB78; Fri, 29 Nov 2019 13:44:07 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xATDi5k6017817 for ; Fri, 29 Nov 2019 08:44:05 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3DF1F19C58; Fri, 29 Nov 2019 13:44:05 +0000 (UTC) Received: from angien.redhat.com (unknown [10.43.2.48]) by smtp.corp.redhat.com (Postfix) with ESMTP id BC95719C4F for ; Fri, 29 Nov 2019 13:44:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1575035056; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=sGccXMIKSrQJilwn1g/ExtE7t76xwXPr6hm0YoLUMVk=; b=aVe8twAeg7gOiPcvq1m4EQbBmdUeX6sS90FUBeaPfJVvSMPTIXFPpIuK3rgiex4illNOnO J77i5rDVdgH7BuZpW6mWM+Tgte0xXx2vJHXPBs673lrRlFHplP6eXbomg4+bQxZtTGEPMP wmQuKLhfjARw3jopGuXOzd/I+ueDfhk= From: Peter Krempa To: libvir-list@redhat.com Date: Fri, 29 Nov 2019 14:44:00 +0100 Message-Id: <01bef06d8cc372cc992f38af1d5d59f51b65f3f3.1575034882.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/2] qemu: blockcopy: Fix conditions when virStorageSource should be initialized 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: k5gKt4uhP5mh4TrTx9lVvA-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit 4b58fdf280a which enabled block copy also for network destinations needed to limit when the 'mirror' storage source is initialized in cases when we e.g. don't have an appropriate backend. Limiting it just to virStorageFileSupportsCreate is too restrictive as for example we can't precreate block devices and thus wouldn't initialize the 'mirror' but since it's a local source we'd try to examine it. This would fail since it wouldn't be initialized. Fix it by introducing a more granular check whether certain operations are supported and fix the check interlocks. https://bugzilla.redhat.com/show_bug.cgi?id=3D1778058 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_driver.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e43d6554a1..962a4d3a55 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18009,7 +18009,9 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, qemuBlockJobDataPtr job =3D NULL; g_autoptr(virStorageSource) mirror =3D mirrorsrc; bool blockdev =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV); - bool mirror_initialized =3D false; + bool supports_create =3D false; + bool supports_access =3D false; + bool supports_detect =3D false; g_autoptr(qemuBlockStorageSourceChainData) data =3D NULL; g_autoptr(qemuBlockStorageSourceChainData) crdata =3D NULL; virStorageSourcePtr n; @@ -18090,14 +18092,17 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, goto endjob; } - if (virStorageFileSupportsCreate(mirror) =3D=3D 1) { + supports_access =3D virStorageFileSupportsAccess(mirror) =3D=3D 1; + supports_create =3D virStorageFileSupportsCreate(mirror) =3D=3D 1; + supports_detect =3D virStorageFileSupportsBackingChainTraversal(mirror= ) =3D=3D 1; + + if (supports_access || supports_create || supports_detect) { if (qemuDomainStorageFileInit(driver, vm, mirror, NULL) < 0) goto endjob; - - mirror_initialized =3D true; } - if (qemuDomainBlockCopyValidateMirror(mirror, disk->dst, &existing) < = 0) + if (supports_access && + qemuDomainBlockCopyValidateMirror(mirror, disk->dst, &existing) < = 0) goto endjob; if (!mirror->format) { @@ -18108,7 +18113,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, * can also pass the RAW flag or use XML to tell us the format. * So if we get here, we assume it is safe for us to probe the * format from the file that we will be using. */ - if (!mirror_initialized || + if (!supports_detect || !virStorageSourceIsLocalStorage(mirror) || (mirror->format =3D virStorageFileProbeFormat(mirror->path= , cfg->user, cfg->group)) <= 0) { @@ -18132,7 +18137,7 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, /* pre-create the image file. In case when 'blockdev' is used this is * required so that libvirt can properly label the image for access by= qemu */ if (!existing) { - if (mirror_initialized) { + if (supports_create) { if (virStorageFileCreate(mirror) < 0) { virReportSystemError(errno, "%s", _("failed to create copy= target")); goto endjob; --=20 2.23.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list