From nobody Fri Mar 29 08:44:10 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1545906149912202.35394327225242; Thu, 27 Dec 2018 02:22:29 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id DAF2A40F15; Thu, 27 Dec 2018 10:22:27 +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 9E62060C6C; Thu, 27 Dec 2018 10:22:27 +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 45F1A3F607; Thu, 27 Dec 2018 10:22:27 +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 wBRALlMT028144 for ; Thu, 27 Dec 2018 05:21:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 94B0560C6B; Thu, 27 Dec 2018 10:21:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BFD9560C66; Thu, 27 Dec 2018 10:21:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BAF243C44; Thu, 27 Dec 2018 10:21:42 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gcSnM-0003jg-1S; Thu, 27 Dec 2018 13:21:40 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 27 Dec 2018 13:20:43 +0300 Message-Id: <1545906052-101494-2-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/10] conf: snapshot: fix comment in _virDomainSnapshotDef 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 27 Dec 2018 10:22:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy Reviewed-by: J=C3=A1n Tomko --- src/conf/snapshot_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index 5ac1ba7..7c15d15 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -66,7 +66,7 @@ struct _virDomainSnapshotDef { long long creationTime; /* in seconds */ int state; /* virDomainSnapshotState */ =20 - int memory; /* virDomainMemorySnapshot */ + int memory; /* virDomainSnapshotLocation */ char *file; /* memory state file when snapshot is external */ =20 size_t ndisks; /* should not exceed dom->ndisks */ --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 08:44:10 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1545906144533241.07809091446745; Thu, 27 Dec 2018 02:22:24 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 707CDA0492; Thu, 27 Dec 2018 10:22:22 +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 262E35DA9A; Thu, 27 Dec 2018 10:22:22 +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 C0135181B9EB; Thu, 27 Dec 2018 10:22:21 +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 wBRALlKI028123 for ; Thu, 27 Dec 2018 05:21:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 46A211A910; Thu, 27 Dec 2018 10:21:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DB63F1A7E8; Thu, 27 Dec 2018 10:21:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B44C17D0E0; Thu, 27 Dec 2018 10:21:42 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gcSnM-0003jg-9H; Thu, 27 Dec 2018 13:21:40 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 27 Dec 2018 13:20:44 +0300 Message-Id: <1545906052-101494-3-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/10] conf: snapshot: don't pass flags from different family 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: , MIME-Version: 1.0 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 27 Dec 2018 10:22:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" virDomainDiskSourceParse expects VIR_DOMAIN_DEF_PARSE_* values in @flags and we pass VIR_DOMAIN_SNAPSHOT_PARSE_* values. Fortunately sources of type 'file' and 'block' do not take flags into account and for source of type 'network' flags only make difference for tlsFromConfig atribute which is never passed I guess and never used. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: J=C3=A1n Tomko --- src/conf/snapshot_conf.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 7386b4a..db55b4f 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -108,7 +108,6 @@ static int virDomainSnapshotDiskDefParseXML(xmlNodePtr node, xmlXPathContextPtr ctxt, virDomainSnapshotDiskDefPtr def, - unsigned int flags, virDomainXMLOptionPtr xmlopt) { int ret =3D -1; @@ -154,7 +153,7 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, } =20 if ((cur =3D virXPathNode("./source", ctxt)) && - virDomainDiskSourceParse(cur, ctxt, def->src, flags, xmlopt) < 0) + virDomainDiskSourceParse(cur, ctxt, def->src, 0, xmlopt) < 0) goto cleanup; =20 if ((driver =3D virXPathString("string(./driver/@type)", ctxt)) && @@ -339,7 +338,7 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, def->ndisks =3D n; for (i =3D 0; i < def->ndisks; i++) { if (virDomainSnapshotDiskDefParseXML(nodes[i], ctxt, &def->dis= ks[i], - flags, xmlopt) < 0) + xmlopt) < 0) goto cleanup; } VIR_FREE(nodes); --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 08:44:10 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 154590611752017.382999876327517; Thu, 27 Dec 2018 02:21:57 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 381E0C050E00; Thu, 27 Dec 2018 10:21:55 +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 74DE6608DD; Thu, 27 Dec 2018 10:21: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 BF6F93F7CD; Thu, 27 Dec 2018 10:21:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBRALlMb028125 for ; Thu, 27 Dec 2018 05:21:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 600889CAA; Thu, 27 Dec 2018 10:21:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1F2E560161; Thu, 27 Dec 2018 10:21:45 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BB3CFBDF2; Thu, 27 Dec 2018 10:21:42 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gcSnM-0003jg-Fh; Thu, 27 Dec 2018 13:21:40 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 27 Dec 2018 13:20:45 +0300 Message-Id: <1545906052-101494-4-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/10] conf: snapshot: check disk with path on parse 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: , MIME-Version: 1.0 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 27 Dec 2018 10:21:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" We can move the hunk to the parsing stage. Because if disk->src->path is set and and disk->snapshot is not then it will be set to external on parsing stage by the above hunk in virDomainSnapshotDiskDefParseXML. Disk aligning will not have chance to set disk->snapshot. Signed-off-by: Nikolay Shirokovskiy --- src/conf/snapshot_conf.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index db55b4f..bd125dc 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -174,6 +174,15 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, if (!def->snapshot && (def->src->path || def->src->format)) def->snapshot =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; =20 + if (def->src->path && + def->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("file '%s' for disk '%s' requires " + "use of external snapshot mode"), + def->src->path, def->name); + goto cleanup; + } + ret =3D 0; cleanup: ctxt->node =3D saved; @@ -591,14 +600,6 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr de= f, disk->name, tmp); goto cleanup; } - if (disk->src->path && - disk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("file '%s' for disk '%s' requires " - "use of external snapshot mode"), - disk->src->path, disk->name); - goto cleanup; - } if (STRNEQ(disk->name, def->dom->disks[idx]->dst)) { VIR_FREE(disk->name); if (VIR_STRDUP(disk->name, def->dom->disks[idx]->dst) < 0) --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 08:44:10 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15459061446841004.7844114708696; Thu, 27 Dec 2018 02:22:24 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 47A07DF88E; Thu, 27 Dec 2018 10:22:22 +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 0587D1057066; Thu, 27 Dec 2018 10:22:22 +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 A4F5D181BA17; Thu, 27 Dec 2018 10:22:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBRALmZd028163 for ; Thu, 27 Dec 2018 05:21:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 07E345C23C; Thu, 27 Dec 2018 10:21:48 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D19225C22C; Thu, 27 Dec 2018 10:21:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B17EE85363; Thu, 27 Dec 2018 10:21:42 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gcSnM-0003jg-Jg; Thu, 27 Dec 2018 13:21:40 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 27 Dec 2018 13:20:46 +0300 Message-Id: <1545906052-101494-5-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.83 on 10.5.110.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/10] conf: snapshot: align exernal/internal snapshot the same way 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 27 Dec 2018 10:22:22 +0000 (UTC) Content-Type: text/plain; charset="utf-8" In case !require_match (disk snapshots or snapshot with external memory) setting disk->snapshot if it is not set in snapshot definition is straigtforward. First check default value for the disk from domain definiti= on (disk_snapshot) and use it if it is set, second if it is not set then use default value provided as function argument. But require_match case is trickier. For some reason it reverts this logic except for the case when disk_snapshot is none. This logic added in commit [1]. AFAIU this is done because mixing internal and external disks snapshots is not supported (and still is). But then it is not clear why in case of disks snapshots (!require_match) the logic is not the same as for internal snapshots because mixing is not supported in both cases. Also it is seems very surprising that for some snapshots domain disks settings are respected and for others are n= ot. Making exception for none seems complicating things further. AFAIU this exception intention was to disable snapshots for readonly disks because for these disks disk_snapshot is set to none on parsing stage. I suggest to use same logic for require_match as for !require_match. This m= akes things graspable in respect to settings priorities coming from different pl= aces. And this breaks clients that set disks_snapshot to external and then makes internal snapshots. I hope this was not used by anyone. There are no other changes. This function is used on snapshot redefine too. I guess users are not supposed to remove snapshot attributes for disks from previously dumped snapshot xmls. [1] f9670b - snapshot: improve disk align checking Signed-off-by: Nikolay Shirokovskiy --- src/conf/snapshot_conf.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index bd125dc..7d5367f 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -582,9 +582,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, =20 disk_snapshot =3D def->dom->disks[idx]->snapshot; if (!disk->snapshot) { - if (disk_snapshot && - (!require_match || - disk_snapshot =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_NONE)) + if (disk_snapshot) disk->snapshot =3D disk_snapshot; else disk->snapshot =3D default_snapshot; --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 08:44:10 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1545906139986551.5265881372419; Thu, 27 Dec 2018 02:22:19 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 2D27A7BDDB; Thu, 27 Dec 2018 10:22:18 +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 EA6DA1057044; Thu, 27 Dec 2018 10:22:17 +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 99FEA181B9E9; Thu, 27 Dec 2018 10:22:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBRALl46028158 for ; Thu, 27 Dec 2018 05:21:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id DFF519CAA; Thu, 27 Dec 2018 10:21:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8716B19807; Thu, 27 Dec 2018 10:21:45 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C1C2BC05D407; Thu, 27 Dec 2018 10:21:42 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gcSnM-0003jg-OG; Thu, 27 Dec 2018 13:21:40 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 27 Dec 2018 13:20:47 +0300 Message-Id: <1545906052-101494-6-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/10] conf: snapshot: remove snapshot mode checking from disk align 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 27 Dec 2018 10:22:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The removed hunk of code added in [1] in virDomainSnapshotAlignDisks either duplicates qemuDomainSnapshotPrepare checks or prohibit some meaningful cases and overall is complicated to think about (check next anal= ysis). It prohibit next cases: A. external disk snapshot, which fall in 3 cases 1. there are other disks with internal snapshot 2. all other disks snapshots are external and domain is active 3. the same as above but domain is inactive Cases 1 and 2 are disabled by qemuDomainSnapshotPrepare too and case 3 need= not to be prohibited. This way one can make external disk snapshot of inactive domain without disk only flag. One may argue why we need such a possibility - then why we have code at the bottom of qemuDomainSnapshotPrepare that adds disk only to @flags. This @flags mutating code starts to function only in= case 3. B. disabling disk snapshot if it is not disabled in domain disk config too. This actually does not make sense. Say snapshot is not disabled in disk con= fig and this check gives failure. Then I can disable it in disk config and pass this check and after that disk config is never checked so it is not clear w= hy fail first case and pass second. I guess the intention was to prohibit disabling non readonly disks as for readonly disk snapshot attribute is set to none on parse. So we'd better analyze these possibilites which fall = into 4 cases (all non-readonly): 1. empty disk and active domain 2. empty disk and inactive domain 3. non empty disk and there are some disks with internal snapshots 4. non empty disk and all other disks snapshots are external Cases 1, 2 and 4 are handled valid cases. The reasoning for case 2 is a bit tricky - it is hanled because only floppies are possible as empty non readonly disks and those are skipped by qemuDomainSnapshotForEach= Qcow2Raw. Case 3 is prohibited by qemuDomainSnapshotPrepare. Now @require_match in virDomainSnapshotAlignDisks is not used and can be removed. The above analysis only covers actually creating snapshot but not redefinin= g. Reasoning here is just as in the previous patch - I guess users are not supposed to edit disk's snapshot attributes. [1] f9670b - snapshot: improve disk align checking Signed-off-by: Nikolay Shirokovskiy --- src/conf/snapshot_conf.c | 33 +++++++-------------------------- src/conf/snapshot_conf.h | 3 +-- src/qemu/qemu_driver.c | 6 +----- src/test/test_driver.c | 5 +---- 4 files changed, 10 insertions(+), 37 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 7d5367f..2a35b25 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -526,12 +526,10 @@ virDomainSnapshotCompareDiskIndex(const void *a, cons= t void *b) * the domain, with a fallback to a passed in default. Convert paths * to disk targets for uniformity. Issue an error and return -1 if * any def->disks[n]->name appears more than once or does not map to - * dom->disks. If require_match, also ensure that there is no - * conflicting requests for both internal and external snapshots. */ + * dom->disks. */ int virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, - int default_snapshot, - bool require_match) + int default_snapshot) { int ret =3D -1; virBitmapPtr map =3D NULL; @@ -586,17 +584,6 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr de= f, disk->snapshot =3D disk_snapshot; else disk->snapshot =3D default_snapshot; - } else if (require_match && - disk->snapshot !=3D default_snapshot && - !(disk->snapshot =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_NO= NE && - disk_snapshot =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_NON= E)) { - const char *tmp; - - tmp =3D virDomainSnapshotLocationTypeToString(default_snapshot= ); - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("disk '%s' must use snapshot mode '%s'"), - disk->name, tmp); - goto cleanup; } if (STRNEQ(disk->name, def->dom->disks[idx]->dst)) { VIR_FREE(disk->name); @@ -1219,7 +1206,6 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, virDomainSnapshotDefPtr def =3D *defptr; int ret =3D -1; int align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL; - bool align_match =3D true; char uuidstr[VIR_UUID_STRING_BUFLEN]; virDomainSnapshotObjPtr other; =20 @@ -1312,13 +1298,10 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, =20 if (def->dom) { if (def->state =3D=3D VIR_DOMAIN_DISK_SNAPSHOT || - virDomainSnapshotDefIsExternal(def)) { + virDomainSnapshotDefIsExternal(def)) align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; - align_match =3D false; - } =20 - if (virDomainSnapshotAlignDisks(def, align_location, - align_match) < 0) { + if (virDomainSnapshotAlignDisks(def, align_location) < 0) { /* revert stealing of the snapshot domain definition */ if (def->dom && !other->def->dom) { other->def->dom =3D def->dom; @@ -1343,12 +1326,10 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, } else { if (def->dom) { if (def->state =3D=3D VIR_DOMAIN_DISK_SNAPSHOT || - def->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) { + def->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; - align_match =3D false; - } - if (virDomainSnapshotAlignDisks(def, align_location, - align_match) < 0) + + if (virDomainSnapshotAlignDisks(def, align_location) < 0) goto cleanup; } } diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index 7c15d15..3333d2e 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -118,8 +118,7 @@ char *virDomainSnapshotDefFormat(const char *domain_uui= d, unsigned int flags, int internal); int virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr snapshot, - int default_snapshot, - bool require_match); + int default_snapshot); virDomainSnapshotObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjLis= tPtr snapshots, virDomainSnapshotDefPtr= def); =20 diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index ea316f6..c6fba1a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15555,7 +15555,6 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, unsigned int parse_flags =3D VIR_DOMAIN_SNAPSHOT_PARSE_DISKS; virDomainSnapshotObjPtr other =3D NULL; int align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL; - bool align_match =3D true; virQEMUDriverConfigPtr cfg =3D NULL; virCapsPtr caps =3D NULL; qemuDomainObjPrivatePtr priv; @@ -15695,7 +15694,6 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, =20 if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) { align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; - align_match =3D false; if (virDomainObjIsActive(vm)) def->state =3D VIR_DOMAIN_DISK_SNAPSHOT; else @@ -15704,7 +15702,6 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, } else if (def->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNA= L) { def->state =3D virDomainObjGetState(vm, NULL); align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; - align_match =3D false; } else { def->state =3D virDomainObjGetState(vm, NULL); =20 @@ -15720,8 +15717,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, VIR_DOMAIN_SNAPSHOT_LOCATION_NONE : VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL); } - if (virDomainSnapshotAlignDisks(def, align_location, - align_match) < 0 || + if (virDomainSnapshotAlignDisks(def, align_location) < 0 || qemuDomainSnapshotPrepare(vm, def, &flags) < 0) goto endjob; } diff --git a/src/test/test_driver.c b/src/test/test_driver.c index b76f0b7..dbbc77d 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -6314,11 +6314,9 @@ testDomainSnapshotAlignDisks(virDomainObjPtr vm, unsigned int flags) { int align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL; - bool align_match =3D true; =20 if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY) { align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; - align_match =3D false; if (virDomainObjIsActive(vm)) def->state =3D VIR_DOMAIN_DISK_SNAPSHOT; else @@ -6327,7 +6325,6 @@ testDomainSnapshotAlignDisks(virDomainObjPtr vm, } else if (def->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) { def->state =3D virDomainObjGetState(vm, NULL); align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; - align_match =3D false; } else { def->state =3D virDomainObjGetState(vm, NULL); def->memory =3D def->state =3D=3D VIR_DOMAIN_SHUTOFF ? @@ -6335,7 +6332,7 @@ testDomainSnapshotAlignDisks(virDomainObjPtr vm, VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL; } =20 - return virDomainSnapshotAlignDisks(def, align_location, align_match); + return virDomainSnapshotAlignDisks(def, align_location); } =20 static virDomainSnapshotPtr --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 08:44:10 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1545906144179937.1431924044795; Thu, 27 Dec 2018 02:22:24 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 557E0A091E; Thu, 27 Dec 2018 10:22:22 +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 0338F1A914; Thu, 27 Dec 2018 10:22:22 +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 9C6CB181BA1A; Thu, 27 Dec 2018 10:22:21 +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 wBRALlrr028143 for ; Thu, 27 Dec 2018 05:21:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8E96D60C70; Thu, 27 Dec 2018 10:21:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C3FEF60C68; Thu, 27 Dec 2018 10:21:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AFEB540F19; Thu, 27 Dec 2018 10:21:42 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gcSnM-0003jg-UB; Thu, 27 Dec 2018 13:21:41 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 27 Dec 2018 13:20:48 +0300 Message-Id: <1545906052-101494-7-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/10] conf: virDomainSnapshotAlignDisks: use convinient variable 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 27 Dec 2018 10:22:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- src/conf/snapshot_conf.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 2a35b25..002cd45 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -560,6 +560,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, /* Double check requested disks. */ for (i =3D 0; i < def->ndisks; i++) { virDomainSnapshotDiskDefPtr disk =3D &def->disks[i]; + virDomainDiskDefPtr dom_disk; int idx =3D virDomainDiskIndexByName(def->dom, disk->name, false); int disk_snapshot; =20 @@ -577,17 +578,18 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr d= ef, } ignore_value(virBitmapSetBit(map, idx)); disk->idx =3D idx; + dom_disk =3D def->dom->disks[idx]; =20 - disk_snapshot =3D def->dom->disks[idx]->snapshot; + disk_snapshot =3D dom_disk->snapshot; if (!disk->snapshot) { if (disk_snapshot) disk->snapshot =3D disk_snapshot; else disk->snapshot =3D default_snapshot; } - if (STRNEQ(disk->name, def->dom->disks[idx]->dst)) { + if (STRNEQ(disk->name, dom_disk->dst)) { VIR_FREE(disk->name); - if (VIR_STRDUP(disk->name, def->dom->disks[idx]->dst) < 0) + if (VIR_STRDUP(disk->name, dom_disk->dst) < 0) goto cleanup; } } --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 08:44:10 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1545906140179410.0098068776741; Thu, 27 Dec 2018 02:22:20 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2C28D88E54; Thu, 27 Dec 2018 10:22:18 +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 E28105DA9A; Thu, 27 Dec 2018 10:22:17 +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 992F23F602; Thu, 27 Dec 2018 10:22:17 +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 wBRALl6k028142 for ; Thu, 27 Dec 2018 05:21:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8D71860C6D; Thu, 27 Dec 2018 10:21:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CED1C60C6B; Thu, 27 Dec 2018 10:21:44 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C0D1F7FDEB; Thu, 27 Dec 2018 10:21:42 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gcSnN-0003jg-2o; Thu, 27 Dec 2018 13:21:41 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 27 Dec 2018 13:20:49 +0300 Message-Id: <1545906052-101494-8-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.27 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/10] qemu: disable internal snapshot of readonly disk 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: , MIME-Version: 1.0 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 27 Dec 2018 10:22:18 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Now in case of active domain such a snapshot will complete successfully but disk will not have a correspondent internal snapshot as qemu will not make one. In case of inactive domain operation will finish successfully too but disk snapshot will be done. Let's disable such a snapshot because as described above in case of active domain it is not possible now and in both cases it does not make much sense. We recently disable external snapshot of readonly disk too in [1]. [1] 067aad26b - qemu: disable external snapshot of readonly disk Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c6fba1a..506d8ab 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14811,6 +14811,13 @@ qemuDomainSnapshotPrepareDiskInternal(virDomainDis= kDefPtr disk, { int actualType; =20 + if (disk->src->readonly) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("internal snapshot for readonly disk %s " + "is not supported"), disk->dst); + return -1; + } + /* active disks are handled by qemu itself so no need to worry about t= hose */ if (active) return 0; --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 08:44:10 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 154590611754981.53336954313613; Thu, 27 Dec 2018 02:21:57 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 0E6E46147B; Thu, 27 Dec 2018 10:21:55 +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 8B1A960C66; Thu, 27 Dec 2018 10:21: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 7AAA43F774; Thu, 27 Dec 2018 10:21:49 +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 wBRALlwp028124 for ; Thu, 27 Dec 2018 05:21:47 -0500 Received: by smtp.corp.redhat.com (Postfix) id 46AE11A914; Thu, 27 Dec 2018 10:21:47 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 483E61A7EE; Thu, 27 Dec 2018 10:21:46 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D5B429FDDB; Thu, 27 Dec 2018 10:21:42 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gcSnN-0003jg-76; Thu, 27 Dec 2018 13:21:41 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 27 Dec 2018 13:20:50 +0300 Message-Id: <1545906052-101494-9-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 27 Dec 2018 10:21:44 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 27 Dec 2018 10:21:44 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/10] qemu: snapshot: fix for case of disk with empty source 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: , MIME-Version: 1.0 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 27 Dec 2018 10:21:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" It is possible to specify any snapshot option for disk with empty source. Only cdrom and floppy can have empty source but cdrom is out of considering because it is always readonly (set on parse stage) and snapshotting readonly disks is now completely prohibited. Let's check floppies. In case of internal snapshot of such a disk for active or inactive domain snapshot returns success but actual snapshot is not possible of course. We need to prohibit this cases explicitly. In case of external snapshot of such a disk for active or inactive domain we get errors [1] and [2] respectively. It is better to have more user-frieldly messages. This patch prohibits explicitly all the above cases. [1] error in case of external disk snapshot of active domain error: internal error: unable to execute QEMU command 'transaction': Device= 'drive-fdc0-0-0' has no medium [2] error in case of external disk snapshot of inactive domain error: internal error: Child process (/usr/local/bin/qemu-img create -f qco= w2 \ -o 'backing_file=3D(null),backing_fmt=3Dqcow2' /path/file.qcow2) \ unexpected exit status 1: qemu-img: /path/file.qcow2: \ Could not open '/path/(null)': No such file or directory Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 506d8ab..bd3f00b 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14760,6 +14760,13 @@ qemuDomainSnapshotPrepareDiskExternal(virDomainDis= kDefPtr disk, return -1; } =20 + if (virStorageSourceIsEmpty(disk->src)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("snapshot for disk %s with empty source " + "is not possible"), disk->dst); + return -1; + } + if (qemuTranslateSnapshotDiskSourcePool(snapdisk) < 0) return -1; =20 @@ -14818,6 +14825,13 @@ qemuDomainSnapshotPrepareDiskInternal(virDomainDis= kDefPtr disk, return -1; } =20 + if (virStorageSourceIsEmpty(disk->src)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("snapshot for disk %s with empty source " + "is not possible"), disk->dst); + return -1; + } + /* active disks are handled by qemu itself so no need to worry about t= hose */ if (active) return 0; --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 08:44:10 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 154590615374592.59796579442241; Thu, 27 Dec 2018 02:22:33 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id 12BBC41A53; Thu, 27 Dec 2018 10:22:32 +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 D0A46608EC; Thu, 27 Dec 2018 10:22:31 +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 8268018433AF; Thu, 27 Dec 2018 10:22:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBRALm19028164 for ; Thu, 27 Dec 2018 05:21:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 0F96A5C3FA; Thu, 27 Dec 2018 10:21:48 +0000 (UTC) Received: from mx1.redhat.com (ext-mx10.extmail.prod.ext.phx2.redhat.com [10.5.110.39]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F28745C23A; Thu, 27 Dec 2018 10:21:45 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1A4E4A24EB; Thu, 27 Dec 2018 10:21:43 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gcSnN-0003jg-D4; Thu, 27 Dec 2018 13:21:41 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 27 Dec 2018 13:20:51 +0300 Message-Id: <1545906052-101494-10-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.39 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/10] qemu: snapshot: align disks consistently 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: , MIME-Version: 1.0 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 27 Dec 2018 10:22:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" There is inconsitency in how we set disk snapshot attribute for missing disk and for disk explicitly present in snapshot definition in virDomainSnapshot= AlignDisks. First for explicit disk we do not check if disk source is present. After the previous patch this will cause snapshot failures so we'd better disable snapshotting of such disk at this place. (For the record: we could have failures before previous patch too, it just does not makes sense to snapshot disk without source). Second for missing disks with empty source disabling snapshot take preceden= ce over user settings. This does not feel right. It is better report to user t= hat option he wanted in not supported/possible rather then ignoring it. This can break things a bit. Hopefully nobody really uses domain disk snapshot setting. Next let's remove setting disk snapshot on parse stage and move it altogeth= er to one place - disk align function. Other hypervisors does not check this attribute in domain disk config so we are free here. Now we can place logic for setting disk snapshot value in one function - virDomainSnapshotSetDiskSnapshot. Signed-off-by: Nikolay Shirokovskiy --- src/conf/domain_conf.c | 6 +----- src/conf/snapshot_conf.c | 38 +++++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index d8dfd16..0fbd739 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -9759,8 +9759,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, snapshot); goto error; } - } else if (def->src->readonly) { - def->snapshot =3D VIR_DOMAIN_SNAPSHOT_LOCATION_NONE; } =20 if (rawio) { @@ -24285,9 +24283,7 @@ virDomainDiskDefFormat(virBufferPtr buf, if (def->sgio) virBufferAsprintf(buf, " sgio=3D'%s'", sgio); =20 - if (def->snapshot && - !(def->snapshot =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_NONE && - def->src->readonly)) + if (def->snapshot) virBufferAsprintf(buf, " snapshot=3D'%s'", virDomainSnapshotLocationTypeToString(def->snaps= hot)); virBufferAddLit(buf, ">\n"); diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 002cd45..172dff8 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -521,6 +521,25 @@ virDomainSnapshotCompareDiskIndex(const void *a, const= void *b) return diska->idx - diskb->idx; } =20 + +static void +virDomainSnapshotSetDiskSnapshot(virDomainSnapshotDiskDefPtr disk, + virDomainDiskDefPtr dom_disk, + int default_snapshot) +{ + if (disk->snapshot) + return; + + if (dom_disk->snapshot) + disk->snapshot =3D dom_disk->snapshot; + else if (dom_disk->src->readonly || + virStorageSourceIsEmpty(dom_disk->src)) + disk->snapshot =3D VIR_DOMAIN_SNAPSHOT_LOCATION_NONE; + else + disk->snapshot =3D default_snapshot; +} + + /* Align def->disks to def->domain. Sort the list of def->disks, * filling in any missing disks or snapshot state defaults given by * the domain, with a fallback to a passed in default. Convert paths @@ -562,7 +581,6 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, virDomainSnapshotDiskDefPtr disk =3D &def->disks[i]; virDomainDiskDefPtr dom_disk; int idx =3D virDomainDiskIndexByName(def->dom, disk->name, false); - int disk_snapshot; =20 if (idx < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -580,13 +598,8 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr de= f, disk->idx =3D idx; dom_disk =3D def->dom->disks[idx]; =20 - disk_snapshot =3D dom_disk->snapshot; - if (!disk->snapshot) { - if (disk_snapshot) - disk->snapshot =3D disk_snapshot; - else - disk->snapshot =3D default_snapshot; - } + virDomainSnapshotSetDiskSnapshot(disk, dom_disk, default_snapshot); + if (STRNEQ(disk->name, dom_disk->dst)) { VIR_FREE(disk->name); if (VIR_STRDUP(disk->name, dom_disk->dst) < 0) @@ -612,15 +625,10 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr d= ef, goto cleanup; disk->idx =3D i; =20 - /* Don't snapshot empty drives */ - if (virStorageSourceIsEmpty(def->dom->disks[i]->src)) - disk->snapshot =3D VIR_DOMAIN_SNAPSHOT_LOCATION_NONE; - else - disk->snapshot =3D def->dom->disks[i]->snapshot; + virDomainSnapshotSetDiskSnapshot(disk, def->dom->disks[i], + default_snapshot); =20 disk->src->type =3D VIR_STORAGE_TYPE_FILE; - if (!disk->snapshot) - disk->snapshot =3D default_snapshot; } =20 qsort(&def->disks[0], def->ndisks, sizeof(def->disks[0]), --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Mar 29 08:44:10 2024 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=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1545906153666790.9408437894411; Thu, 27 Dec 2018 02:22:33 -0800 (PST) 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 mx1.redhat.com (Postfix) with ESMTPS id EF6FBC0BEAA5; Thu, 27 Dec 2018 10:22:31 +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 B77461057068; Thu, 27 Dec 2018 10:22:31 +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 6BD283F60D; Thu, 27 Dec 2018 10:22:31 +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 wBRALnO6028180 for ; Thu, 27 Dec 2018 05:21:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 076C25DD63; Thu, 27 Dec 2018 10:21:49 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38D845DAA0; Thu, 27 Dec 2018 10:21:45 +0000 (UTC) Received: from relay.sw.ru (relay.sw.ru [185.231.240.75]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3673E3C2CF5; Thu, 27 Dec 2018 10:21:43 +0000 (UTC) Received: from [10.94.3.220] (helo=dim-vz7.qa.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1gcSnN-0003jg-J9; Thu, 27 Dec 2018 13:21:41 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 27 Dec 2018 13:20:52 +0300 Message-Id: <1545906052-101494-11-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1545906052-101494-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Greylist: Sender passed SPF test, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 27 Dec 2018 10:21:43 +0000 (UTC) for IP:'185.231.240.75' DOMAIN:'relay.sw.ru' HELO:'relay.sw.ru' FROM:'nshirokovskiy@virtuozzo.com' RCPT:'' X-RedHat-Spam-Score: -0.001 (SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/10] conf: snapshot: make disk aligns same on redefinition 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 27 Dec 2018 10:22:32 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This patch is similar to [1] but reason is different. At time [1] was writt= en there is a check in virDomainSnapshotAlignDisks (it is removed in [2]) that won't allow external disks of external snapshot because of wrong align_loca= tion VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL. Now this check is gone. In case of disk snapshot and external snapshots we always dumped disks (see= [3] were at that time libvirt only makes active disk only snapshots, active internal snaphots and inactive internal snapshots. Then after the patch we start to dump disks snapshot section for all snapshots and before we do only active disk only snapshots). So if user's edits to dumped snapshots before redefine is limited then we don't need actually to call align for external cases. But's lets leave it for the case and then make disk align same wheth= er snapshot is redefined first time or not. [1] 731a5a4 - snapshot: qemu: Allow redefinition of external snapshots [2] --- * - conf: snapshot: remove snapshot mode checking from disk align [3] 4201a7e - snapshot: new XML for external system checkpoint * not yet pushed upstream (part of current patch series) Signed-off-by: Nikolay Shirokovskiy --- src/conf/snapshot_conf.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 172dff8..3033827 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -1307,6 +1307,8 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, } =20 if (def->dom) { + /* we can skip align in this cases as well as we always + * dumped disks for these cases */ if (def->state =3D=3D VIR_DOMAIN_DISK_SNAPSHOT || virDomainSnapshotDefIsExternal(def)) align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; @@ -1335,8 +1337,10 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, *snap =3D other; } else { if (def->dom) { + /* we can skip align in this cases as well as we always + * dumped disks for these cases */ if (def->state =3D=3D VIR_DOMAIN_DISK_SNAPSHOT || - def->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) + virDomainSnapshotDefIsExternal(def)) align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; =20 if (virDomainSnapshotAlignDisks(def, align_location) < 0) --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list