From nobody Sun May 5 01:44:04 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=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1550764038884268.9103189898083; Thu, 21 Feb 2019 07:47:18 -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 E557F882EA; Thu, 21 Feb 2019 15:47:16 +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 AB61819C59; Thu, 21 Feb 2019 15:47:16 +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 0B6513FA45; Thu, 21 Feb 2019 15:47:16 +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 x1LFlEQ2009087 for ; Thu, 21 Feb 2019 10:47:14 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8D4B2282C3; Thu, 21 Feb 2019 15:47:14 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-222.phx2.redhat.com [10.3.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5AD3B282C2 for ; Thu, 21 Feb 2019 15:47:12 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Thu, 21 Feb 2019 09:47:11 -0600 Message-Id: <20190221154711.14531-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] snapshot: Saner use of uuid 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: , 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.28]); Thu, 21 Feb 2019 15:47:17 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Most of the code base is fairly consistent about using the name 'uuidstr' when dealing with a formatted human-readable form, and 'uuid' when dealing with the smaller raw bytes form. Fix snapshot_conf to comply, as well as reducing the scope of a human string to only the error message that needs it. Signed-off-by: Eric Blake --- Pushing this one under the trivial rule. src/conf/snapshot_conf.h | 2 +- src/conf/snapshot_conf.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index cc25164261..7a175dfc96 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -111,7 +111,7 @@ virDomainSnapshotDefPtr virDomainSnapshotDefParseNode(x= mlDocPtr xml, virDomainXMLOptionPt= r xmlopt, unsigned int flags); void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def); -char *virDomainSnapshotDefFormat(const char *domain_uuid, +char *virDomainSnapshotDefFormat(const char *uuidstr, virDomainSnapshotDefPtr def, virCapsPtr caps, virDomainXMLOptionPtr xmlopt, diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 1afc7de30c..489c25f511 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -688,7 +688,7 @@ virDomainSnapshotDiskDefFormat(virBufferPtr buf, char * -virDomainSnapshotDefFormat(const char *domain_uuid, +virDomainSnapshotDefFormat(const char *uuidstr, virDomainSnapshotDefPtr def, virCapsPtr caps, virDomainXMLOptionPtr xmlopt, @@ -744,10 +744,10 @@ virDomainSnapshotDefFormat(const char *domain_uuid, if (def->dom) { if (virDomainDefFormatInternal(def->dom, caps, flags, &buf, xmlopt= ) < 0) goto error; - } else if (domain_uuid) { + } else if (uuidstr) { virBufferAddLit(&buf, "\n"); virBufferAdjustIndent(&buf, 2); - virBufferAsprintf(&buf, "%s\n", domain_uuid); + virBufferAsprintf(&buf, "%s\n", uuidstr); virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); } @@ -1224,11 +1224,8 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, 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; - virUUIDFormat(domain->uuid, uuidstr); - /* Prevent circular chains */ if (def->parent) { if (STREQ(def->name, def->parent)) { @@ -1274,6 +1271,9 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, if (def->dom && memcmp(def->dom->uuid, domain->uuid, VIR_UUID_BUFLEN)) { + char uuidstr[VIR_UUID_STRING_BUFLEN]; + + virUUIDFormat(domain->uuid, uuidstr); virReportError(VIR_ERR_INVALID_ARG, _("definition for snapshot %s must use uuid %s"), def->name, uuidstr); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list