From nobody Sat May 18 08:14:14 2024 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 From nobody Sat May 18 08:14:14 2024 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=1673513111; cv=none; d=zohomail.com; s=zohoarc; b=mQjxOXYM2DDql12ND5CmLX0064LFa6DW1wWDhtYi2SrOe3bo4pXC/zAu2xZQRsHhlu6CvBZdhtOBo9P6qtL694hkH6HFkcPYGjxRPoWTUSc8A99PZbAes0fV0zZ4pI2o+fvkEy4pecxwhA+fUM/KZE4vsu52NKcWg7EJw6CaCUQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673513111; 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=U6Oium3GPKla4aH2JLeJ72T+Go8uZQXt7QBUcsSx2F4=; b=DuLnj2Aj334JaoqxkZsSywKYZc1zOnkU1mmxGe+Ngf8UM0dqa+J4KbweLWRT3Zj2npMUGMo+2wMjmwLf+W1BnjKg62c1JH2od6+bci/ASTWuuviM9Vi8hlUXrqdc68VZ//isv4MbgRxPkasO9VC+u1NioBfrzFVudjcULbKGt7c= 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 1673513111660665.9203130702232; Thu, 12 Jan 2023 00:45:11 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-138-3ElCozbmOfCIRB7xU18V7g-1; Thu, 12 Jan 2023 03:45:07 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F1BCC281DE78; Thu, 12 Jan 2023 08:45:04 +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 DB2D2C15BAD; Thu, 12 Jan 2023 08:45:04 +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 C98281946A7F; Thu, 12 Jan 2023 08:45:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 138461946A78 for ; Thu, 12 Jan 2023 08:45:04 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id DCDD2140EBF6; Thu, 12 Jan 2023 08:45:03 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D34C7140EBF5 for ; Thu, 12 Jan 2023 08:45:03 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 A96EA1C008CB for ; Thu, 12 Jan 2023 08:45:03 +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-68-SlnSwO1gNxGsmS7ipgp0zQ-1; Thu, 12 Jan 2023 03:44:54 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30C7rIkS009829 for ; Thu, 12 Jan 2023 08:44:53 GMT Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n2e7ah689-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Jan 2023 08:44:53 +0000 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30C88e6t018903 for ; Thu, 12 Jan 2023 08:44:51 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([9.208.130.98]) by ppma02wdc.us.ibm.com (PPS) with ESMTPS id 3n1knv04bh-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 smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30C8inYw43843990 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jan 2023 08:44:49 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 137DD5805F; Thu, 12 Jan 2023 08:44:49 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 88B415805D; Thu, 12 Jan 2023 08:44:48 +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:48 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673513110; 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=U6Oium3GPKla4aH2JLeJ72T+Go8uZQXt7QBUcsSx2F4=; b=AgcRuE8lSE+hE6keSzeYJCuW0Fp0Cq4Fzx7ulRjIMxDAr/UJgLADRt0PjP+4BMo9W/Kpr4 3DPlNfTWY8ibB9S7yjDHXlkQYyHGhDKSQ8iUpFW40pX7c6oaikM3WLpMNZVXxTPzKP6s66 FOlcJSl7JMB2IFldelpHPGhZIY4WHUc= X-MC-Unique: 3ElCozbmOfCIRB7xU18V7g-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: SlnSwO1gNxGsmS7ipgp0zQ-1 From: Or Ozeri To: libvir-list@redhat.com Subject: [PATCH v1 2/4] qemu: Support active disk internal snapshots Date: Thu, 12 Jan 2023 02:44:37 -0600 Message-Id: <20230112084439.2363101-3-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: YhomzC5MKGwhQj2b07X6CI19b9cGsXDb X-Proofpoint-GUID: YhomzC5MKGwhQj2b07X6CI19b9cGsXDb 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 suspectscore=0 bulkscore=0 phishscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 adultscore=0 clxscore=1015 mlxscore=0 lowpriorityscore=0 impostorscore=0 priorityscore=1501 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.7 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.8 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: 1673513112684100001 Content-Type: text/plain; charset="utf-8"; x-default="true" libvirt supports taking external disk snapshots on a running VM, using qemu's "blockdev-snapshot" command. qemu also supports "blockdev-snapshot-internal-sync" to do the same for internal snapshots. This commit wraps this (old) qemu capability to allow libvirt users to take internal disk snapshots on a running VM. This will only work for disk types which support internal snapshots, and thus we require the disk type to be part of a white list of known types (only RBD disks for start). Signed-off-by: Or Ozeri --- src/qemu/qemu_monitor.c | 9 ++ src/qemu/qemu_monitor.h | 5 ++ src/qemu/qemu_monitor_json.c | 14 ++++ src/qemu/qemu_monitor_json.h | 5 ++ src/qemu/qemu_snapshot.c | 83 +++++++++++-------- .../disk_snapshot.xml | 2 +- .../disk_snapshot.xml | 2 +- .../disk_snapshot_redefine.xml | 2 +- tests/qemumonitorjsontest.c | 1 + 9 files changed, 84 insertions(+), 39 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 38f89167e0..f6dab34243 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -4225,6 +4225,15 @@ qemuMonitorTransactionSnapshotBlockdev(virJSONValue = *actions, } =20 =20 +int +qemuMonitorTransactionInternalSnapshotBlockdev(virJSONValue *actions, + const char *device, + const char *name) +{ + return qemuMonitorJSONTransactionInternalSnapshotBlockdev(actions, dev= ice, name); +} + + int qemuMonitorTransactionBackup(virJSONValue *actions, const char *device, diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index 2d16214ba2..1bfd1ccbc2 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1411,6 +1411,11 @@ qemuMonitorTransactionSnapshotBlockdev(virJSONValue = *actions, const char *node, const char *overlay); =20 +int +qemuMonitorTransactionInternalSnapshotBlockdev(virJSONValue *actions, + const char *device, + const char *name); + typedef enum { QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_NONE =3D 0, QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_INCREMENTAL, diff --git a/src/qemu/qemu_monitor_json.c b/src/qemu/qemu_monitor_json.c index db99017555..002a6caa52 100644 --- a/src/qemu/qemu_monitor_json.c +++ b/src/qemu/qemu_monitor_json.c @@ -8307,6 +8307,20 @@ qemuMonitorJSONTransactionSnapshotBlockdev(virJSONVa= lue *actions, NULL); } =20 + +int +qemuMonitorJSONTransactionInternalSnapshotBlockdev(virJSONValue *actions, + const char *device, + const char *name) +{ + return qemuMonitorJSONTransactionAdd(actions, + "blockdev-snapshot-internal-sync", + "s:device", device, + "s:name", name, + NULL); +} + + VIR_ENUM_DECL(qemuMonitorTransactionBackupSyncMode); VIR_ENUM_IMPL(qemuMonitorTransactionBackupSyncMode, QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_MODE_LAST, diff --git a/src/qemu/qemu_monitor_json.h b/src/qemu/qemu_monitor_json.h index 6f376cf9b7..313004f327 100644 --- a/src/qemu/qemu_monitor_json.h +++ b/src/qemu/qemu_monitor_json.h @@ -779,6 +779,11 @@ qemuMonitorJSONTransactionSnapshotBlockdev(virJSONValu= e *actions, const char *node, const char *overlay); =20 +int +qemuMonitorJSONTransactionInternalSnapshotBlockdev(virJSONValue *actions, + const char *device, + const char *name); + int qemuMonitorJSONTransactionBackup(virJSONValue *actions, const char *device, diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index b8416808b3..9146ecae2f 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -639,20 +639,13 @@ qemuSnapshotPrepare(virDomainObj *vm, case VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL: found_internal =3D true; =20 - if (def->state =3D=3D VIR_DOMAIN_SNAPSHOT_DISK_SNAPSHOT && act= ive) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("active qemu domains require external dis= k " - "snapshots; disk %s requested internal"), - disk->name); - return -1; - } - if (qemuSnapshotPrepareDiskInternal(dom_disk, active) < 0) return -1; =20 if (dom_disk->src->format > 0 && - dom_disk->src->format !=3D VIR_STORAGE_FILE_QCOW2) { + dom_disk->src->format !=3D VIR_STORAGE_FILE_QCOW2 && + dom_disk->src->protocol !=3D VIR_STORAGE_NET_PROTOCOL_RBD)= { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("internal snapshot for disk %s unsupporte= d " "for storage type %s"), @@ -727,7 +720,7 @@ qemuSnapshotPrepare(virDomainObj *vm, } =20 /* disk snapshot requires at least one disk */ - if (def->state =3D=3D VIR_DOMAIN_SNAPSHOT_DISK_SNAPSHOT && !external) { + if (def->state =3D=3D VIR_DOMAIN_SNAPSHOT_DISK_SNAPSHOT && !external &= & !found_internal) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("disk-only snapshots require at least " "one disk to be selected for snapshot")); @@ -843,6 +836,7 @@ qemuSnapshotDiskCleanup(qemuSnapshotDiskData *data, struct _qemuSnapshotDiskContext { qemuSnapshotDiskData *dd; size_t ndd; + bool has_internal; =20 virJSONValue *actions; =20 @@ -1061,17 +1055,17 @@ qemuSnapshotDiskPrepareOne(qemuSnapshotDiskContext = *snapctxt, =20 =20 /** - * qemuSnapshotDiskPrepareActiveExternal: + * qemuSnapshotDiskPrepareActive: * * Collects and prepares a list of structures that hold information about = disks * that are selected for the snapshot. */ static qemuSnapshotDiskContext * -qemuSnapshotDiskPrepareActiveExternal(virDomainObj *vm, - virDomainMomentObj *snap, - bool reuse, - GHashTable *blockNamedNodeData, - virDomainAsyncJob asyncJob) +qemuSnapshotDiskPrepareActive(virDomainObj *vm, + virDomainMomentObj *snap, + bool reuse, + GHashTable *blockNamedNodeData, + virDomainAsyncJob asyncJob) { g_autoptr(qemuSnapshotDiskContext) snapctxt =3D NULL; size_t i; @@ -1080,16 +1074,33 @@ qemuSnapshotDiskPrepareActiveExternal(virDomainObj = *vm, snapctxt =3D qemuSnapshotDiskContextNew(snapdef->ndisks, vm, asyncJob); =20 for (i =3D 0; i < snapdef->ndisks; i++) { - if (snapdef->disks[i].snapshot !=3D VIR_DOMAIN_SNAPSHOT_LOCATION_E= XTERNAL) - continue; + switch (snapdef->disks[i].snapshot) { + case VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL: { + if (qemuSnapshotDiskPrepareOne(snapctxt, + vm->def->disks[i], + snapdef->disks + i, + blockNamedNodeData, + reuse, + true) < 0) + return NULL; + break; + } =20 - if (qemuSnapshotDiskPrepareOne(snapctxt, - vm->def->disks[i], - snapdef->disks + i, - blockNamedNodeData, - reuse, - true) < 0) - return NULL; + case VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL: { + snapctxt->has_internal =3D true; + if (qemuMonitorTransactionInternalSnapshotBlockdev(snapctx= t->actions, + vm->def= ->disks[i]->src->nodeformat, + snapdef= ->disks[i].snapshot_name) < 0) + return NULL; + break; + } + + case VIR_DOMAIN_SNAPSHOT_LOCATION_DEFAULT: + case VIR_DOMAIN_SNAPSHOT_LOCATION_NO: + case VIR_DOMAIN_SNAPSHOT_LOCATION_MANUAL: + case VIR_DOMAIN_SNAPSHOT_LOCATION_LAST: + continue; + } } =20 return g_steal_pointer(&snapctxt); @@ -1173,7 +1184,7 @@ qemuSnapshotDiskCreate(qemuSnapshotDiskContext *snapc= txt) int rc; =20 /* check whether there's anything to do */ - if (snapctxt->ndd =3D=3D 0) + if (snapctxt->ndd =3D=3D 0 && !snapctxt->has_internal) return 0; =20 if (qemuDomainObjEnterMonitorAsync(snapctxt->vm, snapctxt->asyncJob) <= 0) @@ -1206,11 +1217,11 @@ qemuSnapshotDiskCreate(qemuSnapshotDiskContext *sna= pctxt) =20 /* The domain is expected to be locked and active. */ static int -qemuSnapshotCreateActiveExternalDisks(virDomainObj *vm, - virDomainMomentObj *snap, - GHashTable *blockNamedNodeData, - unsigned int flags, - virDomainAsyncJob asyncJob) +qemuSnapshotCreateActiveDisks(virDomainObj *vm, + virDomainMomentObj *snap, + GHashTable *blockNamedNodeData, + unsigned int flags, + virDomainAsyncJob asyncJob) { bool reuse =3D (flags & VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT) !=3D 0; g_autoptr(qemuSnapshotDiskContext) snapctxt =3D NULL; @@ -1220,8 +1231,8 @@ qemuSnapshotCreateActiveExternalDisks(virDomainObj *v= m, =20 /* prepare a list of objects to use in the vm definition so that we do= n't * have to roll back later */ - if (!(snapctxt =3D qemuSnapshotDiskPrepareActiveExternal(vm, snap, reu= se, - blockNamedNodeD= ata, asyncJob))) + if (!(snapctxt =3D qemuSnapshotDiskPrepareActive(vm, snap, reuse, + blockNamedNodeData, asy= ncJob))) return -1; =20 if (qemuSnapshotDiskCreate(snapctxt) < 0) @@ -1361,9 +1372,9 @@ qemuSnapshotCreateActiveExternal(virQEMUDriver *drive= r, =20 /* the domain is now paused if a memory snapshot was requested */ =20 - if ((ret =3D qemuSnapshotCreateActiveExternalDisks(vm, snap, - blockNamedNodeData, f= lags, - VIR_ASYNC_JOB_SNAPSHO= T)) < 0) + if ((ret =3D qemuSnapshotCreateActiveDisks(vm, snap, + blockNamedNodeData, flags, + VIR_ASYNC_JOB_SNAPSHOT)) < 0) goto cleanup; =20 /* the snapshot is complete now */ diff --git a/tests/qemudomainsnapshotxml2xmlin/disk_snapshot.xml b/tests/qe= mudomainsnapshotxml2xmlin/disk_snapshot.xml index cf5ea0814e..87b6251a7f 100644 --- a/tests/qemudomainsnapshotxml2xmlin/disk_snapshot.xml +++ b/tests/qemudomainsnapshotxml2xmlin/disk_snapshot.xml @@ -4,7 +4,7 @@ - + diff --git a/tests/qemudomainsnapshotxml2xmlout/disk_snapshot.xml b/tests/q= emudomainsnapshotxml2xmlout/disk_snapshot.xml index 76c543d25c..6cf93183d5 100644 --- a/tests/qemudomainsnapshotxml2xmlout/disk_snapshot.xml +++ b/tests/qemudomainsnapshotxml2xmlout/disk_snapshot.xml @@ -5,7 +5,7 @@ - + diff --git a/tests/qemudomainsnapshotxml2xmlout/disk_snapshot_redefine.xml = b/tests/qemudomainsnapshotxml2xmlout/disk_snapshot_redefine.xml index 24b41ba7c5..f574793edf 100644 --- a/tests/qemudomainsnapshotxml2xmlout/disk_snapshot_redefine.xml +++ b/tests/qemudomainsnapshotxml2xmlout/disk_snapshot_redefine.xml @@ -10,7 +10,7 @@ - + diff --git a/tests/qemumonitorjsontest.c b/tests/qemumonitorjsontest.c index 1db1f2b949..1269c74e43 100644 --- a/tests/qemumonitorjsontest.c +++ b/tests/qemumonitorjsontest.c @@ -2587,6 +2587,7 @@ testQemuMonitorJSONTransaction(const void *opaque) qemuMonitorTransactionBitmapDisable(actions, "node4", "bitmap4") <= 0 || qemuMonitorTransactionBitmapMerge(actions, "node5", "bitmap5", &me= rgebitmaps) < 0 || qemuMonitorTransactionSnapshotBlockdev(actions, "node7", "overlay7= ") < 0 || + qemuMonitorTransactionInternalSnapshotBlockdev(actions, "device1",= "snapshot1") < 0 || qemuMonitorTransactionBackup(actions, "dev8", "job8", "target8", "= bitmap8", QEMU_MONITOR_TRANSACTION_BACKUP_SYNC_= MODE_NONE) < 0 || qemuMonitorTransactionBackup(actions, "dev9", "job9", "target9", "= bitmap9", --=20 2.25.1 From nobody Sat May 18 08:14:14 2024 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=1673513109; cv=none; d=zohomail.com; s=zohoarc; b=HB6LAcH+cY43aNw4WTGx5pFC8uBKFHbu4jvsIewZi6i3/PIWXgFyS8qo/CZDPXr6eorBPPeC/xDK0La59gv1K6KY+cQPK8rwfgdrTjywQ1aMB6VpV5apnkbGMIRunyzGVU50glRAe5DhMYP/N1qhReEcCspNcVe40GbyU/YNMoo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673513109; 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=9i85UgT0zqTRb9NJHZbc9NkREw3pjKq86doP/fuQ2Tc=; b=DcK0HCSapJZsJLW/YXNwNJbCYaQaWDMY2t/Z82FIaidxsd9i922t+hYgOiTLRgOJIZHOhqj9pyR4VCkwTtxNA8PZt5hZU4LS1C4u6kTHHggjrvDLDNUsJBxc90jD8odFEWhOs+Mt046wVbcrkalnpL7OCHMxfCmbhRCxh/Hb4Do= 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 1673513109693516.4568305161143; Thu, 12 Jan 2023 00:45:09 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-169-YsrphaF4MjyvmCBxY_mRsg-1; Thu, 12 Jan 2023 03:45:04 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9B3AC38145A3; 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 803AC2166B26; Thu, 12 Jan 2023 08:45:00 +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 2C737194704E; Thu, 12 Jan 2023 08:44:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 2E2AF1947043 for ; Thu, 12 Jan 2023 08:44:58 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 0B12F492C18; Thu, 12 Jan 2023 08:44:58 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 03748492C14 for ; Thu, 12 Jan 2023 08:44:57 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (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 DA43D101A52E for ; Thu, 12 Jan 2023 08:44:57 +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-668-Kuw460w5OqOLzlqTH7fHmQ-1; Thu, 12 Jan 2023 03:44:55 -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 30C6rtdK006948 for ; Thu, 12 Jan 2023 08:44:54 GMT Received: from ppma01dal.us.ibm.com (83.d6.3fa9.ip4.static.sl-reverse.com [169.63.214.131]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3n2dbdtdxf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Jan 2023 08:44:53 +0000 Received: from pps.filterd (ppma01dal.us.ibm.com [127.0.0.1]) by ppma01dal.us.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 30C7gtot014451 for ; Thu, 12 Jan 2023 08:44:53 GMT Received: from smtprelay03.dal12v.mail.ibm.com ([9.208.130.98]) by ppma01dal.us.ibm.com (PPS) with ESMTPS id 3n1kv5a192-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 smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay03.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30C8iojO63177002 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jan 2023 08:44:50 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D9D3D5805D; Thu, 12 Jan 2023 08:44:49 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4E6AC58053; Thu, 12 Jan 2023 08:44:49 +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:49 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673513108; 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=9i85UgT0zqTRb9NJHZbc9NkREw3pjKq86doP/fuQ2Tc=; b=Pn2UNn6iK8QQjPU7i9BWXqOJdklgxPNB3kaGRW3eMx4pK/r4qHHajtbOa6xtHwZ6tQJkzn ea4QSPEze91L1tuxZJ2uJwmjq53NPuOJrGr6RwbOW4/5FRdFJAK/qchV5G5kvCxWHniFJK GRkDhxiGFiFox9+mkhZZSLk9UVtLXX4= X-MC-Unique: YsrphaF4MjyvmCBxY_mRsg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: Kuw460w5OqOLzlqTH7fHmQ-1 From: Or Ozeri To: libvir-list@redhat.com Subject: [PATCH v1 3/4] qemu: allow mixing active internal and external active disk snapshots Date: Thu, 12 Jan 2023 02:44:38 -0600 Message-Id: <20230112084439.2363101-4-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: 00xUaV4sdPUOKXrK5D6j53_ie7OiaJ0f X-Proofpoint-GUID: 00xUaV4sdPUOKXrK5D6j53_ie7OiaJ0f 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=785 malwarescore=0 bulkscore=0 phishscore=0 clxscore=1015 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.9 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.6 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: 1673513110637100003 Content-Type: text/plain; charset="utf-8"; x-default="true" Previous commit added support for active internal disk snapshots, using the same qmp_transaction used also for external snapshots. The same transaction can be used to mix internal and external snapshots. To allow this, this commit simply removes the check that disallows mixing for active snapshots. Offline snapshots still do not support mixing. Signed-off-by: Or Ozeri --- src/qemu/qemu_snapshot.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/qemu/qemu_snapshot.c b/src/qemu/qemu_snapshot.c index 9146ecae2f..da29fa2853 100644 --- a/src/qemu/qemu_snapshot.c +++ b/src/qemu/qemu_snapshot.c @@ -727,10 +727,9 @@ qemuSnapshotPrepare(virDomainObj *vm, return -1; } =20 - /* For now, we don't allow mixing internal and external disks. - * XXX technically, we could mix internal and external disks for + /* For now, we don't allow mixing internal and external disks for * offline snapshots */ - if ((found_internal && external) || + if ((found_internal && external && !active) || (def->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_INTERNAL && exte= rnal) || (def->memory =3D=3D VIR_DOMAIN_SNAPSHOT_LOCATION_EXTERNAL && foun= d_internal)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", --=20 2.25.1 From nobody Sat May 18 08:14:14 2024 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=1673513163; cv=none; d=zohomail.com; s=zohoarc; b=i6vZcGYpaDKxGM1V4xr8813EE8haZdGJ3XQ+TIUUWnX9+undnbSzjgQi11x2ZQGXBrlyIO6JzzeBeP5tIcV0/3lIdJ/UNP1StNyAnOyIM0MZSNplKFlxauMZHVL0TALIha9zUFMhd674JRmZ56190DY2pr0cj1yg2ESLeXlxKXc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1673513163; 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=zpAsunqoi2CSazvWbXr8WRi2wkAtwjawbIQtSrRh1JQ=; b=UEuxJqMQVGZxKSPh2apKmKy6+h0yaF+8rCJkvBZMNTsafk7ZgNYwOCTQu+hQH6LAWoKJqCEclNsikBphoqEflSYuOGCxEVP2EouKE/MT8uF8zB9YOjYZeA831/j4z6deltjO5DD4yhlxLGa7RflDJnAeJew+26xXHtG2/lvZJ9c= 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 167351316332111.985026903406947; Thu, 12 Jan 2023 00:46:03 -0800 (PST) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-404-GTtIEVjUNNCZnE1RguNRnQ-1; Thu, 12 Jan 2023 03:45:04 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 9C36D38145A4; 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 09F13140EBF5; Thu, 12 Jan 2023 08:44:59 +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 E6E081946A7B; Thu, 12 Jan 2023 08:44:58 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 232E81947042 for ; Thu, 12 Jan 2023 08:44:57 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id EBDDBC159BB; Thu, 12 Jan 2023 08:44:56 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E39E3C15BA0 for ; Thu, 12 Jan 2023 08:44:56 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (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 C93811C0879C for ; Thu, 12 Jan 2023 08:44:56 +0000 (UTC) Received: from mx0a-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-137-9dDGJyAZOwCwnDBRoDvAhw-1; Thu, 12 Jan 2023 03:44:55 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30C8WhiU024438 for ; Thu, 12 Jan 2023 08:44:54 GMT Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3n2estgae4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Jan 2023 08:44:54 +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 30C70OOd012982 for ; Thu, 12 Jan 2023 08:44:53 GMT Received: from smtprelay04.dal12v.mail.ibm.com ([9.208.130.102]) by ppma03dal.us.ibm.com (PPS) with ESMTPS id 3n1ka1290m-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 12 Jan 2023 08:44:53 +0000 Received: from smtpav05.wdc07v.mail.ibm.com (smtpav05.wdc07v.mail.ibm.com [10.39.53.232]) by smtprelay04.dal12v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 30C8ioMw4719222 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jan 2023 08:44:51 GMT Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A8EF15805F; Thu, 12 Jan 2023 08:44:50 +0000 (GMT) Received: from smtpav05.wdc07v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2032858059; Thu, 12 Jan 2023 08:44:50 +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:49 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673513162; 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=zpAsunqoi2CSazvWbXr8WRi2wkAtwjawbIQtSrRh1JQ=; b=RJQ5EeHyipZB6cvV7Z8YHs7I4CMl4juVFfUildd/mTfmXORlrHQ8eq3iXddssinrpJeYkv nfnVnw0NkOJKr/n+RGXc7GtD0xgUMSwQfoGU10wJolJ3MbgKzSmu85G9XLFiNK4Qzr82Wq sAlD+IASKE+ObQaWg//LoYl6+DKs+ew= X-MC-Unique: GTtIEVjUNNCZnE1RguNRnQ-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 9dDGJyAZOwCwnDBRoDvAhw-1 From: Or Ozeri To: libvir-list@redhat.com Subject: [PATCH v1 4/4] qemu: switch offline internal disk snapshots to use snapshotName Date: Thu, 12 Jan 2023 02:44:39 -0600 Message-Id: <20230112084439.2363101-5-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-GUID: lDzVYbky5-Iwq_zNK2FyVZez9NCaF0d1 X-Proofpoint-ORIG-GUID: lDzVYbky5-Iwq_zNK2FyVZez9NCaF0d1 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 mlxscore=0 impostorscore=0 lowpriorityscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxlogscore=614 malwarescore=0 priorityscore=1501 phishscore=0 bulkscore=0 clxscore=1011 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.8 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.7 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: 1673513164871100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Previous commit added snapshotName attribute to internal disk snapshots. This commit changes the qemu domain to use this new attribute for offline internal disk snapshots. Signed-off-by: Or Ozeri --- src/qemu/qemu_domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 2eb5653254..9ab1b5b9a3 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -7099,7 +7099,7 @@ qemuDomainSnapshotForEachQcow2Raw(virQEMUDriver *driv= er, =20 for (i =3D 0; i < ndisks; i++) { g_autoptr(virCommand) cmd =3D virCommandNewArgList(qemuimgbin, "sn= apshot", - op, snap->def->na= me, NULL); + op, snapdef->disk= s[i].snapshot_name, NULL); int format =3D virDomainDiskGetFormat(def->disks[i]); =20 /* FIXME: we also need to handle LVM here */ --=20 2.25.1