From nobody Tue May 7 01:12:29 2024 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=1583316780; cv=none; d=zohomail.com; s=zohoarc; b=SLF2LlfhKJNCzhb6FjGAFG3b3eZhpAW0INwySVmd2+yhSa5GqN48bNJtyt3i0xJeIncKOn+m/UHRwp4LY3Q3ts8ImwCqfbIL7XZuwO/vgSaA4BqrouXMBye+SXi19lZkEvdhBvpWpHnfIdpEtMfZLRWWIyfl1/jrW5QTWZOpVaA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583316780; h=Content-Type:Content-Transfer-Encoding:Cc: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=bHyukADfdyiRPZB28IyuXA/Z+6poBxk3Oa8jGxXTYgA=; b=Kws9jF9fJuiEDfAhrCrC/N4nYJYd3i4g/13hoo4DMLk9QU5k9VwuwymiXJIGQs1R+ots/H/9qkFImeo4EofwJfYAxmt11cSIgmkyO8fbNeYizwPGUedpWwHiRbcgznaSC2lEEBdC6ILWP5urTEK0L7ZCpwAqdrp4selzjP8aVoU= 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-2.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 158331678096713.36103725491887; Wed, 4 Mar 2020 02:13:00 -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-317-IbFAFdwiMeizmc8JUjPLxw-1; Wed, 04 Mar 2020 05:12:57 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3E95100550E; Wed, 4 Mar 2020 10:12:51 +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 936F591D80; Wed, 4 Mar 2020 10:12:51 +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 DED5818089CD; Wed, 4 Mar 2020 10:12:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 024ACklC030658 for ; Wed, 4 Mar 2020 05:12:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5902F5DA87; Wed, 4 Mar 2020 10:12:46 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id A619F5DA2C; Wed, 4 Mar 2020 10:12:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583316779; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=bHyukADfdyiRPZB28IyuXA/Z+6poBxk3Oa8jGxXTYgA=; b=F94On0OncLltnTROyTV5yw1O58KbKkGOtF1l6hYMPwC4NBN8Tih21zg5J0vFg39zhYrbNz XBOoGauUXGCuxvr80fRDkjR1Xmk02KkrhCVjTvKtFvxXiOyTWPLjebZwch/Dfe8ukdTJeY SBjsWiJ1PIsTLlXe+T6qmHaFuMkEDXI= X-MC-Unique: IbFAFdwiMeizmc8JUjPLxw-1 From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH 1/6] qemu: block: add 'top' parameter to qemuDomainBlockPullCommon() Date: Wed, 4 Mar 2020 11:12:35 +0100 Message-Id: <20200304101240.1139700-2-pmores@redhat.com> In-Reply-To: <20200304101240.1139700-1-pmores@redhat.com> References: <20200304101240.1139700-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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.13 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" qemuDomainBlockPullCommon() is one of the functions in block pull implementation that have to support 'top' to make block pull as a whole to support it. Signed-off-by: Pavel Mores --- src/qemu/qemu_driver.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e9a62684f0..81cca360e0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17311,6 +17311,7 @@ static int qemuDomainBlockPullCommon(virDomainObjPtr vm, const char *path, const char *base, + const char *top, unsigned long bandwidth, unsigned int flags) { @@ -17322,6 +17323,9 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, virStorageSourcePtr baseSource =3D NULL; unsigned int baseIndex =3D 0; g_autofree char *basePath =3D NULL; + virStorageSourcePtr topSource =3D NULL; + unsigned int topIndex =3D 0; + g_autofree char *topPath =3D NULL; g_autofree char *backingPath =3D NULL; unsigned long long speed =3D bandwidth; qemuBlockJobDataPtr job =3D NULL; @@ -17355,6 +17359,12 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, base, baseIndex, NULL)))) goto endjob; =20 + if (top && + (virStorageFileParseChainIndex(disk->dst, top, &topIndex) < 0 || + !(topSource =3D virStorageFileChainLookup(disk->src, disk->src, + top, topIndex, NULL)))) + goto endjob; + if (baseSource) { if (flags & VIR_DOMAIN_BLOCK_REBASE_RELATIVE) { if (!virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_CHANGE_BACKING_F= ILE)) { @@ -17388,7 +17398,7 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, speed <<=3D 20; } =20 - if (!(job =3D qemuBlockJobDiskNewPull(vm, disk, baseSource, flags))) + if (!(job =3D qemuBlockJobDiskNewPull(vm, disk, baseSource, /*topSourc= e, */flags))) goto endjob; =20 if (blockdev) { @@ -18160,7 +18170,7 @@ qemuDomainBlockRebase(virDomainPtr dom, const char = *path, const char *base, /* For normal rebase (enhanced blockpull), the common code handles * everything, including vm cleanup. */ if (!(flags & VIR_DOMAIN_BLOCK_REBASE_COPY)) - return qemuDomainBlockPullCommon(vm, path, base, bandwidth, flags); + return qemuDomainBlockPullCommon(vm, path, base, NULL, bandwidth, = flags); =20 /* If we got here, we are doing a block copy rebase. */ if (!(dest =3D virStorageSourceNew())) @@ -18311,7 +18321,7 @@ qemuDomainBlockPull(virDomainPtr dom, const char *p= ath, unsigned long bandwidth, } =20 /* qemuDomainBlockPullCommon consumes the reference on @vm */ - return qemuDomainBlockPullCommon(vm, path, NULL, bandwidth, flags); + return qemuDomainBlockPullCommon(vm, path, NULL, NULL, bandwidth, flag= s); } =20 =20 --=20 2.24.1 From nobody Tue May 7 01:12:29 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=1583316843; cv=none; d=zohomail.com; s=zohoarc; b=IvnkbgbWpi+Ab/3BYRbRxGaY63eD3L8iHzlAOpH/x9QDJ3YAgcAMSAIRvYKRG9qpLfZ1v9f6/tliM3VAp9QEyq9ygeEd3qdytRMXhyAuCUBgwkceJA7QGuXUSze0fH3tbGO+pd/Ck/4+aZgRUt8bOlYYqT1sx22t76RTrr9WDU4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583316843; h=Content-Type:Content-Transfer-Encoding:Cc: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=uWlqf70y83wrG7KwYPA3IJoOrRqvzvq8+oEwTJbWJuI=; b=QpB8ss3GL8XbeWh2bLIN+kAJ2rPUfgZSFzHNm6UXCMdYXC+6vHV+6v7lcrOwh1Iew+KuvgxL9TV1THsBYo12jCGvXShIeu+M7hjOEq6nglFRFfctTc6EisszE9yo5wYkmwzYMB86OrmU7OSbckj7hz2ozWG5LWv6O/GA3K0ovTc= 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 1583316843794370.39386734616335; Wed, 4 Mar 2020 02:14:03 -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-177-HqtEMcv8MEeqfKUQLtgngg-1; Wed, 04 Mar 2020 05:13:09 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6E9AD101FC6A; Wed, 4 Mar 2020 10:13:01 +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 19DEB5C54A; Wed, 4 Mar 2020 10:13:01 +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 A94BB18089D5; Wed, 4 Mar 2020 10:13:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 024AClbW030667 for ; Wed, 4 Mar 2020 05:12:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 56D955DA87; Wed, 4 Mar 2020 10:12:47 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id A716E5DA83; Wed, 4 Mar 2020 10:12:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583316842; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=uWlqf70y83wrG7KwYPA3IJoOrRqvzvq8+oEwTJbWJuI=; b=c93BsbxpdUY1pTJaa6xov2O4fNmx3PZw36CMmFAhiILrCX+0EF9xr9O8FQZQUIJXkcEV1S Z1gkXVwtZAJVcXTOQC7V+XYlX9ri+4IIOLvVmq4CqD+KGQxayM5kamxDyHo7AqNQzdjGbe L28NnoFrtTvTXVOMcfDGjgYifGsxaoE= X-MC-Unique: HqtEMcv8MEeqfKUQLtgngg-1 From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH 2/6] qemu: block: pull job extended with 'top' parameter Date: Wed, 4 Mar 2020 11:12:36 +0100 Message-Id: <20200304101240.1139700-3-pmores@redhat.com> In-Reply-To: <20200304101240.1139700-1-pmores@redhat.com> References: <20200304101240.1139700-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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.16 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" 'top' member added to qemuBlockJobPullData and the job's "constructor" func= tion qemuBlockJobDiskNewPull() and its invocation changed to support the new mem= ber. Signed-off-by: Pavel Mores --- src/qemu/qemu_blockjob.c | 2 ++ src/qemu/qemu_blockjob.h | 2 ++ src/qemu/qemu_driver.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index 71df0d1ab2..e19a2ad76b 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -253,6 +253,7 @@ qemuBlockJobDataPtr qemuBlockJobDiskNewPull(virDomainObjPtr vm, virDomainDiskDefPtr disk, virStorageSourcePtr base, + virStorageSourcePtr top, unsigned int jobflags) { qemuDomainObjPrivatePtr priv =3D vm->privateData; @@ -270,6 +271,7 @@ qemuBlockJobDiskNewPull(virDomainObjPtr vm, return NULL; =20 job->data.pull.base =3D base; + job->data.pull.top =3D top; job->jobflags =3D jobflags; =20 if (qemuBlockJobRegister(job, vm, disk, true) < 0) diff --git a/src/qemu/qemu_blockjob.h b/src/qemu/qemu_blockjob.h index 72c7fa053e..7223b4abb8 100644 --- a/src/qemu/qemu_blockjob.h +++ b/src/qemu/qemu_blockjob.h @@ -77,6 +77,7 @@ typedef qemuBlockJobPullData *qemuBlockJobDataPullPtr; =20 struct _qemuBlockJobPullData { virStorageSourcePtr base; + virStorageSourcePtr top; }; =20 =20 @@ -177,6 +178,7 @@ qemuBlockJobDataPtr qemuBlockJobDiskNewPull(virDomainObjPtr vm, virDomainDiskDefPtr disk, virStorageSourcePtr base, + virStorageSourcePtr top, unsigned int jobflags); =20 qemuBlockJobDataPtr diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 81cca360e0..7970c913f3 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17398,7 +17398,7 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, speed <<=3D 20; } =20 - if (!(job =3D qemuBlockJobDiskNewPull(vm, disk, baseSource, /*topSourc= e, */flags))) + if (!(job =3D qemuBlockJobDiskNewPull(vm, disk, baseSource, topSource,= flags))) goto endjob; =20 if (blockdev) { --=20 2.24.1 From nobody Tue May 7 01:12:29 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=1583316795; cv=none; d=zohomail.com; s=zohoarc; b=IGuoJdin8zIzs2qg+k0Mc4brJY1G+x72pCYHi5zhe10q+mkuFOK5WR4pp4lntJ2wc+tAW6Yu83/RJyUhY/ZwUqyZ0NqIl2wPdE7du/PnuFBgeQnhC+wxQF1vNf48t6T4OUowKE0Yn+/Xq0Lf0ss2ayiE0ye4ZUwv2St9vCkEnQU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583316795; h=Content-Type:Content-Transfer-Encoding:Cc: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=JPmWeZhyHHo3dYFd4su71AZGLSt+Vj1lBg2LF2oq/Ko=; b=C5G23RCmj7eUYuCNZKVWdSc6HUtQtOAw6M6LpoDYmI3P+vWGaLbKX2Why/MhvQ8v7rhikWSyoIJXOyYJeVB0Ej5B5bsbuVwP7Ucx1+3iWZHuJVSABTRRQdn603fSX6+LtyiJ+Kq6R7jxe2Zfd+Yk5Q7N1HFuKBAHUarChA2jLgU= 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 1583316795013900.3543733592185; Wed, 4 Mar 2020 02:13:15 -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-184-MAFz4rAfPx-ni7NnW_KdTQ-1; Wed, 04 Mar 2020 05:13:11 -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 181E4107ACC9; Wed, 4 Mar 2020 10:13:06 +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 DB94C272A3; Wed, 4 Mar 2020 10:13:05 +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 77DCF86A06; Wed, 4 Mar 2020 10:13:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 024ACmcL030674 for ; Wed, 4 Mar 2020 05:12:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5479D5DA87; Wed, 4 Mar 2020 10:12:48 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id A5FD35DA83; Wed, 4 Mar 2020 10:12:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583316793; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=JPmWeZhyHHo3dYFd4su71AZGLSt+Vj1lBg2LF2oq/Ko=; b=WoySonkv4OQjiTJzt+sUOVOzgNp7pEV7/Mvxar+uBM5kx6+44DzvUoF7oyYsDYBnoC01ir 0Of3EMbgelwUH4i9aw2dK0NE1Ezq505caO2782/wlHlKsz3WIk/oCC/yP2vtxDfFkWUfAE 7Y1OIsPUNBvHq0YnbbAmEsSMiiNI5j4= X-MC-Unique: MAFz4rAfPx-ni7NnW_KdTQ-1 From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH 3/6] qemu: block: blockpull param 'top' support in virsh proper Date: Wed, 4 Mar 2020 11:12:37 +0100 Message-Id: <20200304101240.1139700-4-pmores@redhat.com> In-Reply-To: <20200304101240.1139700-1-pmores@redhat.com> References: <20200304101240.1139700-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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" A new command-line option --top was added to virsh's blockpull command. Similar to how --base is handled, in presence of --top the operation is implemented internally as a rebase. To that end, a corresponding new 'top' parameter was added to virDomainBlockRebase(). Signed-off-by: Pavel Mores --- include/libvirt/libvirt-domain.h | 4 ++-- src/libvirt-domain.c | 5 +++-- tools/virsh-domain.c | 14 +++++++++++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index b440818ec2..069d7f98ec 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -2560,8 +2560,8 @@ typedef enum { } virDomainBlockRebaseFlags; =20 int virDomainBlockRebase(virDomainPtr dom, const char *disk, - const char *base, unsigned long bandwidth, - unsigned int flags); + const char *base, const char *top, + unsigned long bandwidth, unsigned int flags); =20 /** * virDomainBlockCopyFlags: diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 65813b68cc..1f9d1b5b84 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -10150,6 +10150,7 @@ virDomainBlockPull(virDomainPtr dom, const char *di= sk, * @disk: path to the block device, or device shorthand * @base: path to backing file to keep, or device shorthand, * or NULL for no backing file + * @top: path to top file, or device shorthand, or NULL for no top * @bandwidth: (optional) specify bandwidth limit; flags determine the unit * @flags: bitwise-OR of virDomainBlockRebaseFlags * @@ -10257,8 +10258,8 @@ virDomainBlockPull(virDomainPtr dom, const char *di= sk, */ int virDomainBlockRebase(virDomainPtr dom, const char *disk, - const char *base, unsigned long bandwidth, - unsigned int flags) + const char *base, const char *top, + unsigned long bandwidth, unsigned int flags) { virConnectPtr conn; =20 diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 9d0f7d68d2..47ccdd1b94 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -2436,7 +2436,7 @@ cmdBlockcopy(vshControl *ctl, const vshCmd *cmd) if (bytes) flags |=3D VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES; =20 - if (virDomainBlockRebase(dom, path, dest, bandwidth, flags) < 0) + if (virDomainBlockRebase(dom, path, dest, NULL, bandwidth, flags) = < 0) goto cleanup; } =20 @@ -2765,6 +2765,10 @@ static const vshCmdOptDef opts_blockpull[] =3D { .type =3D VSH_OT_STRING, .help =3D N_("path of backing file in chain for a partial pull") }, + {.name =3D "top", + .type =3D VSH_OT_STRING, + .help =3D N_("path of top backing file in chain for a partial pull") + }, {.name =3D "wait", .type =3D VSH_OT_BOOL, .help =3D N_("wait for job to finish") @@ -2804,6 +2808,7 @@ cmdBlockpull(vshControl *ctl, const vshCmd *cmd) int timeout =3D 0; const char *path =3D NULL; const char *base =3D NULL; + const char *top =3D NULL; unsigned long bandwidth =3D 0; unsigned int flags =3D 0; virshBlockJobWaitDataPtr bjWait =3D NULL; @@ -2817,6 +2822,9 @@ cmdBlockpull(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptStringReq(ctl, cmd, "base", &base) < 0) return false; =20 + if (vshCommandOptStringReq(ctl, cmd, "top", &top) < 0) + return false; + if (vshBlockJobOptionBandwidth(ctl, cmd, bytes, &bandwidth) < 0) return false; =20 @@ -2834,11 +2842,11 @@ cmdBlockpull(vshControl *ctl, const vshCmd *cmd) verbose, timeout, async))) goto cleanup; =20 - if (base || flags) { + if (base || top || flags) { if (bytes) flags |=3D VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES; =20 - if (virDomainBlockRebase(dom, path, base, bandwidth, flags) < 0) + if (virDomainBlockRebase(dom, path, base, top, bandwidth, flags) <= 0) goto cleanup; } else { if (bytes) --=20 2.24.1 From nobody Tue May 7 01:12:29 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=1583316801; cv=none; d=zohomail.com; s=zohoarc; b=iQHDxw6MSzvM7i4gVN7+DhC70q2GjDt2rHFt+eqoZ1Q7PM3OULEnrYPWvg5FJZ/hJ4MaiiTqU/8bATgcXB+J73HqUkq2fLEId3ozn7VTBnw9x96qGtL2f5smbNJ376vHXLCAZhmdYg/PckuLb/8+waF8S9rTTgbQlg0SEnzXI60= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583316801; h=Content-Type:Content-Transfer-Encoding:Cc: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=vFw0WfLUoOUaTpqyhKr6Szh419EnUvkGOt3BqrejFX4=; b=QPymWTG9l8yXh6D0xO6xuJdf5Di+sGULw3qfyhnKkgAFanXOpsZIpgs1UAfpXppk1AEzXrd2pB6tEQUmCEPebGcei4lMN11E32UC8JdSiSDKMMZvHu8xdZkBKNgXAF4ChLjCg2r46AMv6stC6fUQLNuzHKN/59gUx09bShXGixY= 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 158331680140586.57816962398817; Wed, 4 Mar 2020 02:13:21 -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-235-hrfs9BXbMwWInLx_yFVXaQ-1; Wed, 04 Mar 2020 05:13:16 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2990D1414; Wed, 4 Mar 2020 10:13:10 +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 E824873894; Wed, 4 Mar 2020 10:13: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 A04BA18089CE; Wed, 4 Mar 2020 10:13:09 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 024ACnQv030679 for ; Wed, 4 Mar 2020 05:12:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 51C2D5DA2C; Wed, 4 Mar 2020 10:12:49 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id A399A5DA83; Wed, 4 Mar 2020 10:12:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583316798; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=vFw0WfLUoOUaTpqyhKr6Szh419EnUvkGOt3BqrejFX4=; b=fAkmzF12EgQVBeM2Hw8U1xPIFXJ1H74TtsAnxuUq3f1HSeeeVhy79F4CMBsvqReGScEH/o 4vf+r88y6p1a91A6wbQIPqBgWK9JiEspGG9a6FAoafedXuRYV9StJBiyYuy4OOpA5kLSU+ ThSrIU5U366X3cHcQd5LuPEd3P3cqow= X-MC-Unique: hrfs9BXbMwWInLx_yFVXaQ-1 From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH 4/6] qemu: block: blockpull param 'top' support in driver and RPC Date: Wed, 4 Mar 2020 11:12:38 +0100 Message-Id: <20200304101240.1139700-5-pmores@redhat.com> In-Reply-To: <20200304101240.1139700-1-pmores@redhat.com> References: <20200304101240.1139700-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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.15 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" Rebase implementation in QEMU driver extended with a new 'top' parameter. Support for 'top' added to RPC's remote_domain_block_rebase_args structure. Signed-off-by: Pavel Mores --- src/driver-hypervisor.h | 1 + src/libvirt-domain.c | 2 +- src/qemu/qemu_driver.c | 3 ++- src/remote/remote_protocol.x | 1 + src/remote_protocol-structs | 1 + 5 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index bce023017d..51a25c41e3 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -1053,6 +1053,7 @@ typedef int (*virDrvDomainBlockRebase)(virDomainPtr dom, const char *path, const char *base, + const char *top, unsigned long bandwidth, unsigned int flags); =20 diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 1f9d1b5b84..33e307cb26 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -10287,7 +10287,7 @@ virDomainBlockRebase(virDomainPtr dom, const char *= disk, =20 if (conn->driver->domainBlockRebase) { int ret; - ret =3D conn->driver->domainBlockRebase(dom, disk, base, bandwidth, + ret =3D conn->driver->domainBlockRebase(dom, disk, base, top, band= width, flags); if (ret < 0) goto error; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7970c913f3..b3f97bf593 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -18143,7 +18143,8 @@ qemuDomainBlockCopyCommon(virDomainObjPtr vm, =20 static int qemuDomainBlockRebase(virDomainPtr dom, const char *path, const char *base, - unsigned long bandwidth, unsigned int flags) + const char *top, unsigned long bandwidth, + unsigned int flags) { virDomainObjPtr vm; int ret =3D -1; diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index d4393680e9..5f5a921057 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -1414,6 +1414,7 @@ struct remote_domain_block_rebase_args { remote_nonnull_domain dom; remote_nonnull_string path; remote_string base; + remote_string top; unsigned hyper bandwidth; unsigned int flags; }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index bae0f0b545..b317ec9102 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -992,6 +992,7 @@ struct remote_domain_block_rebase_args { remote_nonnull_domain dom; remote_nonnull_string path; remote_string base; + remote_string top; uint64_t bandwidth; u_int flags; }; --=20 2.24.1 From nobody Tue May 7 01:12:29 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=1583316795; cv=none; d=zohomail.com; s=zohoarc; b=XydPhjVHFZyXbYhHPxaeg8cDJ7GXAABtAWLGBNbc5TvReIOaq4MoUT1jzgC4JScXML0Fc/an3y/qXe7jZGcXJnGXPaCTcTd4uDIrrNc8MmmEezD3uU7lutdvCl75MW4fmXMRdbmhL8rGIi7EfAf4JrALuFIAgpZ97VXeHZ2AfVs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583316795; h=Content-Type:Content-Transfer-Encoding:Cc: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=Wg4Bkz5aqEdr6HgQj5CP6nNUXXR/79n9DBCP+T3HgQI=; b=IhzE5hPqgD/N4PG1sPzyYypRqjtL1tfgLnvOF8Lo35/1UmhcNbMd0GF63Le4iSJvKgmvupPg/GcaPafT0d1y3/G4DkiFbejRvloR5KjnC65MHK7x/JwGBXOlHRPcYwyDaYynZ2ML2Ocnw7BiM8/y1pPVffVtjivVQZ+T7iuhuzQ= 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 1583316795078169.16214410411192; Wed, 4 Mar 2020 02:13:15 -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-111-yNv7Q6L1Mu2K-apMXeQPyg-1; Wed, 04 Mar 2020 05:13:11 -0500 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3F21418C8C0C; Wed, 4 Mar 2020 10:13:06 +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 169C891D91; Wed, 4 Mar 2020 10:13:06 +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 B183586A09; Wed, 4 Mar 2020 10:13:05 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 024ACoQV030699 for ; Wed, 4 Mar 2020 05:12:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4F44D5DA83; Wed, 4 Mar 2020 10:12:50 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id A152D5DA2C; Wed, 4 Mar 2020 10:12:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583316793; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Wg4Bkz5aqEdr6HgQj5CP6nNUXXR/79n9DBCP+T3HgQI=; b=U1DH0oT+HXvno/50PkZZki0YyFR5CCMCL80zBt90Kj6Xi/P9RzPpPTxbXabT99X9c5rs4+ 2448iiW6X4EG32e1fov97DwmLT2lYxhREFoNH6UBr3VkcvjGPb25a7+PxsPgnloVf/5rgF 2Rj4v3U6nrGws0Fh0H/iNINY6B2CiYA= X-MC-Unique: yNv7Q6L1Mu2K-apMXeQPyg-1 From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH 5/6] qemu: block: 'top' support in construction of QMP block-stream Date: Wed, 4 Mar 2020 11:12:39 +0100 Message-Id: <20200304101240.1139700-6-pmores@redhat.com> In-Reply-To: <20200304101240.1139700-1-pmores@redhat.com> References: <20200304101240.1139700-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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.13 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" This commit only handles submission of block-stream command. Since block-stream is a job, we'll need to handle its completion as well in an upcoming commit. Signed-off-by: Pavel Mores --- src/qemu/qemu_driver.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b3f97bf593..b1ffc68e6b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -17410,7 +17410,15 @@ qemuDomainBlockPullCommon(virDomainObjPtr vm, !(backingPath =3D qemuBlockGetBackingStoreString(baseSourc= e))) goto endjob; } - device =3D disk->src->nodeformat; + if (topSource) { + device =3D topSource->nodeformat; + if (qemuDomainStorageSourceAccessAllow(driver, vm, topSource, = false, false) < 0) { + virReportError(VIR_ERR_ACCESS_DENIED, "can't make 'top' wr= itable"); + goto endjob; + } + } else { + device =3D disk->src->nodeformat; + } } else { device =3D job->name; } @@ -18171,7 +18179,7 @@ qemuDomainBlockRebase(virDomainPtr dom, const char = *path, const char *base, /* For normal rebase (enhanced blockpull), the common code handles * everything, including vm cleanup. */ if (!(flags & VIR_DOMAIN_BLOCK_REBASE_COPY)) - return qemuDomainBlockPullCommon(vm, path, base, NULL, bandwidth, = flags); + return qemuDomainBlockPullCommon(vm, path, base, top, bandwidth, f= lags); =20 /* If we got here, we are doing a block copy rebase. */ if (!(dest =3D virStorageSourceNew())) @@ -18302,8 +18310,8 @@ qemuDomainBlockCopy(virDomainPtr dom, const char *d= isk, const char *destxml, =20 =20 static int -qemuDomainBlockPull(virDomainPtr dom, const char *path, unsigned long band= width, - unsigned int flags) +qemuDomainBlockPull(virDomainPtr dom, const char *path, + unsigned long bandwidth, unsigned int flags) { virDomainObjPtr vm; virCheckFlags(VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES, -1); --=20 2.24.1 From nobody Tue May 7 01:12:29 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=1583316803; cv=none; d=zohomail.com; s=zohoarc; b=CUFT5nrOi4Af0KZDEzDx2HzyuYJQIFDQjndvVTTUxuQqXPQ8U4KT/0eI1nmypdyreBz1PHJGH4mTfGL/u6AQqzxx2lh/U3H5/x5pYrzHqLKo6fNw++MaxRT+fROznj91LBhv9b134zKzWtNAhrl4VxYnYONes55Fl3VJwylTk70= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583316803; h=Content-Type:Content-Transfer-Encoding:Cc: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=xXpUm+yHk2j3Mgfb0RW2cHE9VQHdkpYBoNb6FECFkz0=; b=fdQC3ug+CdnAll2smgS2wsSyYJwhLHTzlu2WyXiipMRfaI2P4eSay1J4CsTXSjtxjyHtxmj5ErX0V8rItcoNBeu1YgDkGOCTBNDh7OlTUnd1NjDvnWY9ZTXhBW2DJ5muiITdCDU0L1qW1/RA18X/31tFsQzEkGWoE3s/HI+ITy8= 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 1583316803255141.9790821267925; Wed, 4 Mar 2020 02:13:23 -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-308-M6ImzLtwPOikKrDX17YrBg-1; Wed, 04 Mar 2020 05:13:19 -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 4A5D118C8C0C; Wed, 4 Mar 2020 10:13:14 +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 1AC321001B3F; Wed, 4 Mar 2020 10:13:14 +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 BAE2718089D8; Wed, 4 Mar 2020 10:13:13 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 024ACpCH030707 for ; Wed, 4 Mar 2020 05:12:51 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4CBF45DA87; Wed, 4 Mar 2020 10:12:51 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.43.2.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9ECF15DA2C; Wed, 4 Mar 2020 10:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1583316801; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=xXpUm+yHk2j3Mgfb0RW2cHE9VQHdkpYBoNb6FECFkz0=; b=Hn0MXwK7Vicxg9acGZSHRpBN4Qtz8tOjMsyn/eIiM10mRrn7BHgQDtzdt+xLY1A40GxEdU ncRwYaVYjLJZLd2TVbibiME6MYFYyg4Dr3UrMxQZV4hyKEPcX1FEYzMBB/TOfvM9XXj7z8 x0iVb4BCXzBO7dgo9j2//eIuhAtY3Mc= X-MC-Unique: M6ImzLtwPOikKrDX17YrBg-1 From: Pavel Mores To: libvir-list@redhat.com Subject: [libvirt PATCH 6/6] qemu: block: extend pull job completion with 'top' handling Date: Wed, 4 Mar 2020 11:12:40 +0100 Message-Id: <20200304101240.1139700-7-pmores@redhat.com> In-Reply-To: <20200304101240.1139700-1-pmores@redhat.com> References: <20200304101240.1139700-1-pmores@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Pavel Mores 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-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" 'top' handling basically requires two changes: besides the obvious adjustments to the code that fixes our backing chains (for both active and inactive configuration) after a pull, we need to make the top image read-only again if it's not identical with the active layer (it had to be made writable before submitting QMP block-stream to allow QEMU to fix the backing chain in top's qcow2). Signed-off-by: Pavel Mores --- src/qemu/qemu_blockjob.c | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_blockjob.c b/src/qemu/qemu_blockjob.c index e19a2ad76b..2e53821d43 100644 --- a/src/qemu/qemu_blockjob.c +++ b/src/qemu/qemu_blockjob.c @@ -962,6 +962,7 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPtr = driver, virDomainDiskDefPtr cfgdisk =3D NULL; virStorageSourcePtr cfgbase =3D NULL; virStorageSourcePtr cfgbaseparent =3D NULL; + virStorageSourcePtr cfgtop =3D NULL; virStorageSourcePtr n; virStorageSourcePtr tmp; =20 @@ -994,16 +995,40 @@ qemuBlockJobProcessEventCompletedPull(virQEMUDriverPt= r driver, } } =20 - tmp =3D job->disk->src->backingStore; - job->disk->src->backingStore =3D job->data.pull.base; + if (job->data.pull.top) { + cfgtop =3D cfgdisk->src->backingStore; + for (n =3D job->disk->src->backingStore; n && n !=3D job->data.pul= l.top; n =3D n->backingStore) { + if (cfgtop) + cfgtop =3D cfgtop->backingStore; + } + } + + if (job->data.pull.top && job->data.pull.top !=3D job->disk->src) { + if (qemuDomainStorageSourceAccessAllow(driver, vm, job->data.pull.= top, true, false) < 0) { + virReportError(VIR_ERR_ACCESS_DENIED, "can't reset 'top' to re= ad-only"); + } + } + + if (job->data.pull.top) { + tmp =3D job->data.pull.top->backingStore; + job->data.pull.top->backingStore =3D job->data.pull.base; + } else { + tmp =3D job->disk->src->backingStore; + job->disk->src->backingStore =3D job->data.pull.base; + } if (baseparent) baseparent->backingStore =3D NULL; qemuBlockJobEventProcessConcludedRemoveChain(driver, vm, asyncJob, tmp= ); virObjectUnref(tmp); =20 if (cfgdisk) { - tmp =3D cfgdisk->src->backingStore; - cfgdisk->src->backingStore =3D cfgbase; + if (job->data.pull.top) { + tmp =3D cfgtop->backingStore; + cfgtop->backingStore =3D cfgbase; + } else { + tmp =3D cfgdisk->src->backingStore; + cfgdisk->src->backingStore =3D cfgbase; + } if (cfgbaseparent) cfgbaseparent->backingStore =3D NULL; virObjectUnref(tmp); --=20 2.24.1