From nobody Mon Feb 9 12:11:34 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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=1589216168; cv=none; d=zohomail.com; s=zohoarc; b=h8SdhZ8TCaJu7TINqdXVId8RfTvSFuzapC3dR3kgHqykgevC1Dm4/HwJaEgAJUkAIkGrF1hGLcn1WuYMhESyJisniIA1eG2AJ3IU8Ss2TKR+M9NZYIqEEDzyipPbqJOp88AAQCWTu60xH+I3t4td+wMWIhFuNJZfuiHCcq/4ZrM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589216168; 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=jtcNpLoBrCG7s4spq1H4LHQrqNibve/+rlGEP0RlmKU=; b=IfJvK4e3CncfYb3PcQPItgL4B7a3WEF41BJbq/k8yLrgplYtJ8a56XsccZAPXTKyRHbRbKtErIVVrv9v7+rHkXetCe7HVDIVPMAC/to6zHsq26Q9FYSQQ1yUPet7LG/K2UZW5uCaZrXEwKrXEl/VQb+b+z/NshbrQidfkyvC7NI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 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-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 158921616895919.009000108878354; Mon, 11 May 2020 09:56:08 -0700 (PDT) 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-44-GOBQVdI3Mjalt51M0y3XBQ-1; Mon, 11 May 2020 12:56:04 -0400 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 B6E778018AB; Mon, 11 May 2020 16:55:54 +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 959EA34203; Mon, 11 May 2020 16:55:54 +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 64E264E587; Mon, 11 May 2020 16:55:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 04BGtp7h016628 for ; Mon, 11 May 2020 12:55:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5B97660BF1; Mon, 11 May 2020 16:55:51 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id CB73D61988 for ; Mon, 11 May 2020 16:55:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589216167; 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=jtcNpLoBrCG7s4spq1H4LHQrqNibve/+rlGEP0RlmKU=; b=P32iirz9whvAzPC6frBn3p7aJO9L03ad0v7uUneLA5hS951ybfPVuio/XhPXrs+QDY5iMv fzlJP6T9RUab3hr1YW9V00UnhjdHTz9K00XF4abxJp2D5nEwazRsaxOeXJDDoXRikY8lhJ sQW/x4yo1l57ADQGFGuuvZSCNbKSXZ4= X-MC-Unique: GOBQVdI3Mjalt51M0y3XBQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 2/5] qemuBlockStorageSourceCreateFormat: Force write access when formatting images Date: Mon, 11 May 2020 18:55:39 +0200 Message-Id: <2c040f2362bfc7b08675685e7fadac36480e0a4a.1589216000.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com 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-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" We need qemu to be able to write the newly created images so that it can format them to the specified storage format. Force write access by relabelling the images when formatting. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_block.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/qemu/qemu_block.c b/src/qemu/qemu_block.c index d32277d7fd..6f9c7071c9 100644 --- a/src/qemu/qemu_block.c +++ b/src/qemu/qemu_block.c @@ -2671,6 +2671,12 @@ qemuBlockStorageSourceCreate(virDomainObjPtr vm, return -1; } + /* grant write access to read-only images during formatting */ + if (src->readonly && + qemuDomainStorageSourceAccessAllow(priv->driver, vm, src, false, + false, true) < 0) + return -1; + if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) goto cleanup; @@ -2697,6 +2703,12 @@ qemuBlockStorageSourceCreate(virDomainObjPtr vm, asyncJob) < 0) goto cleanup; + /* revoke write access to read-only images during formatting */ + if (src->readonly && + qemuDomainStorageSourceAccessAllow(priv->driver, vm, src, true, + false, true) < 0) + goto cleanup; + if (qemuDomainObjEnterMonitorAsync(priv->driver, vm, asyncJob) < 0) goto cleanup; --=20 2.26.2