From nobody Mon Feb 9 08:28:00 2026 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 ARC-Seal: i=1; a=rsa-sha256; t=1557354303; cv=none; d=zoho.com; s=zohoarc; b=NSuyHYFv0duVLjkID/lMFQzmDbAMVYp6hAfYWnMfHHljSeftUvmRpsovdpg4PD7sd2VfiV9TPZZ9XEp0xxkxxEIcaGtyXF4e6TknQRwpVbGaWPSJ+/3wEkQ1MG49YS24M5fxiMAiG8v91NKM2mx80RvUoy0+iK8cIe0kVUyHQOc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1557354303; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=zdYfN+SogwE4VtQM8EoYj594n67THGq/G7ZZ8ob+ucU=; b=iuAOUjr4124CWDsaciUxfF12tb1Xq0PVx43AGLRjEa0GbDNfkaLy9pZnnwaLUGqEtH1Wx7eEmhsqGljsue1Bui+vs4b+82hZtHH6lvpzrY/n5dj+95/gn/1ZWVuUPsKUrPQMxh8y81sp4B8ltved6gn+BcxG2hCxcp1GkwZv6RM= ARC-Authentication-Results: i=1; mx.zoho.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 header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1557354303350985.7661846318698; Wed, 8 May 2019 15:25:03 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id D94AC309B171; Wed, 8 May 2019 22:25:00 +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 AFC2D5C269; Wed, 8 May 2019 22:25:00 +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 67B1E41F3C; Wed, 8 May 2019 22:25:00 +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 x48MOG0X021454 for ; Wed, 8 May 2019 18:24:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42F8960C93; Wed, 8 May 2019 22:24:16 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-15.phx2.redhat.com [10.3.116.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id DFDA060C6F for ; Wed, 8 May 2019 22:24:15 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Wed, 8 May 2019 17:24:10 -0500 Message-Id: <20190508222412.11811-3-eblake@redhat.com> In-Reply-To: <20190508222412.11811-1-eblake@redhat.com> References: <20190508222412.11811-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] snapshot: s/current/parent/ as prep for virObject 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.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 08 May 2019 22:25:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" VIR_CLASS_NEW insists that descendents of virObject have 'parent' as the name of their inherited member at offset 0. While it would be possible to write a new class-creation macro that takes the actual field name 'current', and rewrite VIR_CLASS_NEW to call the new macro with the hard-coded name 'parent', it seems less confusing if all object code uses similar naming. Thus, this is a mechanical rename in preparation of making virDomainSnapshotDef a descendent of virObject. Signed-off-by: Eric Blake --- src/conf/snapshot_conf.h | 2 +- src/conf/snapshot_conf.c | 120 ++++++++++++++-------------- src/conf/virdomainsnapshotobjlist.c | 2 +- src/esx/esx_driver.c | 16 ++-- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_driver.c | 12 +-- src/test/test_driver.c | 2 +- src/vbox/vbox_common.c | 88 ++++++++++---------- src/vz/vz_driver.c | 2 +- src/vz/vz_sdk.c | 10 +-- 10 files changed, 128 insertions(+), 128 deletions(-) diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index 5a762ccd96..f54be11619 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -74,7 +74,7 @@ struct _virDomainSnapshotDiskDef { /* Stores the complete snapshot metadata */ struct _virDomainSnapshotDef { - virDomainMomentDef common; + virDomainMomentDef parent; /* Additional public XML. */ int state; /* virDomainSnapshotState */ diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index b571c5cc41..dd281d57fe 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -88,7 +88,7 @@ void virDomainSnapshotDefFree(virDomainSnapshotDefPtr def) if (!def) return; - virDomainMomentDefClear(&def->common); + virDomainMomentDefClear(&def->parent); VIR_FREE(def->file); for (i =3D 0; i < def->ndisks; i++) virDomainSnapshotDiskDefClear(&def->disks[i]); @@ -208,8 +208,8 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, if (VIR_ALLOC(def) < 0) goto cleanup; - def->common.name =3D virXPathString("string(./name)", ctxt); - if (def->common.name =3D=3D NULL) { + def->parent.name =3D virXPathString("string(./name)", ctxt); + if (def->parent.name =3D=3D NULL) { if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE) { virReportError(VIR_ERR_XML_ERROR, "%s", _("a redefined snapshot must have a name")); @@ -217,17 +217,17 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, } } - def->common.description =3D virXPathString("string(./description)", ct= xt); + def->parent.description =3D virXPathString("string(./description)", ct= xt); if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_REDEFINE) { if (virXPathLongLong("string(./creationTime)", ctxt, - &def->common.creationTime) < 0) { + &def->parent.creationTime) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing creationTime from existing snapshot"= )); goto cleanup; } - def->common.parent_name =3D virXPathString("string(./parent/name)"= , ctxt); + def->parent.parent_name =3D virXPathString("string(./parent/name)"= , ctxt); state =3D virXPathString("string(./state)", ctxt); if (state =3D=3D NULL) { @@ -263,14 +263,14 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, _("missing domain in snapshot")); goto cleanup; } - def->common.dom =3D virDomainDefParseNode(ctxt->node->doc, dom= ainNode, + def->parent.dom =3D virDomainDefParseNode(ctxt->node->doc, dom= ainNode, caps, xmlopt, NULL, do= mainflags); - if (!def->common.dom) + if (!def->parent.dom) goto cleanup; } else { VIR_WARN("parsing older snapshot that lacks domain"); } - } else if (virDomainXMLOptionRunMomentPostParse(xmlopt, &def->common) = < 0) { + } else if (virDomainXMLOptionRunMomentPostParse(xmlopt, &def->parent) = < 0) { goto cleanup; } @@ -422,7 +422,7 @@ virDomainSnapshotDefParseString(const char *xmlStr, /* Perform sanity checking on a redefined snapshot definition. If - * @other is non-NULL, this may include swapping def->common.dom from other + * @other is non-NULL, this may include swapping def->parent.dom from other * into def. */ int virDomainSnapshotRedefineValidate(virDomainSnapshotDefPtr def, @@ -440,17 +440,17 @@ virDomainSnapshotRedefineValidate(virDomainSnapshotDe= fPtr def, virReportError(VIR_ERR_INVALID_ARG, _("disk-only flag for snapshot %s requires " "disk-snapshot state"), - def->common.name); + def->parent.name); return -1; } - if (def->common.dom && memcmp(def->common.dom->uuid, domain_uuid, + if (def->parent.dom && memcmp(def->parent.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->common.name, uuidstr); + def->parent.name, uuidstr); return -1; } @@ -464,7 +464,7 @@ virDomainSnapshotRedefineValidate(virDomainSnapshotDefP= tr def, virReportError(VIR_ERR_INVALID_ARG, _("cannot change between online and offline " "snapshot state in snapshot %s"), - def->common.name); + def->parent.name); return -1; } @@ -473,23 +473,23 @@ virDomainSnapshotRedefineValidate(virDomainSnapshotDe= fPtr def, virReportError(VIR_ERR_INVALID_ARG, _("cannot change between disk only and " "full system in snapshot %s"), - def->common.name); + def->parent.name); return -1; } - if (otherdef->common.dom) { - if (def->common.dom) { - if (!virDomainDefCheckABIStability(otherdef->common.dom, - def->common.dom, xmlopt= )) + if (otherdef->parent.dom) { + if (def->parent.dom) { + if (!virDomainDefCheckABIStability(otherdef->parent.dom, + def->parent.dom, xmlopt= )) return -1; } else { /* Transfer the domain def */ - VIR_STEAL_PTR(def->common.dom, otherdef->common.dom); + VIR_STEAL_PTR(def->parent.dom, otherdef->parent.dom); } } } - if (def->common.dom) { + if (def->parent.dom) { if (external) { align_location =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; align_match =3D false; @@ -536,7 +536,7 @@ virDomainSnapshotDefAssignExternalNames(virDomainSnapsh= otDefPtr def) return -1; } - if (!(origpath =3D virDomainDiskGetSource(def->common.dom->disks[i= ]))) { + if (!(origpath =3D virDomainDiskGetSource(def->parent.dom->disks[i= ]))) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("cannot generate external snapshot name " "for disk '%s' without source"), @@ -560,7 +560,7 @@ virDomainSnapshotDefAssignExternalNames(virDomainSnapsh= otDefPtr def) if ((tmp =3D strrchr(tmppath, '.')) && !strchr(tmp, '/')) *tmp =3D '\0'; - if (virAsprintf(&disk->src->path, "%s.%s", tmppath, def->common.na= me) < 0) { + if (virAsprintf(&disk->src->path, "%s.%s", tmppath, def->parent.na= me) < 0) { VIR_FREE(tmppath); return -1; } @@ -593,7 +593,7 @@ virDomainSnapshotCompareDiskIndex(const void *a, const = void *b) return diska->idx - diskb->idx; } -/* Align def->disks to def->common.dom. Sort the list of def->disks, +/* Align def->disks to def->parent.dom. 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 * to disk targets for uniformity. Issue an error and return -1 if @@ -610,31 +610,31 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr d= ef, size_t i; int ndisks; - if (!def->common.dom) { + if (!def->parent.dom) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing domain in snapshot")); goto cleanup; } - if (def->ndisks > def->common.dom->ndisks) { + if (def->ndisks > def->parent.dom->ndisks) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("too many disk snapshot requests for domain")); goto cleanup; } /* Unlikely to have a guest without disks but technically possible. */ - if (!def->common.dom->ndisks) { + if (!def->parent.dom->ndisks) { ret =3D 0; goto cleanup; } - if (!(map =3D virBitmapNew(def->common.dom->ndisks))) + if (!(map =3D virBitmapNew(def->parent.dom->ndisks))) goto cleanup; /* Double check requested disks. */ for (i =3D 0; i < def->ndisks; i++) { virDomainSnapshotDiskDefPtr disk =3D &def->disks[i]; - int idx =3D virDomainDiskIndexByName(def->common.dom, disk->name, = false); + int idx =3D virDomainDiskIndexByName(def->parent.dom, disk->name, = false); int disk_snapshot; if (idx < 0) { @@ -652,7 +652,7 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, ignore_value(virBitmapSetBit(map, idx)); disk->idx =3D idx; - disk_snapshot =3D def->common.dom->disks[idx]->snapshot; + disk_snapshot =3D def->parent.dom->disks[idx]->snapshot; if (!disk->snapshot) { if (disk_snapshot && (!require_match || @@ -680,9 +680,9 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr def, disk->src->path, disk->name); goto cleanup; } - if (STRNEQ(disk->name, def->common.dom->disks[idx]->dst)) { + if (STRNEQ(disk->name, def->parent.dom->disks[idx]->dst)) { VIR_FREE(disk->name); - if (VIR_STRDUP(disk->name, def->common.dom->disks[idx]->dst) <= 0) + if (VIR_STRDUP(disk->name, def->parent.dom->disks[idx]->dst) <= 0) goto cleanup; } } @@ -690,10 +690,10 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr d= ef, /* Provide defaults for all remaining disks. */ ndisks =3D def->ndisks; if (VIR_EXPAND_N(def->disks, def->ndisks, - def->common.dom->ndisks - def->ndisks) < 0) + def->parent.dom->ndisks - def->ndisks) < 0) goto cleanup; - for (i =3D 0; i < def->common.dom->ndisks; i++) { + for (i =3D 0; i < def->parent.dom->ndisks; i++) { virDomainSnapshotDiskDefPtr disk; if (virBitmapIsBitSet(map, i)) @@ -701,15 +701,15 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDefPtr d= ef, disk =3D &def->disks[ndisks++]; if (!(disk->src =3D virStorageSourceNew())) goto cleanup; - if (VIR_STRDUP(disk->name, def->common.dom->disks[i]->dst) < 0) + if (VIR_STRDUP(disk->name, def->parent.dom->disks[i]->dst) < 0) goto cleanup; disk->idx =3D i; /* Don't snapshot empty drives */ - if (virStorageSourceIsEmpty(def->common.dom->disks[i]->src)) + if (virStorageSourceIsEmpty(def->parent.dom->disks[i]->src)) disk->snapshot =3D VIR_DOMAIN_SNAPSHOT_LOCATION_NONE; else - disk->snapshot =3D def->common.dom->disks[i]->snapshot; + disk->snapshot =3D def->parent.dom->disks[i]->snapshot; disk->src->type =3D VIR_STORAGE_TYPE_FILE; if (!disk->snapshot) @@ -801,26 +801,26 @@ virDomainSnapshotDefFormatInternal(virBufferPtr buf, virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); - virBufferEscapeString(buf, "%s\n", def->common.name); - if (def->common.description) + virBufferEscapeString(buf, "%s\n", def->parent.name); + if (def->parent.description) virBufferEscapeString(buf, "%s\n", - def->common.description); + def->parent.description); if (def->state) virBufferAsprintf(buf, "%s\n", virDomainSnapshotStateTypeToString(def->state)); - if (def->common.parent_name) { + if (def->parent.parent_name) { virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); virBufferEscapeString(buf, "%s\n", - def->common.parent_name); + def->parent.parent_name); virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); } - if (def->common.creationTime) + if (def->parent.creationTime) virBufferAsprintf(buf, "%lld\n", - def->common.creationTime); + def->parent.creationTime); if (def->memory) { virBufferAsprintf(buf, "\n"); } - if (def->common.dom) { - if (virDomainDefFormatInternal(def->common.dom, caps, domainflags,= buf, + if (def->parent.dom) { + if (virDomainDefFormatInternal(def->parent.dom, caps, domainflags,= buf, xmlopt) < 0) goto error; } else if (uuidstr) { @@ -933,31 +933,31 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, bool check_if_stolen; /* Prevent circular chains */ - if (def->common.parent_name) { - if (STREQ(def->common.name, def->common.parent_name)) { + if (def->parent.parent_name) { + if (STREQ(def->parent.name, def->parent.parent_name)) { virReportError(VIR_ERR_INVALID_ARG, _("cannot set snapshot %s as its own parent"), - def->common.name); + def->parent.name); return -1; } other =3D virDomainSnapshotFindByName(vm->snapshots, - def->common.parent_name); + def->parent.parent_name); if (!other) { virReportError(VIR_ERR_INVALID_ARG, _("parent %s for snapshot %s not found"), - def->common.parent_name, def->common.name); + def->parent.parent_name, def->parent.name); return -1; } otherdef =3D virDomainSnapshotObjGetDef(other); - while (otherdef->common.parent_name) { - if (STREQ(otherdef->common.parent_name, def->common.name)) { + while (otherdef->parent.parent_name) { + if (STREQ(otherdef->parent.parent_name, def->parent.name)) { virReportError(VIR_ERR_INVALID_ARG, _("parent %s would create cycle to %s"), - otherdef->common.name, def->common.name); + otherdef->parent.name, def->parent.name); return -1; } other =3D virDomainSnapshotFindByName(vm->snapshots, - otherdef->common.parent_na= me); + otherdef->parent.parent_na= me); if (!other) { VIR_WARN("snapshots are inconsistent for %s", vm->def->name); @@ -967,14 +967,14 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, } } - other =3D virDomainSnapshotFindByName(vm->snapshots, def->common.name); + other =3D virDomainSnapshotFindByName(vm->snapshots, def->parent.name); otherdef =3D other ? virDomainSnapshotObjGetDef(other) : NULL; - check_if_stolen =3D other && otherdef->common.dom; + check_if_stolen =3D other && otherdef->parent.dom; if (virDomainSnapshotRedefineValidate(def, domain->uuid, other, xmlopt, flags) < 0) { /* revert any stealing of the snapshot domain definition */ - if (check_if_stolen && def->common.dom && !otherdef->common.dom) - VIR_STEAL_PTR(otherdef->common.dom, def->common.dom); + if (check_if_stolen && def->parent.dom && !otherdef->parent.dom) + VIR_STEAL_PTR(otherdef->parent.dom, def->parent.dom); return -1; } if (other) { @@ -987,7 +987,7 @@ virDomainSnapshotRedefinePrep(virDomainPtr domain, * child relations by reusing snap. */ virDomainMomentDropParent(other); virDomainSnapshotDefFree(otherdef); - other->def =3D &(*defptr)->common; + other->def =3D &(*defptr)->parent; *defptr =3D NULL; *snap =3D other; } diff --git a/src/conf/virdomainsnapshotobjlist.c b/src/conf/virdomainsnapsh= otobjlist.c index 46b7d8b0e7..9bcc8d1036 100644 --- a/src/conf/virdomainsnapshotobjlist.c +++ b/src/conf/virdomainsnapshotobjlist.c @@ -44,7 +44,7 @@ virDomainMomentObjPtr virDomainSnapshotAssignDef(virDomainSnapshotObjListPtr snapshots, virDomainSnapshotDefPtr def) { - return virDomainMomentAssignDef(snapshots->base, &def->common); + return virDomainMomentAssignDef(snapshots->base, &def->parent); } diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index dff801f946..f45d96a4f5 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -4118,7 +4118,7 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const= char *xmlDesc, priv->parsedUri->autoAnswer) < 0 || esxVI_LookupRootSnapshotTreeList(priv->primary, domain->uuid, &rootSnapshotList) < 0 || - esxVI_GetSnapshotTreeByName(rootSnapshotList, def->common.name, + esxVI_GetSnapshotTreeByName(rootSnapshotList, def->parent.name, &snapshotTree, NULL, esxVI_Occurrence_OptionalItem) < 0) { goto cleanup; @@ -4126,12 +4126,12 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, con= st char *xmlDesc, if (snapshotTree) { virReportError(VIR_ERR_OPERATION_INVALID, - _("Snapshot '%s' already exists"), def->common.name= ); + _("Snapshot '%s' already exists"), def->parent.name= ); goto cleanup; } if (esxVI_CreateSnapshot_Task(priv->primary, virtualMachine->obj, - def->common.name, def->common.descriptio= n, + def->parent.name, def->parent.descriptio= n, diskOnly ? esxVI_Boolean_False : esxVI_B= oolean_True, quiesce ? esxVI_Boolean_True : esxVI_Boo= lean_False, &task) < 0 || @@ -4148,7 +4148,7 @@ esxDomainSnapshotCreateXML(virDomainPtr domain, const= char *xmlDesc, goto cleanup; } - snapshot =3D virGetDomainSnapshot(domain, def->common.name); + snapshot =3D virGetDomainSnapshot(domain, def->parent.name); cleanup: virDomainSnapshotDefFree(def); @@ -4189,12 +4189,12 @@ esxDomainSnapshotGetXMLDesc(virDomainSnapshotPtr sn= apshot, goto cleanup; } - def.common.name =3D snapshot->name; - def.common.description =3D snapshotTree->description; - def.common.parent_name =3D snapshotTreeParent ? snapshotTreeParent->na= me : NULL; + def.parent.name =3D snapshot->name; + def.parent.description =3D snapshotTree->description; + def.parent.parent_name =3D snapshotTreeParent ? snapshotTreeParent->na= me : NULL; if (esxVI_DateTime_ConvertToCalendarTime(snapshotTree->createTime, - &def.common.creationTime) < 0= ) { + &def.parent.creationTime) < 0= ) { goto cleanup; } diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 6b16da2998..53012f4116 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -8467,7 +8467,7 @@ qemuDomainSnapshotWriteMetadata(virDomainObjPtr vm, goto cleanup; } - if (virAsprintf(&snapFile, "%s/%s.xml", snapDir, def->common.name) < 0) + if (virAsprintf(&snapFile, "%s/%s.xml", snapDir, def->parent.name) < 0) goto cleanup; ret =3D virXMLSaveFile(snapFile, NULL, "snapshot-edit", newxml); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c12b3dff6c..833c1e88ee 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -14446,7 +14446,7 @@ qemuDomainSnapshotCreateInactiveExternal(virQEMUDri= verPtr driver, * create them correctly. */ for (i =3D 0; i < snapdef->ndisks && !reuse; i++) { snapdisk =3D &(snapdef->disks[i]); - defdisk =3D snapdef->common.dom->disks[snapdisk->idx]; + defdisk =3D snapdef->parent.dom->disks[snapdisk->idx]; if (snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL) continue; @@ -15621,19 +15621,19 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, /* reject snapshot names containing slashes or starting with dot as * snapshot definitions are saved in files named by the snapshot name = */ if (!(flags & VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA)) { - if (strchr(def->common.name, '/')) { + if (strchr(def->parent.name, '/')) { virReportError(VIR_ERR_XML_DETAIL, _("invalid snapshot name '%s': " "name can't contain '/'"), - def->common.name); + def->parent.name); goto cleanup; } - if (def->common.name[0] =3D=3D '.') { + if (def->parent.name[0] =3D=3D '.') { virReportError(VIR_ERR_XML_DETAIL, _("invalid snapshot name '%s': " "name can't start with '.'"), - def->common.name); + def->parent.name); goto cleanup; } } @@ -15704,7 +15704,7 @@ qemuDomainSnapshotCreateXML(virDomainPtr domain, * conversion in and back out of xml. */ if (!(xml =3D qemuDomainDefFormatLive(driver, vm->def, priv->origC= PU, true, true)) || - !(def->common.dom =3D virDomainDefParseString(xml, caps, drive= r->xmlopt, NULL, + !(def->parent.dom =3D virDomainDefParseString(xml, caps, drive= r->xmlopt, NULL, VIR_DOMAIN_DEF_PAR= SE_INACTIVE | VIR_DOMAIN_DEF_PAR= SE_SKIP_VALIDATE))) goto endjob; diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 626167f947..aaf67eaac9 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -6403,7 +6403,7 @@ testDomainSnapshotCreateXML(virDomainPtr domain, &update_current, flags) < 0) goto cleanup; } else { - if (!(def->common.dom =3D virDomainDefCopy(vm->def, + if (!(def->parent.dom =3D virDomainDefCopy(vm->def, privconn->caps, privconn->xmlopt, NULL, diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 94830f5ddb..af557690c4 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -4811,7 +4811,7 @@ vboxSnapshotRedefine(virDomainPtr dom, * read-only disks are in the redefined snapshot's media registry (the= disks need to * be open to query their uuid). */ - for (it =3D 0; it < def->common.dom->ndisks; it++) { + for (it =3D 0; it < def->parent.dom->ndisks; it++) { int diskInMediaRegistry =3D 0; IMedium *readOnlyMedium =3D NULL; PRUnichar *locationUtf =3D NULL; @@ -4825,7 +4825,7 @@ vboxSnapshotRedefine(virDomainPtr dom, VBOX_IID_INITIALIZE(&iid); VBOX_IID_INITIALIZE(&parentiid); diskInMediaRegistry =3D virVBoxSnapshotConfDiskIsInMediaRegistry(s= napshotMachineDesc, - def->common.dom->d= isks[it]->src->path); + def->parent.dom->d= isks[it]->src->path); if (diskInMediaRegistry =3D=3D -1) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to know if disk is in media registry"= )); @@ -4835,7 +4835,7 @@ vboxSnapshotRedefine(virDomainPtr dom, continue; /*The read only disk is not in the media registry*/ - VBOX_UTF8_TO_UTF16(def->common.dom->disks[it]->src->path, &locatio= nUtf); + VBOX_UTF8_TO_UTF16(def->parent.dom->disks[it]->src->path, &locatio= nUtf); rc =3D gVBoxAPI.UIVirtualBox.OpenMedium(data->vboxObj, locationUtf, DeviceType_HardDisk, @@ -4908,7 +4908,7 @@ vboxSnapshotRedefine(virDomainPtr dom, readOnlyDisk->format =3D format; readOnlyDisk->uuid =3D uuid; - if (VIR_STRDUP(readOnlyDisk->location, def->common.dom->disks[it]-= >src->path) < 0) { + if (VIR_STRDUP(readOnlyDisk->location, def->parent.dom->disks[it]-= >src->path) < 0) { VIR_FREE(readOnlyDisk); goto cleanup; } @@ -5013,12 +5013,12 @@ vboxSnapshotRedefine(virDomainPtr dom, goto cleanup; VIR_DEBUG("New snapshot UUID: %s", newSnapshotPtr->uuid); - if (VIR_STRDUP(newSnapshotPtr->name, def->common.name) < 0) + if (VIR_STRDUP(newSnapshotPtr->name, def->parent.name) < 0) goto cleanup; - newSnapshotPtr->timeStamp =3D virTimeStringThen(def->common.creationTi= me * 1000); + newSnapshotPtr->timeStamp =3D virTimeStringThen(def->parent.creationTi= me * 1000); - if (VIR_STRDUP(newSnapshotPtr->description, def->common.description) <= 0) + if (VIR_STRDUP(newSnapshotPtr->description, def->parent.description) <= 0) goto cleanup; if (VIR_STRDUP(newSnapshotPtr->hardware, snapshotMachineDesc->hardware= ) < 0) @@ -5028,12 +5028,12 @@ vboxSnapshotRedefine(virDomainPtr dom, goto cleanup; /*We get the parent disk uuid from the parent disk location to correct= ly fill the storage controller.*/ - for (it =3D 0; it < def->common.dom->ndisks; it++) { + for (it =3D 0; it < def->parent.dom->ndisks; it++) { char *location =3D NULL; const char *uuidReplacing =3D NULL; char *tmp =3D NULL; - location =3D def->common.dom->disks[it]->src->path; + location =3D def->parent.dom->disks[it]->src->path; if (!location) goto cleanup; /*Replacing the uuid*/ @@ -5061,7 +5061,7 @@ vboxSnapshotRedefine(virDomainPtr dom, VIR_FREE(tmp); } - if (virVBoxSnapshotConfAddSnapshotToXmlMachine(newSnapshotPtr, snapsho= tMachineDesc, def->common.parent_name) < 0) { + if (virVBoxSnapshotConfAddSnapshotToXmlMachine(newSnapshotPtr, snapsho= tMachineDesc, def->parent.parent_name) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to add the snapshot to the machine descri= ption")); goto cleanup; @@ -5081,10 +5081,10 @@ vboxSnapshotRedefine(virDomainPtr dom, * Open the snapshot's read-write disk's full ancestry to allow openin= g the * read-write disk itself. */ - for (it =3D 0; it < def->common.dom->ndisks; it++) { + for (it =3D 0; it < def->parent.dom->ndisks; it++) { char *location =3D NULL; - location =3D def->common.dom->disks[it]->src->path; + location =3D def->parent.dom->disks[it]->src->path; if (!location) goto cleanup; @@ -5228,7 +5228,7 @@ vboxSnapshotRedefine(virDomainPtr dom, } } else { /*Create a "fake" disk to avoid corrupting children snapshot disks= .*/ - for (it =3D 0; it < def->common.dom->ndisks; it++) { + for (it =3D 0; it < def->parent.dom->ndisks; it++) { IMedium *medium =3D NULL; PRUnichar *locationUtf16 =3D NULL; char *parentUuid =3D NULL; @@ -5244,7 +5244,7 @@ vboxSnapshotRedefine(virDomainPtr dom, VBOX_IID_INITIALIZE(&iid); VBOX_IID_INITIALIZE(&parentiid); - VBOX_UTF8_TO_UTF16(def->common.dom->disks[it]->src->path, &loc= ationUtf16); + VBOX_UTF8_TO_UTF16(def->parent.dom->disks[it]->src->path, &loc= ationUtf16); rc =3D gVBoxAPI.UIVirtualBox.OpenMedium(data->vboxObj, locationUtf16, DeviceType_HardDisk, @@ -5393,8 +5393,8 @@ vboxSnapshotRedefine(virDomainPtr dom, * All the snapshot structure manipulation is done, we close the disks= we have * previously opened. */ - for (it =3D 0; it < def->common.dom->ndisks; it++) { - char *location =3D def->common.dom->disks[it]->src->path; + for (it =3D 0; it < def->parent.dom->ndisks; it++) { + char *location =3D def->parent.dom->disks[it]->src->path; if (!location) goto cleanup; @@ -5513,7 +5513,7 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, if (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REDEFINE) { if (vboxSnapshotRedefine(dom, def, isCurrent) < 0) goto cleanup; - ret =3D virGetDomainSnapshot(dom, def->common.name); + ret =3D virGetDomainSnapshot(dom, def->parent.name); goto cleanup; } } @@ -5540,14 +5540,14 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, goto cleanup; } - VBOX_UTF8_TO_UTF16(def->common.name, &name); + VBOX_UTF8_TO_UTF16(def->parent.name, &name); if (!name) { virReportOOMError(); goto cleanup; } - if (def->common.description) { - VBOX_UTF8_TO_UTF16(def->common.description, &description); + if (def->parent.description) { + VBOX_UTF8_TO_UTF16(def->parent.description, &description); if (!description) { virReportOOMError(); goto cleanup; @@ -5577,7 +5577,7 @@ vboxDomainSnapshotCreateXML(virDomainPtr dom, goto cleanup; } - ret =3D virGetDomainSnapshot(dom, def->common.name); + ret =3D virGetDomainSnapshot(dom, def->parent.name); cleanup: VBOX_RELEASE(progress); @@ -5981,7 +5981,7 @@ vboxSnapshotGetReadOnlyDisks(virDomainSnapshotDefPtr = def, vboxArray mediumAttachments =3D VBOX_ARRAY_INITIALIZER; size_t i =3D 0, diskCount =3D 0, sdCount =3D 0; int ret =3D -1; - virDomainDefPtr defdom =3D def->common.dom; + virDomainDefPtr defdom =3D def->parent.dom; if (!data->vboxObj) return ret; @@ -6220,10 +6220,10 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomain= SnapshotPtr snapshot, if (!(snap =3D vboxDomainSnapshotGet(data, dom, machine, snapshot->nam= e))) goto cleanup; - if (VIR_ALLOC(def) < 0 || !(def->common.dom =3D virDomainDefNew())) + if (VIR_ALLOC(def) < 0 || !(def->parent.dom =3D virDomainDefNew())) goto cleanup; - defdom =3D def->common.dom; - if (VIR_STRDUP(def->common.name, snapshot->name) < 0) + defdom =3D def->parent.dom; + if (VIR_STRDUP(def->parent.name, snapshot->name) < 0) goto cleanup; if (gVBoxAPI.vboxSnapshotRedefine) { @@ -6271,7 +6271,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSn= apshotPtr snapshot, if (str16) { VBOX_UTF16_TO_UTF8(str16, &str8); VBOX_UTF16_FREE(str16); - if (VIR_STRDUP(def->common.description, str8) < 0) { + if (VIR_STRDUP(def->parent.description, str8) < 0) { VBOX_UTF8_FREE(str8); goto cleanup; } @@ -6286,7 +6286,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSn= apshotPtr snapshot, goto cleanup; } /* timestamp is in milliseconds while creationTime in seconds */ - def->common.creationTime =3D timestamp / 1000; + def->parent.creationTime =3D timestamp / 1000; rc =3D gVBoxAPI.UISnapshot.GetParent(snap, &parent); if (NS_FAILED(rc)) { @@ -6305,7 +6305,7 @@ static char *vboxDomainSnapshotGetXMLDesc(virDomainSn= apshotPtr snapshot, } VBOX_UTF16_TO_UTF8(str16, &str8); VBOX_UTF16_FREE(str16); - if (VIR_STRDUP(def->common.parent_name, str8) < 0) { + if (VIR_STRDUP(def->parent.parent_name, str8) < 0) { VBOX_UTF8_FREE(str8); goto cleanup; } @@ -6987,7 +6987,7 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) goto cleanup; } - isCurrent =3D virVBoxSnapshotConfIsCurrentSnapshot(snapshotMachineDesc= , def->common.name); + isCurrent =3D virVBoxSnapshotConfIsCurrentSnapshot(snapshotMachineDesc= , def->parent.name); if (isCurrent < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to know if the snapshot is the current sn= apshot")); @@ -6999,8 +6999,8 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) * disks. The first thing to do is to manipulate VirtualBox API to= create * differential read-write disks if the parent snapshot is not nul= l. */ - if (def->common.parent_name !=3D NULL) { - for (it =3D 0; it < def->common.dom->ndisks; it++) { + if (def->parent.parent_name !=3D NULL) { + for (it =3D 0; it < def->parent.dom->ndisks; it++) { virVBoxSnapshotConfHardDiskPtr readOnly =3D NULL; IMedium *medium =3D NULL; PRUnichar *locationUtf16 =3D NULL; @@ -7020,7 +7020,7 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) VBOX_IID_INITIALIZE(&iid); VBOX_IID_INITIALIZE(&parentiid); readOnly =3D virVBoxSnapshotConfHardDiskPtrByLocation(snap= shotMachineDesc, - def->common.dom->disks[it= ]->src->path); + def->parent.dom->disks[it= ]->src->path); if (!readOnly) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Cannot get hard disk by location")); @@ -7058,7 +7058,7 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapsho= tPtr snapshot) VBOX_UTF8_TO_UTF16("VDI", &formatUtf16); if (virAsprintf(&newLocationUtf8, "%sfakedisk-%s-%d.vdi", - machineLocationPath, def->common.parent_na= me, it) < 0) + machineLocationPath, def->parent.parent_na= me, it) < 0) goto cleanup; VBOX_UTF8_TO_UTF16(newLocationUtf8, &newLocation); rc =3D gVBoxAPI.UIVirtualBox.CreateHardDisk(data->vboxObj, @@ -7156,15 +7156,15 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) } } } else { - for (it =3D 0; it < def->common.dom->ndisks; it++) { + for (it =3D 0; it < def->parent.dom->ndisks; it++) { const char *uuidRO =3D NULL; char *tmp =3D NULL; uuidRO =3D virVBoxSnapshotConfHardDiskUuidByLocation(snaps= hotMachineDesc, - def->common.dom->dis= ks[it]->src->path); + def->parent.dom->dis= ks[it]->src->path); if (!uuidRO) { virReportError(VIR_ERR_INTERNAL_ERROR, _("No such disk in media registry %s"), - def->common.dom->disks[it]->src->path); + def->parent.dom->disks[it]->src->path); goto cleanup; } @@ -7209,14 +7209,14 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) } } /*If the parent snapshot is not NULL, we remove the-read only disks fr= om the media registry*/ - if (def->common.parent_name !=3D NULL) { - for (it =3D 0; it < def->common.dom->ndisks; it++) { + if (def->parent.parent_name !=3D NULL) { + for (it =3D 0; it < def->parent.dom->ndisks; it++) { const char *uuidRO =3D virVBoxSnapshotConfHardDiskUuidByLocation(snapshotMachineD= esc, - def->common.dom-= >disks[it]->src->path); + def->parent.dom-= >disks[it]->src->path); if (!uuidRO) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to find UUID for location %s"), d= ef->common.dom->disks[it]->src->path); + _("Unable to find UUID for location %s"), d= ef->parent.dom->disks[it]->src->path); goto cleanup; } if (virVBoxSnapshotConfRemoveHardDisk(snapshotMachineDesc->med= iaRegistry, uuidRO) < 0) { @@ -7281,16 +7281,16 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnaps= hotPtr snapshot) } /*removing the snapshot*/ - if (virVBoxSnapshotConfRemoveSnapshot(snapshotMachineDesc, def->common= .name) < 0) { + if (virVBoxSnapshotConfRemoveSnapshot(snapshotMachineDesc, def->parent= .name) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to remove snapshot %s"), def->common.name= ); + _("Unable to remove snapshot %s"), def->parent.name= ); goto cleanup; } if (isCurrent) { VIR_FREE(snapshotMachineDesc->currentSnapshot); - if (def->common.parent_name !=3D NULL) { - virVBoxSnapshotConfSnapshotPtr snap =3D virVBoxSnapshotConfSna= pshotByName(snapshotMachineDesc->snapshot, def->common.parent_name); + if (def->parent.parent_name !=3D NULL) { + virVBoxSnapshotConfSnapshotPtr snap =3D virVBoxSnapshotConfSna= pshotByName(snapshotMachineDesc->snapshot, def->parent.parent_name); if (!snap) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Unable to get the snapshot to remove")); diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 83bffd95b2..419e9d215f 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -2619,7 +2619,7 @@ vzDomainSnapshotCreateXML(virDomainPtr domain, goto cleanup; /* snaphot name is ignored, it will be set to auto generated by sdk uu= id */ - if (prlsdkCreateSnapshot(dom, def->common.description) < 0) + if (prlsdkCreateSnapshot(dom, def->parent.description) < 0) goto cleanup; if (!(snapshots =3D prlsdkLoadSnapshots(dom))) diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c index 500de5f8ba..478443298f 100644 --- a/src/vz/vz_sdk.c +++ b/src/vz/vz_sdk.c @@ -4696,14 +4696,14 @@ prlsdkParseSnapshotTree(const char *treexml) ctxt->node =3D nodes[i]; - def->common.name =3D virXPathString("string(./@guid)", ctxt); - if (!def->common.name) { + def->parent.name =3D virXPathString("string(./@guid)", ctxt); + if (!def->parent.name) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("missing 'guid' attribute")); goto cleanup; } - def->common.parent_name =3D virXPathString("string(../@guid)", ctx= t); + def->parent.parent_name =3D virXPathString("string(../@guid)", ctx= t); xmlstr =3D virXPathString("string(./DateTime)", ctxt); if (!xmlstr) { @@ -4711,11 +4711,11 @@ prlsdkParseSnapshotTree(const char *treexml) _("missing 'DateTime' element")); goto cleanup; } - if ((def->common.creationTime =3D prlsdkParseDateTime(xmlstr)) < 0) + if ((def->parent.creationTime =3D prlsdkParseDateTime(xmlstr)) < 0) goto cleanup; VIR_FREE(xmlstr); - def->common.description =3D virXPathString("string(./Description)"= , ctxt); + def->parent.description =3D virXPathString("string(./Description)"= , ctxt); def->memory =3D VIR_DOMAIN_SNAPSHOT_LOCATION_NONE; xmlstr =3D virXPathString("string(./@state)", ctxt); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list