From nobody Mon Feb 9 17:44:16 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1509353559148479.9066014615307; Mon, 30 Oct 2017 01:52:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6A9C761D1A; Mon, 30 Oct 2017 08:52:37 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 451E798E42; Mon, 30 Oct 2017 08:52:37 +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 0E5B91805961; Mon, 30 Oct 2017 08:52:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9U8qH6J001029 for ; Mon, 30 Oct 2017 04:52:17 -0400 Received: by smtp.corp.redhat.com (Postfix) id 842157E38D; Mon, 30 Oct 2017 08:52:17 +0000 (UTC) Received: from mx1.redhat.com (ext-mx09.extmail.prod.ext.phx2.redhat.com [10.5.110.38]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7D76E8CBB0 for ; Mon, 30 Oct 2017 08:52:17 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AA6D049010 for ; Mon, 30 Oct 2017 08:52:16 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v9U8nSEN133343 for ; Mon, 30 Oct 2017 04:52:16 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2dwwk1s2w0-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 30 Oct 2017 04:52:16 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 30 Oct 2017 08:52:13 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 30 Oct 2017 08:52:10 -0000 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v9U8qAmj20512944; Mon, 30 Oct 2017 08:52:10 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E337D5204C; Mon, 30 Oct 2017 07:46:13 +0000 (GMT) Received: from powerkvmpok002.pok.stglabs.ibm.com (unknown [9.114.13.10]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6D06952043; Mon, 30 Oct 2017 07:46:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6A9C761D1A Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6A9C761D1A DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AA6D049010 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=kmp@linux.vnet.ibm.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AA6D049010 From: Kothapally Madhu Pavan To: libvir-list@redhat.com Date: Mon, 30 Oct 2017 14:21:52 +0530 In-Reply-To: <1509353516-52208-1-git-send-email-kmp@linux.vnet.ibm.com> References: <1509353516-52208-1-git-send-email-kmp@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17103008-0016-0000-0000-000004FB57D3 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17103008-0017-0000-0000-00002836DA33 Message-Id: <1509353516-52208-4-git-send-email-kmp@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-10-30_02:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710300126 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 205 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 30 Oct 2017 08:52:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 30 Oct 2017 08:52:16 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'kmp@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -3.5 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.38 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Kothapally Madhu Pavan , jdenemar@redhat.com Subject: [libvirt] [PATCH 3/7] conf: Allow editing inactive snapshot configuration 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: , MIME-Version: 1.0 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 30 Oct 2017 08:52:38 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This patch will allow user to edit the inactive XML snapshot configuration when it is available in the snapshot. Signed-off-by: Kothapally Madhu Pavan --- include/libvirt/libvirt-domain.h | 1 + src/conf/domain_conf.c | 6 ++++-- src/conf/domain_conf.h | 2 ++ src/conf/snapshot_conf.c | 35 ++++++++++++++++++++++++++++++++++- src/qemu/qemu_driver.c | 3 ++- 5 files changed, 43 insertions(+), 4 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 4048acf..e70c664 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1546,6 +1546,7 @@ typedef enum { VIR_DOMAIN_XML_INACTIVE =3D (1 << 1), /* dump inactive domain info= rmation */ VIR_DOMAIN_XML_UPDATE_CPU =3D (1 << 2), /* update guest CPU requirem= ents according to host CPU */ VIR_DOMAIN_XML_MIGRATABLE =3D (1 << 3), /* dump XML suitable for mig= ration */ + VIR_DOMAIN_XML_ACTIVE_ONLY =3D (1 << 4), /* dump active XML and avoid= inactive XML in snapshot */ } virDomainXMLFlags; =20 char * virDomainGetXMLDesc (virDomainPtr domain, diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 77c20c6..36cebe5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -25687,8 +25687,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, VIR_DOMAIN_DEF_FORMAT_STATUS | VIR_DOMAIN_DEF_FORMAT_ACTUAL_NET | VIR_DOMAIN_DEF_FORMAT_PCI_ORIG_STATES | - VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST, - -1); + VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST | + VIR_DOMAIN_DEF_FORMAT_ACTIVE_ONLY, -1); =20 if (!(type =3D virDomainVirtTypeToString(def->virtType))) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -26472,6 +26472,8 @@ unsigned int virDomainDefFormatConvertXMLFlags(unsi= gned int flags) formatFlags |=3D VIR_DOMAIN_DEF_FORMAT_INACTIVE; if (flags & VIR_DOMAIN_XML_MIGRATABLE) formatFlags |=3D VIR_DOMAIN_DEF_FORMAT_MIGRATABLE; + if (flags & VIR_DOMAIN_XML_ACTIVE_ONLY) + formatFlags |=3D VIR_DOMAIN_DEF_FORMAT_ACTIVE_ONLY; =20 return formatFlags; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 38de70b..0659220 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2853,6 +2853,8 @@ typedef enum { VIR_DOMAIN_DEF_FORMAT_ALLOW_ROM =3D 1 << 6, VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT =3D 1 << 7, VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST =3D 1 << 8, + /* format active XML and avoid inactive XML */ + VIR_DOMAIN_DEF_FORMAT_ACTIVE_ONLY =3D 1 << 9, } virDomainDefFormatFlags; =20 /* Use these flags to skip specific domain ABI consistency checks done diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index bfe3d6c..3cb7cd4 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -290,6 +290,29 @@ virDomainSnapshotDefParse(xmlXPathContextPtr ctxt, } else { VIR_WARN("parsing older snapshot that lacks domain"); } + + /* Older snapshots were created without inactive domain configurat= ion. + * In that case, leave the newDom NULL. */ + if ((tmp =3D virXPathString("string(./inactiveDomain/domain/@type)= ", ctxt))) { + int domainflags =3D VIR_DOMAIN_DEF_PARSE_INACTIVE | + VIR_DOMAIN_DEF_PARSE_SKIP_VALIDATE; + if (flags & VIR_DOMAIN_SNAPSHOT_PARSE_INTERNAL) + domainflags |=3D VIR_DOMAIN_DEF_PARSE_SKIP_OSTYPE_CHECKS; + xmlNodePtr domainNode =3D virXPathNode("./inactiveDomain/domai= n", ctxt); + + VIR_FREE(tmp); + if (domainNode) { + def->newDom =3D virDomainDefParseNode(ctxt->node->doc, dom= ainNode, + caps, xmlopt, NULL, do= mainflags); + if (!def->newDom) + goto cleanup; + } else { + VIR_WARN("missing inactive domain in snapshot"); + } + } else { + VIR_WARN("parsing older snapshot that lacks inactive domain"); + } + } else { def->creationTime =3D tv.tv_sec; } @@ -705,7 +728,8 @@ virDomainSnapshotDefFormat(const char *domain_uuid, virBuffer buf =3D VIR_BUFFER_INITIALIZER; size_t i; =20 - virCheckFlags(VIR_DOMAIN_DEF_FORMAT_SECURE, NULL); + virCheckFlags(VIR_DOMAIN_DEF_FORMAT_SECURE | + VIR_DOMAIN_DEF_FORMAT_ACTIVE_ONLY, NULL); =20 flags |=3D VIR_DOMAIN_DEF_FORMAT_INACTIVE; =20 @@ -757,6 +781,15 @@ virDomainSnapshotDefFormat(const char *domain_uuid, virBufferAddLit(&buf, "\n"); } =20 + if (def->newDom && !(flags & VIR_DOMAIN_DEF_FORMAT_ACTIVE_ONLY)) { + virBufferAddLit(&buf, "\n"); + virBufferAdjustIndent(&buf, 2); + if (virDomainDefFormatInternal(def->newDom, caps, flags, &buf) < 0) + goto error; + virBufferAdjustIndent(&buf, -2); + virBufferAddLit(&buf, "\n"); + } + if (virSaveCookieFormatBuf(&buf, def->cookie, virDomainXMLOptionGetSaveCookie(xmlopt)) < = 0) goto error; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index aecfcff..a0a4384 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15469,7 +15469,8 @@ qemuDomainSnapshotGetXMLDesc(virDomainSnapshotPtr s= napshot, virDomainSnapshotObjPtr snap =3D NULL; char uuidstr[VIR_UUID_STRING_BUFLEN]; =20 - virCheckFlags(VIR_DOMAIN_XML_SECURE, NULL); + virCheckFlags(VIR_DOMAIN_XML_SECURE | + VIR_DOMAIN_XML_ACTIVE_ONLY, NULL); =20 if (!(vm =3D qemuDomObjFromSnapshot(snapshot))) return NULL; --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list