From nobody Mon Feb 9 00:53:42 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=reject dis=none) header.from=il.ibm.com ARC-Seal: i=1; a=rsa-sha256; t=1676460609; cv=none; d=zohomail.com; s=zohoarc; b=C3TnpG9dko6AWM0CIt+Oq+Mbf0oHyjvWL/+zwzMcgc8ObNnUCb1eNbnlNScUKXNCCOhgtkENg8drSs4L/w1Ye9YQcKe+gOyQLP6vFVJzxLo06CkhE/AV7Q18/1L68nqKjlAM2Exx0CwirEBVyUjlcHG2fRXPzrkuzco78NhHCHg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1676460609; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Sjvby4Hm9eJGc79R2LQ3e5meCLl4+TfoChMD04MONaQ=; b=VEcusojrTeFDpanN7jt/HVN0mOC+TnRAsKNtd/BZSR2ZsoByyJ+1ngMArEoVNH6WG83K9u93O/8yA2PDxwSwRRx6whoCA6XMjif6bljCgwVW1qgrRAjd9vxE/XP0vBSfhZRuQjgMVHwV1KhRpFH1ISuvwI8ftda5SmgHONTDZCQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=reject dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1676460609764550.8452668758546; Wed, 15 Feb 2023 03:30:09 -0800 (PST) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-65-NGPh9Ay_Nwu_XF5cMaB4aQ-1; Wed, 15 Feb 2023 06:30:07 -0500 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 694F1857A89; Wed, 15 Feb 2023 11:30:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 52FE4492B0E; Wed, 15 Feb 2023 11:30:03 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 043F319465A8; Wed, 15 Feb 2023 11:30:03 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 32D001946586 for ; Wed, 15 Feb 2023 11:29:14 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 127DD18EC2; Wed, 15 Feb 2023 11:29:14 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast09.extmail.prod.ext.rdu2.redhat.com [10.11.55.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 09BC618EC1 for ; Wed, 15 Feb 2023 11:29:13 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CF4CC28004E1 for ; Wed, 15 Feb 2023 11:29:13 +0000 (UTC) Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-45-w6XP0mYTNNugJkXdKp7MJQ-1; Wed, 15 Feb 2023 06:29:10 -0500 Received: from pps.filterd (m0127361.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31FBNDWk040722 for ; Wed, 15 Feb 2023 11:29:09 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nrxfq02ts-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 Feb 2023 11:29:09 +0000 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 31FAt9DG007439 for ; Wed, 15 Feb 2023 11:29:09 GMT Received: from smtprelay06.dal12v.mail.ibm.com ([9.208.130.100]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3np2n79nc0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 15 Feb 2023 11:29:09 +0000 Received: from smtpav02.wdc07v.mail.ibm.com (smtpav02.wdc07v.mail.ibm.com [10.39.53.229]) by smtprelay06.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 31FBT64c10224232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 15 Feb 2023 11:29:06 GMT Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 02528583D0; Wed, 15 Feb 2023 11:29:06 +0000 (GMT) Received: from smtpav02.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56195583CE; Wed, 15 Feb 2023 11:29:05 +0000 (GMT) Received: from oro.sl.cloud9.ibm.com (unknown [9.59.192.176]) by smtpav02.wdc07v.mail.ibm.com (Postfix) with ESMTP; Wed, 15 Feb 2023 11:29:05 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676460608; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=Sjvby4Hm9eJGc79R2LQ3e5meCLl4+TfoChMD04MONaQ=; b=FlTHiEMGZod+1fF2J4KT+1AT07tW9pBzpgGY/4hFwqupJS1qAZ33rErwY3D9Pz+nnIVmvz Rnoy5TOd2gl69YejLZagJNmllA+6q0wOJ2Qa0AknOjZReHhwDQ6SEj6LySr1lBjh0WHTg8 3QJCif37djXLiuboN9BJjDpIFg1g4ng= X-MC-Unique: NGPh9Ay_Nwu_XF5cMaB4aQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: w6XP0mYTNNugJkXdKp7MJQ-1 From: Or Ozeri To: libvir-list@redhat.com Subject: [PATCH v2 1/6] conf: Add snapshotName attribute for internal disk snapshot Date: Wed, 15 Feb 2023 05:28:17 -0600 Message-Id: <20230215112822.1887694-2-oro@il.ibm.com> In-Reply-To: <20230215112822.1887694-1-oro@il.ibm.com> References: <20230215112822.1887694-1-oro@il.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: YtZa7H_FAvyIeDXoPoeslu35cpDK2NAa X-Proofpoint-ORIG-GUID: YtZa7H_FAvyIeDXoPoeslu35cpDK2NAa X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-15_06,2023-02-15_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 spamscore=0 priorityscore=1501 mlxscore=0 bulkscore=0 mlxlogscore=805 lowpriorityscore=0 adultscore=0 impostorscore=0 suspectscore=0 phishscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302150100 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: oro@il.ibm.com, dannyh@il.ibm.com Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1676460610850100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Add a new attribute to snapshot disks XML element, which allows specifying the name that will be used to refer to internal snapshots. If unspecified, the parent snapshot name will be used. For now, make this attribute unsupported for qemu domains. Signed-off-by: Or Ozeri --- docs/formatsnapshot.rst | 5 +++++ src/conf/schemas/domainsnapshot.rng | 4 ++++ src/conf/snapshot_conf.c | 27 +++++++++++++++++++++++++++ src/conf/snapshot_conf.h | 2 ++ src/qemu/qemu_snapshot.c | 9 +++++++++ 5 files changed, 47 insertions(+) diff --git a/docs/formatsnapshot.rst b/docs/formatsnapshot.rst index 085c712053..d98066dd8c 100644 --- a/docs/formatsnapshot.rst +++ b/docs/formatsnapshot.rst @@ -145,6 +145,11 @@ The top-level ``domainsnapshot`` element may contain t= he following elements: driver and supported values are ``file``, ``block`` and ``network`` :since:`(since 1.2.2)`. =20 + :since:`Since 9.1.0` the ``disk`` element supports an optional attri= bute + ``snapshotName`` if the ``snapshot`` attribute is set to ``int= ernal``. This + attribute specifies the name that will be used to refer to the + internal disk snapshot. + ``source`` =20 If the snapshot mode is external (whether specified or inherited), diff --git a/src/conf/schemas/domainsnapshot.rng b/src/conf/schemas/domains= napshot.rng index 4048266f1d..19f097d2b3 100644 --- a/src/conf/schemas/domainsnapshot.rng +++ b/src/conf/schemas/domainsnapshot.rng @@ -209,6 +209,10 @@ manual + + + + =20 diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 9bf3c78353..58a6afa26d 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -150,6 +150,8 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, VIR_STORAGE_TYPE_FILE) < 0) return -1; =20 + def->snapshot_name =3D virXMLPropString(node, "snapshotName"); + if (src->type =3D=3D VIR_STORAGE_TYPE_VOLUME || src->type =3D=3D VIR_STORAGE_TYPE_DIR) { virReportError(VIR_ERR_XML_ERROR, @@ -192,6 +194,10 @@ virDomainSnapshotDiskDefParseXML(xmlNodePtr node, (src->path || src->format)) def->snapshot =3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL; =20 + if (def->snapshot =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT && + def->snapshot_name) + def->snapshot =3D VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL; + def->name =3D g_steal_pointer(&name); def->src =3D g_steal_pointer(&src); =20 @@ -670,6 +676,15 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDef *snap= def, return -1; } =20 + if (snapdisk->snapshot_name && + snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL)= { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("snapshotName for disk '%s' requires " + "use of internal snapshot mode"), + snapdisk->name); + return -1; + } + if (snapdisk->src->path && snapdisk->snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL)= { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, @@ -714,6 +729,16 @@ virDomainSnapshotAlignDisks(virDomainSnapshotDef *snap= def, if (virDomainSnapshotDefAssignExternalNames(snapdef) < 0) return -1; =20 + /* set default snapshot name for internal snapshots */ + for (i =3D 0; i < snapdef->ndisks; i++) { + virDomainSnapshotDiskDef * disk =3D &snapdef->disks[i]; + + if (disk->snapshot =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL && + !disk->snapshot_name) { + disk->snapshot_name =3D g_strdup(snapdef->parent.name); + } + } + return 0; } =20 @@ -748,6 +773,8 @@ virDomainSnapshotDiskDefFormat(virBuffer *buf, if (disk->snapshot > 0) virBufferAsprintf(&attrBuf, " snapshot=3D'%s'", virDomainSnapshotLocationTypeToString(disk->snap= shot)); + if (disk->snapshot_name) + virBufferAsprintf(&attrBuf, " snapshotName=3D'%s'", disk->snapshot= _name); =20 if (disk->snapshotDeleteInProgress) virBufferAddLit(&childBuf, "\n"); diff --git a/src/conf/snapshot_conf.h b/src/conf/snapshot_conf.h index 96c77ef42b..c133c105c7 100644 --- a/src/conf/snapshot_conf.h +++ b/src/conf/snapshot_conf.h @@ -57,6 +57,8 @@ struct _virDomainSnapshotDiskDef { /* details of wrapper external file. src is always non-NULL. * XXX optimize this to allow NULL for internal snapshots? */ virStorageSource *src; + + char *snapshot_name; /* snapshot name for internal snapshots */ }; =20 void diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index b8416808b3..1aa2f05300 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -660,6 +660,15 @@ qemuSnapshotPrepare(virDomainObj *vm, virStorageFileFormatTypeToString(dom_disk->= src->format)); return -1; } + + if (disk->snapshot_name) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("snapshot name setting for disk %s unsupp= orted " + "for storage type %s"), + disk->name, + virStorageFileFormatTypeToString(dom_disk->= src->format)); + return -1; + } break; =20 case VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL: --=20 2.25.1