From nobody Tue Feb 10 12:57:44 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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.133.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=1673513106; cv=none; d=zohomail.com; s=zohoarc; b=G6hLHIM64T5JqWxM66raoFL9yyfYnJLP8iJi7jt37+w/csSVZWsC2v94lXQ4V0MMKOoeq6XJTr7/gzaeZH4pzgi2IqG9fAnfduNOy1ntb+z9oN7ace1tgqQyQ7RmlT42lFi0JadBRkZ5qbOihhxUpHrp2MNtOmhsgKUb31Tw3zU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673513106; 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=uwCHd8nuJWSUf2L0QEA9lX3pikgaHVWnrK4D3yuYFjY=; b=CqjozPmT3bS+HAuuhiwAl2jHly1EE7qwIG5Wi+pqnU6le/ISIOPc1mX6D6EIXhUQfQOigWP/3CmlM8EXHZ5YQ1f5oYAQ8c5OerzkXVQEMpN08AHw2gqjzK55ZUB7oRHmp3nxGnwFe0uaZfHPG7JKauXR3cOHxRKLdkV3Rspemks= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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.133.124]) by mx.zohomail.com with SMTPS id 1673513106454717.3025166121713; Thu, 12 Jan 2023 00:45:06 -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-20-UMhQUK1rO9CZ1xS-4c7Kvg-1; Thu, 12 Jan 2023 03:45:04 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9D60B80349B; Thu, 12 Jan 2023 08:45:01 +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 29C8240C2005; Thu, 12 Jan 2023 08:45:01 +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 681E91946A7D; Thu, 12 Jan 2023 08:45:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 1E0851947040 for ; Thu, 12 Jan 2023 08:44:55 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 786BB40C2005; Thu, 12 Jan 2023 08:44:55 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6FF1040C2064 for ; Thu, 12 Jan 2023 08:44:55 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (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 51F4A3C22744 for ; Thu, 12 Jan 2023 08:44:55 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-510-vTY7KEi7NTuDry45K0am3A-1; Thu, 12 Jan 2023 03:44:53 -0500 Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30C6rkQA006753 for ; Thu, 12 Jan 2023 08:44:52 GMT Received: from ppma04dal.us.ibm.com (7a.29.35a9.ip4.static.sl-reverse.com [169.53.41.122]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n2dbdtdx2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Jan 2023 08:44:52 +0000 Received: from pps.filterd (ppma04dal.us.ibm.com [127.0.0.1]) by ppma04dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30C7WgTd029594 for ; Thu, 12 Jan 2023 08:44:51 GMT Received: from smtprelay02.dal12v.mail.ibm.com ([9.208.130.97]) by ppma04dal.us.ibm.com (PPS) with ESMTPS id 3n1m039yqm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Jan 2023 08:44:51 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay02.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30C8imeZ29819198 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jan 2023 08:44:48 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4D00458053; Thu, 12 Jan 2023 08:44:48 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C1CA858043; Thu, 12 Jan 2023 08:44:47 +0000 (GMT) Received: from oro.sl.cloud9.ibm.com (unknown [9.59.192.176]) by smtpav05.wdc07v.mail.ibm.com (Postfix) with ESMTP; Thu, 12 Jan 2023 08:44:47 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673513105; 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=uwCHd8nuJWSUf2L0QEA9lX3pikgaHVWnrK4D3yuYFjY=; b=HXXHgYUGvGPIx/mzpN1gy/SVia+M48RgZlELAQ38GLbn5YHJX2+KsVayMwlqcyNyOMBZt0 dMGD27nEmhyYm7Wrv5X3yyg60jeP7aw5HAqtPS2oPIBBSmEj/66PzbE1Si39EijM+YqMor bxwj6E1nDEs8JddVA/FeyGna/PeM0Hg= X-MC-Unique: UMhQUK1rO9CZ1xS-4c7Kvg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: vTY7KEi7NTuDry45K0am3A-1 From: Or Ozeri To: libvir-list@redhat.com Subject: [PATCH v1 1/4] conf: add snapshotName attribute for internal disk snapshot Date: Thu, 12 Jan 2023 02:44:36 -0600 Message-Id: <20230112084439.2363101-2-oro@il.ibm.com> In-Reply-To: <20230112084439.2363101-1-oro@il.ibm.com> References: <20230112084439.2363101-1-oro@il.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: V6VQKGcW1MsadKy9oylEywUD66RAVag3 X-Proofpoint-GUID: V6VQKGcW1MsadKy9oylEywUD66RAVag3 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-12_04,2023-01-11_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxlogscore=678 malwarescore=0 bulkscore=0 phishscore=0 clxscore=1011 impostorscore=0 lowpriorityscore=0 priorityscore=1501 spamscore=0 adultscore=0 mlxscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301120059 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.1 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: Or Ozeri Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 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: 1673513108874100001 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. 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 ++ 4 files changed, 38 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 --=20 2.25.1