From nobody Thu May 15 22:52:18 2025 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 1502182141826498.3001456156087; Tue, 8 Aug 2017 01:49:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5A1D24A702; Tue, 8 Aug 2017 08:48:59 +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 D9626908D4; Tue, 8 Aug 2017 08:48:57 +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 F37C04A467; Tue, 8 Aug 2017 08:48:51 +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 v788moM8029692 for ; Tue, 8 Aug 2017 04:48:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0D5C6955C4; Tue, 8 Aug 2017 08:48:50 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F1AF1955C1 for ; Tue, 8 Aug 2017 08:48:47 +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 3A3D681235 for ; Tue, 8 Aug 2017 08:48:45 +0000 (UTC) Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v7881wHl002989 for ; Tue, 8 Aug 2017 04:03:14 -0400 Received: from e23smtp08.au.ibm.com (e23smtp08.au.ibm.com [202.81.31.141]) by mx0a-001b2d01.pphosted.com with ESMTP id 2c71knbgj8-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 08 Aug 2017 04:03:14 -0400 Received: from localhost by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 8 Aug 2017 18:03:11 +1000 Received: from d23relay10.au.ibm.com (202.81.31.229) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 8 Aug 2017 18:03:09 +1000 Received: from d23av03.au.ibm.com (d23av03.au.ibm.com [9.190.234.97]) by d23relay10.au.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v78838wi32112668; Tue, 8 Aug 2017 18:03:08 +1000 Received: from d23av03.au.ibm.com (localhost [127.0.0.1]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v7882xj1000946; Tue, 8 Aug 2017 18:02:59 +1000 Received: from powerkvmpok002.pok.stglabs.ibm.com (powerkvmpok002.pok.stglabs.ibm.com [9.114.13.10]) by d23av03.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v7882nIu000617; Tue, 8 Aug 2017 18:02:58 +1000 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 5A1D24A702 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=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 5A1D24A702 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3A3D681235 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ext-mx01.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 3A3D681235 From: Kothapally Madhu Pavan To: libvir-list@redhat.com Date: Tue, 8 Aug 2017 13:32:50 +0530 In-Reply-To: <1502179375-32584-1-git-send-email-kmp@linux.vnet.ibm.com> References: <1502179375-32584-1-git-send-email-kmp@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17080808-0048-0000-0000-00000257DFD8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17080808-0049-0000-0000-0000480B3FB4 Message-Id: <1502179375-32584-3-git-send-email-kmp@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-08-08_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=1 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1706020000 definitions=main-1708080128 X-Greylist: Delayed for 00:45:37 by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 08 Aug 2017 08:48:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 08 Aug 2017 08:48:46 +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: -0.72 (RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL) 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.25 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Cc: Kothapally Madhu Pavan , pkrempa@redhat.com Subject: [libvirt] [PATCH v4 2/7] lib: Add API to edit domain's managed save state xml 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Tue, 08 Aug 2017 08:49:00 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Similar to domainSaveImageDefineXML this commit adds domainManagedSaveDefin= eXML API which allows to edit domain's managed save state xml configuration. Signed-off-by: Kothapally Madhu Pavan --- include/libvirt/libvirt-domain.h | 4 +++ src/driver-hypervisor.h | 6 +++++ src/libvirt-domain.c | 58 ++++++++++++++++++++++++++++++++++++= ++++ src/libvirt_public.syms | 1 + src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 16 ++++++++++- src/remote_protocol-structs | 8 +++++- 7 files changed, 92 insertions(+), 2 deletions(-) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 8ede912..ed2c2b6 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1211,6 +1211,10 @@ int virDomainManagedSaveRemove(vi= rDomainPtr dom, unsigned int flags); char * virDomainManagedSaveGetXMLDesc(virDomainPtr domain, unsigned int flags); +int virDomainManagedSaveDefineXML(virDomainPtr domain, + const char *dxml, + unsigned int flags); + =20 /* * Domain core dump diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index 598fc06..0a4181e 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -749,6 +749,11 @@ typedef char * (*virDrvDomainManagedSaveGetXMLDesc)(virDomainPtr domain, unsigned int flags); =20 +typedef int +(*virDrvDomainManagedSaveDefineXML)(virDomainPtr domain, + const char *dxml, + unsigned int flags); + typedef virDomainSnapshotPtr (*virDrvDomainSnapshotCreateXML)(virDomainPtr domain, const char *xmlDesc, @@ -1427,6 +1432,7 @@ struct _virHypervisorDriver { virDrvDomainHasManagedSaveImage domainHasManagedSaveImage; virDrvDomainManagedSaveRemove domainManagedSaveRemove; virDrvDomainManagedSaveGetXMLDesc domainManagedSaveGetXMLDesc; + virDrvDomainManagedSaveDefineXML domainManagedSaveDefineXML; virDrvDomainSnapshotCreateXML domainSnapshotCreateXML; virDrvDomainSnapshotGetXMLDesc domainSnapshotGetXMLDesc; virDrvDomainSnapshotNum domainSnapshotNum; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index cb260e2..918e81a 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -9349,6 +9349,64 @@ virDomainManagedSaveGetXMLDesc(virDomainPtr domain, = unsigned int flags) =20 =20 /** + * virDomainManagedSaveDefineXML: + * @domain: a domain object + * @dxml: XML config for adjusting guest xml used on restore + * @flags: bitwise-OR of virDomainSaveRestoreFlags + * + * This updates the definition of a domain stored in a saved state + * file. @domain is used to extract the saved state file location. + * + * @dxml can be used to alter host-specific portions of the domain XML + * that will be used on the next start of the domain. For example, it is + * possible to alter the backing filename that is associated with a + * disk device, to match renaming done as part of backing up the disk + * device while the domain is stopped. + * + * Normally, the saved state file will remember whether the domain was + * running or paused, and restore defaults to the same state. + * Specifying VIR_DOMAIN_SAVE_RUNNING or VIR_DOMAIN_SAVE_PAUSED in + * @flags will override the default saved into the file; omitting both + * leaves the file's default unchanged. These two flags are mutually + * exclusive. + * + * Returns 0 in case of success and -1 in case of failure. + */ +int +virDomainManagedSaveDefineXML(virDomainPtr domain, const char *dxml, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "flags=3D%x", flags); + + virResetLastError(); + + VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING, + VIR_DOMAIN_SAVE_PAUSED, + error); + + virCheckDomainReturn(domain, -1); + conn =3D domain->conn; + + if (conn->driver->domainManagedSaveDefineXML) { + int ret; + ret =3D conn->driver->domainManagedSaveDefineXML(domain, dxml, fla= gs); + + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + + error: + virDispatchError(domain->conn); + return -1; +} + + +/** * virDomainOpenConsole: * @dom: a domain object * @dev_name: the console, serial or parallel port device alias, or NULL diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index b38d0bb..fc4efd9 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -771,6 +771,7 @@ LIBVIRT_3.4.0 { LIBVIRT_3.7.0 { global: virDomainManagedSaveGetXMLDesc; + virDomainManagedSaveDefineXML; } LIBVIRT_3.4.0; =20 # .... define new API here using predicted next version number .... diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 7a74b87..482d4ce 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8411,6 +8411,7 @@ static virHypervisorDriver hypervisor_driver =3D { .domainHasManagedSaveImage =3D remoteDomainHasManagedSaveImage, /* 0.8= .0 */ .domainManagedSaveRemove =3D remoteDomainManagedSaveRemove, /* 0.8.0 */ .domainManagedSaveGetXMLDesc =3D remoteDomainManagedSaveGetXMLDesc, /*= 3.7.0 */ + .domainManagedSaveDefineXML =3D remoteDomainManagedSaveDefineXML, /* 3= .7.0 */ .domainSnapshotCreateXML =3D remoteDomainSnapshotCreateXML, /* 0.8.0 */ .domainSnapshotGetXMLDesc =3D remoteDomainSnapshotGetXMLDesc, /* 0.8.0= */ .domainSnapshotNum =3D remoteDomainSnapshotNum, /* 0.8.0 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 67d518c..ddc6bda 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -2556,6 +2556,12 @@ struct remote_domain_managed_save_get_xml_desc_ret { remote_nonnull_string xml; }; =20 +struct remote_domain_managed_save_define_xml_args { + remote_nonnull_domain dom; + remote_string dxml; + unsigned int flags; +}; + struct remote_domain_snapshot_create_xml_args { remote_nonnull_domain dom; remote_nonnull_string xml_desc; @@ -6081,5 +6087,13 @@ enum remote_procedure { * @acl: domain:read * @acl: domain:read_secure:VIR_DOMAIN_XML_SECURE */ - REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC =3D 387 + REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC =3D 387, + + /** + * @generate: both + * @priority: high + * @acl: domain:write + * @acl: domain:hibernate + */ + REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML =3D 388 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index 27f95ac..8075335 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -1970,6 +1970,11 @@ struct remote_domain_managed_save_get_xml_desc_args { struct remote_domain_managed_save_get_xml_desc_ret { remote_nonnull_string xml; }; +struct remote_domain_managed_save_define_xml_args { + remote_nonnull_domain dom; + remote_nonnull_string dxml; + u_int flags; +}; struct remote_domain_snapshot_create_xml_args { remote_nonnull_domain dom; remote_nonnull_string xml_desc; @@ -3240,5 +3245,6 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_SET_VCPU =3D 384, REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD =3D 385, REMOTE_PROC_DOMAIN_SET_BLOCK_THRESHOLD =3D 386, - REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC =3D 387 + REMOTE_PROC_DOMAIN_MANAGED_SAVE_GET_XML_DESC =3D 387, + REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML =3D 388 }; --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list