From nobody Mon Feb 9 16:53:49 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; 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 207.211.31.81 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=1589216169; cv=none; d=zohomail.com; s=zohoarc; b=CsrQR1oC5/VajyCiGAa7xdYzsjLfg6JP53iqo/ma8/D530dT93z2pkSnzbuvzfgNIw8ta5xr1gLQZaVax7cceHxNcrDaL6o32sNOVoE+9Kx26C31QtVBfRcj5znjXBu2bGn3rnW4NfG27ym1jvf8zKKiUAs8QgTa2X3SUsnUuC4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1589216169; 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=Jk5oSZ0TpLikfbOiHLKuBY4o9zlk+6zC0UjSvA48NAM=; b=Od0V8CgVeP5fs418smvJzzfcUgrfAlLorhCM8jSwSN880ESKQMKQEMR3rkfoKbG1Zb0ImY5/zgkT98i5JBsvrb01WAG8d1CVUQFjmRefsUFP4tbsvtxHKnnAyKtxwvZZqB+ovDYKxytPgD3ImpBmJbAQuhD3sF/RxC3OooghrbI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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 [207.211.31.81]) by mx.zohomail.com with SMTPS id 1589216169765599.3231281595631; Mon, 11 May 2020 09:56:09 -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-257-yFqnnt0aNUC9jIt3eimrCQ-1; Mon, 11 May 2020 12:56:05 -0400 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2F4B98018AC; Mon, 11 May 2020 16:55:57 +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 0E31F60C05; Mon, 11 May 2020 16:55:57 +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 D57B94E981; Mon, 11 May 2020 16:55:56 +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 04BGtrni016643 for ; Mon, 11 May 2020 12:55:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3FFBE60C05; Mon, 11 May 2020 16:55:53 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.40.208.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFCE660BF1 for ; Mon, 11 May 2020 16:55:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1589216168; 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=Jk5oSZ0TpLikfbOiHLKuBY4o9zlk+6zC0UjSvA48NAM=; b=ZtzZnLeDNNw0YLVM8Op33msUZegBeujfJe/DqQnMjbGv2ICoP08dGcVPOFCkS5BhEqbXWQ yqK//Dnx+bEBG8Zk9eRH/10+IySVK6WpiYy8r4uATIY++GQ4mh+xN0PhSDnXS8hYShEhUD BaWivH0lq7Z7dTCWwfUlN+nTDoDW30I= X-MC-Unique: yFqnnt0aNUC9jIt3eimrCQ-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 4/5] qemu: blockcopy: Allow copy of read-only disks with -blockdev Date: Mon, 11 May 2020 18:55:41 +0200 Message-Id: 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.79 on 10.5.11.12 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" 'blockdev-mirror' requires the write permission internally to do the copy. This means that we have to force the image to be read-write for the duration of the copy and can fix it after the copy is done. https://bugzilla.redhat.com/show_bug.cgi?id=3D1832204 Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_blockjob.c | 5 +++++ src/qemu/qemu_driver.c | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index b9eecd3f98..e51499532f 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -1282,6 +1282,7 @@ qemuBlockJobProcessEventConcludedCopyPivot(virQEMUDri= verPtr driver, qemuBlockJobDataPtr job, qemuDomainAsyncJob asyncJob) { + qemuDomainObjPrivatePtr priv =3D vm->privateData; VIR_DEBUG("copy job '%s' on VM '%s' pivoted", job->name, vm->def->name= ); /* mirror may be NULL for copy job corresponding to migration */ @@ -1297,6 +1298,10 @@ qemuBlockJobProcessEventConcludedCopyPivot(virQEMUDr= iverPtr driver, !virStorageSourceIsBacking(job->disk->mirror->backingStore)) job->disk->mirror->backingStore =3D g_steal_pointer(&job->disk->sr= c->backingStore); + if (job->disk->src->readonly && + virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) + ignore_value(qemuBlockReopenReadOnly(vm, job->disk->mirror, asyncJ= ob)); + qemuBlockJobRewriteConfigDiskSource(vm, job->disk, job->disk->mirror); qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, job= ->disk->src); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 29d964f1e8..1c73604249 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18110,6 +18110,15 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, keepParentLabel) < 0) goto endjob; + if (mirror->readonly) { + if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_BLOCKDEV_REOPEN)) { + virReportError(VIR_ERR_OPERATION_UNSUPPORTED, "%s", + _("copy of read-only disks is not supported")); + goto endjob; + } + mirror->readonly =3D false; + } + /* we must initialize XML-provided chain prior to detecting to keep se= mantics * with VM startup */ if (blockdev) { --=20 2.26.2