From nobody Wed Nov 27 16:39:13 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 1544688275423663.0456444638684; Thu, 13 Dec 2018 00:04:35 -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 8D3C3307DABB; Thu, 13 Dec 2018 08:04:33 +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 5968B3795; Thu, 13 Dec 2018 08:04:33 +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 09FD512E30; Thu, 13 Dec 2018 08:04:33 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id wBD84T7j009020 for ; Thu, 13 Dec 2018 03:04:29 -0500 Received: by smtp.corp.redhat.com (Postfix) id 1217460D0B; Thu, 13 Dec 2018 08:04:29 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0A272608C6 for ; Thu, 13 Dec 2018 08:04:26 +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 4614130B7A13 for ; Thu, 13 Dec 2018 08:04:24 +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 1gXLyo-0002eM-Nd for libvir-list@redhat.com; Thu, 13 Dec 2018 11:04:22 +0300 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Date: Thu, 13 Dec 2018 11:03:58 +0300 Message-Id: <1544688239-814454-9-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1544688239-814454-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1544688239-814454-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.43]); Thu, 13 Dec 2018 08:04:24 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Thu, 13 Dec 2018 08:04:24 +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.002 (RCVD_IN_MSPIKE_H2, SPF_PASS) 185.231.240.75 relay.sw.ru 185.231.240.75 relay.sw.ru X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 8/9] conf: snapshot: support persistent config on redefine 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.42]); Thu, 13 Dec 2018 08:04:34 +0000 (UTC) Content-Type: text/plain; charset="utf-8" This patch just adds basic checks for persistent domain config on snapshot metadata redefine. It also lets use previous version of config if it exists in previous version of metadata and not explicitly specified in new one just as in case of top level config. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: John Ferlan --- src/conf/snapshot_conf.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index fa1cd6b..b003a07 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -1315,6 +1315,22 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, goto cleanup; } =20 + if (def->persistDom && + memcmp(def->persistDom->uuid, domain->uuid, VIR_UUID_BUFLEN)) { + virReportError(VIR_ERR_INVALID_ARG, + _("persistent definition for snapshot %s must use u= uid %s"), + def->name, uuidstr); + goto cleanup; + } + + if (def->persistDom && + STRNEQ(def->persistDom->name, domain->name)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("persistent definition for snapshot %s must use n= ame %s"), + def->name, domain->name); + goto cleanup; + } + other =3D virDomainSnapshotFindByName(vm->snapshots, def->name); if (other) { if ((other->def->state =3D=3D VIR_DOMAIN_RUNNING || @@ -1349,6 +1365,11 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, } } =20 + if (other->def->persistDom && !def->persistDom) { + def->persistDom =3D other->def->persistDom; + other->def->persistDom =3D NULL; + } + if (def->dom) { if (def->state =3D=3D VIR_DOMAIN_DISK_SNAPSHOT || virDomainSnapshotDefIsExternal(def)) { @@ -1363,6 +1384,10 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, other->def->dom =3D def->dom; def->dom =3D NULL; } + if (def->persistDom && !other->def->persistDom) { + other->def->persistDom =3D def->persistDom; + def->persistDom =3D NULL; + } goto cleanup; } } --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list