From nobody Thu Apr 25 13:37:46 2024 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549579229742489.9381570807194; Thu, 7 Feb 2019 14:40:29 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 6DFC519F43; Thu, 7 Feb 2019 22:40:27 +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 98A4C1691C; Thu, 7 Feb 2019 22:40:26 +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 BEAD13F602; Thu, 7 Feb 2019 22:40:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x17MeOAi029979 for ; Thu, 7 Feb 2019 17:40:24 -0500 Received: by smtp.corp.redhat.com (Postfix) id CC5A118516; Thu, 7 Feb 2019 22:40:24 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-162.phx2.redhat.com [10.3.116.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id D891B18E22; Thu, 7 Feb 2019 22:40:23 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Thu, 7 Feb 2019 16:39:53 -0600 Message-Id: <20190207223954.12678-2-eblake@redhat.com> In-Reply-To: <20190207223954.12678-1-eblake@redhat.com> References: <20190207223954.12678-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: amureini@redhat.com, derez@redhat.com, vsementsov@virtuozzo.com, bharadwaj.rayala@rubrik.com, ydary@redhat.com, nsoffer@redhat.com, jsnow@redhat.com, suman.swaroop@rubrik.com Subject: [libvirt] [python PATCH v4 1/2] generator.py: typo fix 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: , 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.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Thu, 07 Feb 2019 22:40:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Eric Blake Reviewed-by: Daniel P. Berrang=C3=A9 --- generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/generator.py b/generator.py index 6cb923f..ffa3ce5 100755 --- a/generator.py +++ b/generator.py @@ -1095,7 +1095,7 @@ def is_python_noninteger_type (name): return name[-1:] =3D=3D "*" def nameFixup(name, classe, type, file): - # avoid a desastrous clash + # avoid a disastrous clash listname =3D classe + "List" ll =3D len(listname) l =3D len(classe) --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Thu Apr 25 13:37:46 2024 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1549579249580274.85091810559425; Thu, 7 Feb 2019 14:40:49 -0800 (PST) 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 C7FD4E86E; Thu, 7 Feb 2019 22:40:47 +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 83C44424B; Thu, 7 Feb 2019 22:40:47 +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 2DF153F605; Thu, 7 Feb 2019 22:40:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x17MePY7029987 for ; Thu, 7 Feb 2019 17:40:25 -0500 Received: by smtp.corp.redhat.com (Postfix) id E033B18516; Thu, 7 Feb 2019 22:40:25 +0000 (UTC) Received: from blue.redhat.com (ovpn-116-162.phx2.redhat.com [10.3.116.162]) by smtp.corp.redhat.com (Postfix) with ESMTP id E648917A66; Thu, 7 Feb 2019 22:40:24 +0000 (UTC) From: Eric Blake To: libvir-list@redhat.com Date: Thu, 7 Feb 2019 16:39:54 -0600 Message-Id: <20190207223954.12678-3-eblake@redhat.com> In-Reply-To: <20190207223954.12678-1-eblake@redhat.com> References: <20190207223954.12678-1-eblake@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: amureini@redhat.com, derez@redhat.com, vsementsov@virtuozzo.com, bharadwaj.rayala@rubrik.com, ydary@redhat.com, nsoffer@redhat.com, jsnow@redhat.com, suman.swaroop@rubrik.com Subject: [libvirt] [python PATCH v4 2/2] Add virDomainCheckpoint APIs 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: , 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.30]); Thu, 07 Feb 2019 22:40:48 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Copies heavily from existing virDomainSnapshot handling, regarding what special cases the generator has to be taught and what overrides need to be written. Signed-off-by: Eric Blake Reviewed-by: Daniel P. Berrang=C3=A9 --- HACKING | 2 + MANIFEST.in | 1 + generator.py | 34 +++++++-- libvirt-override-api.xml | 12 ++++ libvirt-override-virDomain.py | 13 ++++ libvirt-override-virDomainCheckpoint.py | 19 +++++ libvirt-override.c | 96 +++++++++++++++++++++++++ sanitytest.py | 9 ++- typewrappers.c | 13 ++++ typewrappers.h | 10 +++ 10 files changed, 202 insertions(+), 7 deletions(-) create mode 100644 libvirt-override-virDomainCheckpoint.py diff --git a/HACKING b/HACKING index 6eeb9e6..39e7cd3 100644 --- a/HACKING +++ b/HACKING @@ -28,6 +28,8 @@ hand written source files the virConnect class - libvirt-override-virDomain.py - high level overrides in the virDomain class + - libvirt-override-virDomainCheckpoint.py - high level overrides in + the virDomainCheckpoint class - libvirt-override-virDomainSnapshot.py - high level overrides in the virDomainSnapshot class - libvirt-override-virStoragePool.py - high level overrides in diff --git a/MANIFEST.in b/MANIFEST.in index b6788f4..5d2f559 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -23,6 +23,7 @@ include libvirt-override.c include libvirt-override.py include libvirt-override-virConnect.py include libvirt-override-virDomain.py +include libvirt-override-virDomainCheckpoint.py include libvirt-override-virDomainSnapshot.py include libvirt-override-virStoragePool.py include libvirt-override-virStream.py diff --git a/generator.py b/generator.py index ffa3ce5..31535d4 100755 --- a/generator.py +++ b/generator.py @@ -35,6 +35,7 @@ libvirt_headers =3D [ "libvirt", "libvirt-common", "libvirt-domain", + "libvirt-domain-checkpoint", "libvirt-domain-snapshot", "libvirt-event", "libvirt-host", @@ -364,6 +365,10 @@ py_types =3D { 'virStream *': ('O', "virStream", "virStreamPtr", "virStreamPtr"), 'const virStream *': ('O', "virStream", "virStreamPtr", "virStreamPtr= "), + 'virDomainCheckpointPtr': ('O', "virDomainCheckpoint", "virDomainChec= kpointPtr", "virDomainCheckpointPtr"), + 'virDomainCheckpoint *': ('O', "virDomainCheckpoint", "virDomainCheck= pointPtr", "virDomainCheckpointPtr"), + 'const virDomainCheckpoint *': ('O', "virDomainCheckpoint", "virDomai= nCheckpointPtr", "virDomainCheckpointPtr"), + 'virDomainSnapshotPtr': ('O', "virDomainSnapshot", "virDomainSnapshot= Ptr", "virDomainSnapshotPtr"), 'virDomainSnapshot *': ('O', "virDomainSnapshot", "virDomainSnapshotP= tr", "virDomainSnapshotPtr"), 'const virDomainSnapshot *': ('O', "virDomainSnapshot", "virDomainSna= pshotPtr", "virDomainSnapshotPtr"), @@ -536,6 +541,8 @@ skip_function =3D ( 'virSaveLastError', # We have our own python error wrapper 'virFreeError', # Only needed if we use virSaveLastError 'virConnectListAllDomains', # overridden in virConnect.py + 'virDomainListCheckpoints', # overridden in virDomain.py + 'virDomainCheckpointListChildren', # overridden in virDomainCheckpoint= .py 'virDomainListAllSnapshots', # overridden in virDomain.py 'virDomainSnapshotListAllChildren', # overridden in virDomainSnapshot.= py 'virConnectListAllStoragePools', # overridden in virConnect.py @@ -582,6 +589,7 @@ skip_function =3D ( "virStoragePoolRef", "virStorageVolRef", "virStreamRef", + "virDomainCheckpointRef", "virDomainSnapshotRef", # This functions shouldn't be called via the bindings (and even the do= cs @@ -594,6 +602,8 @@ skip_function =3D ( "virNWFilterGetConnect", "virStoragePoolGetConnect", "virStorageVolGetConnect", + "virDomainCheckpointGetConnect", + "virDomainCheckpointGetDomain", "virDomainSnapshotGetConnect", "virDomainSnapshotGetDomain", @@ -1023,6 +1033,8 @@ classes_type =3D { "virStream *": ("._o", "virStream(self, _obj=3D%s)", "virStream"), "virConnectPtr": ("._o", "virConnect(_obj=3D%s)", "virConnect"), "virConnect *": ("._o", "virConnect(_obj=3D%s)", "virConnect"), + "virDomainCheckpointPtr": ("._o", "virDomainCheckpoint(self,_obj=3D%s)= ", "virDomainCheckpoint"), + "virDomainCheckpoint *": ("._o", "virDomainCheckpoint(self, _obj=3D%s)= ", "virDomainCheckpoint"), "virDomainSnapshotPtr": ("._o", "virDomainSnapshot(self,_obj=3D%s)", "= virDomainSnapshot"), "virDomainSnapshot *": ("._o", "virDomainSnapshot(self, _obj=3D%s)", "= virDomainSnapshot"), } @@ -1031,7 +1043,7 @@ primary_classes =3D ["virDomain", "virNetwork", "virI= nterface", "virStoragePool", "virStorageVol", "virConnect", "virNodeDevice", "virSecret", "virNWFilter", "virNWFilterBinding", - "virStream", "virDomainSnapshot"] + "virStream", "virDomainCheckpoint", "virDomainSnapshot"] classes_destructors =3D { "virDomain": "virDomainFree", @@ -1043,6 +1055,7 @@ classes_destructors =3D { "virSecret": "virSecretFree", "virNWFilter": "virNWFilterFree", "virNWFilterBinding": "virNWFilterBindingFree", + "virDomainCheckpoint": "virDomainCheckpointFree", "virDomainSnapshot": "virDomainSnapshotFree", # We hand-craft __del__ for this one #"virStream": "virStreamFree", @@ -1053,6 +1066,7 @@ class_skip_connect_impl =3D { } class_domain_impl =3D { + "virDomainCheckpoint": True, "virDomainSnapshot": True, } @@ -1171,6 +1185,18 @@ def nameFixup(name, classe, type, file): elif name[0:12] =3D=3D "virDomainGet": func =3D name[12:] func =3D func[0:1].lower() + func[1:] + elif name[0:31] =3D=3D "virDomainCheckpointLookupByName": + func =3D name[9:] + func =3D func[0:1].lower() + func[1:] + elif name[0:28] =3D=3D "virDomainCheckpointCreateXML": + func =3D name[9:] + func =3D func[0:1].lower() + func[1:] + elif name[0:26] =3D=3D "virDomainCheckpointCurrent": + func =3D name[9:] + func =3D func[0:1].lower() + func[1:] + elif name[0:19] =3D=3D "virDomainCheckpoint": + func =3D name[19:] + func =3D func[0:1].lower() + func[1:] elif name[0:29] =3D=3D "virDomainSnapshotLookupByName": func =3D name[9:] func =3D func[0:1].lower() + func[1:] @@ -1501,7 +1527,7 @@ def buildWrappers(module): "virStorageVol", "virNodeDevice", "virSecret= ","virStream", "virNWFilter", "virNWFilterBinding" ]: classes.write(" def __init__(self, conn, _obj=3DNone):\= n") - elif classname in [ 'virDomainSnapshot' ]: + elif classname in [ "virDomainCheckpoint", "virDomainSnapshot"= ]: classes.write(" def __init__(self, dom, _obj=3DNone):\n= ") else: classes.write(" def __init__(self, _obj=3DNone):\n") @@ -1513,7 +1539,7 @@ def buildWrappers(module): classes.write(" self._conn =3D conn\n" + \ " if not isinstance(conn, virConnect)= :\n" + \ " self._conn =3D conn._conn\n") - elif classname in [ "virDomainSnapshot" ]: + elif classname in [ "virDomainCheckpoint", "virDomainSnapshot"= ]: classes.write(" self._dom =3D dom\n") classes.write(" self._conn =3D dom.connect()\n") classes.write(" if type(_obj).__name__ not in [\"PyCaps= ule\", \"PyCObject\"]:\n") @@ -1641,7 +1667,7 @@ def buildWrappers(module): classes.write( " if ret is None:raise libvirtError('%s() fail= ed', vol=3Dself)\n" % (name)) - elif classname =3D=3D "virDomainSnapshot": + elif classname in [ "virDomainCheckpoint", "vi= rDomainSnapshot"]: classes.write( " if ret is None:raise libvirtError('%s() fail= ed', dom=3Dself._dom)\n" % (name)) diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 7f578e0..e24dd6e 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -576,6 +576,18 @@ + + returns the list of checkpoints for the given domain + + + + + + collect the list of child checkpoint names for the given check= point + + + + Get progress information for a block job diff --git a/libvirt-override-virDomain.py b/libvirt-override-virDomain.py index 7c417b8..85e9297 100644 --- a/libvirt-override-virDomain.py +++ b/libvirt-override-virDomain.py @@ -11,6 +11,19 @@ return retlist + def listCheckpoints(self, flags=3D0): + """List all checkpoints and returns a list of checkpoint objects""" + ret =3D libvirtmod.virDomainListCheckpoints(self._o, flags) + if ret is None: + raise libvirtError("virDomainListCheckpoints() failed", conn= =3Dself) + + retlist =3D list() + for chkptr in ret: + retlist.append(virDomainCheckpoint(self, _obj=3Dchkptr)) + + return retlist + + def createWithFiles(self, files, flags=3D0): """Launch a defined domain. If the call succeeds the domain moves = from the defined to the running domains pools. diff --git a/libvirt-override-virDomainCheckpoint.py b/libvirt-override-vir= DomainCheckpoint.py new file mode 100644 index 0000000..788ec50 --- /dev/null +++ b/libvirt-override-virDomainCheckpoint.py @@ -0,0 +1,19 @@ + def getConnect(self): + """Get the connection that owns the domain that a checkpoint was c= reated for""" + return self.connect() + + def getDomain(self): + """Get the domain that a checkpoint was created for""" + return self.domain() + + def listChildren(self, flags=3D0): + """List all child checkpoints and returns a list of checkpoint obj= ects""" + ret =3D libvirtmod.virDomainCheckpointListChildren(self._o, flags) + if ret is None: + raise libvirtError("virDomainCheckpointListChildren() failed",= conn=3Dself) + + retlist =3D list() + for chkptr in ret: + retlist.append(virDomainCheckpoint(self, _obj=3Dchkptr)) + + return retlist diff --git a/libvirt-override.c b/libvirt-override.c index f7b2f6b..376a709 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -2325,6 +2325,98 @@ libvirt_virConnectListDefinedDomains(PyObject *self = ATTRIBUTE_UNUSED, goto cleanup; } +#if LIBVIR_CHECK_VERSION(5, 1, 0) +static PyObject * +libvirt_virDomainListCheckpoints(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *py_retval =3D NULL; + virDomainCheckpointPtr *chks =3D NULL; + int c_retval; + ssize_t i; + virDomainPtr dom; + PyObject *pyobj_dom; + unsigned int flags; + + if (!PyArg_ParseTuple(args, (char *)"OI:virDomainListCheckpoints", + &pyobj_dom, &flags)) + return NULL; + dom =3D (virDomainPtr) PyvirDomain_Get(pyobj_dom); + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval =3D virDomainListCheckpoints(dom, &chks, flags); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) + return VIR_PY_NONE; + + if (!(py_retval =3D PyList_New(c_retval))) + goto cleanup; + + for (i =3D 0; i < c_retval; i++) { + VIR_PY_LIST_SET_GOTO(py_retval, i, + libvirt_virDomainCheckpointPtrWrap(chks[i]), = error); + chks[i] =3D NULL; + } + + cleanup: + for (i =3D 0; i < c_retval; i++) + if (chks[i]) + virDomainCheckpointFree(chks[i]); + VIR_FREE(chks); + return py_retval; + + error: + Py_CLEAR(py_retval); + goto cleanup; +} + +static PyObject * +libvirt_virDomainCheckpointListChildren(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *py_retval =3D NULL; + virDomainCheckpointPtr *chks =3D NULL; + int c_retval; + ssize_t i; + virDomainCheckpointPtr parent; + PyObject *pyobj_parent; + unsigned int flags; + + if (!PyArg_ParseTuple(args, (char *)"OI:virDomainCheckpointListChildre= n", + &pyobj_parent, &flags)) + return NULL; + parent =3D (virDomainCheckpointPtr) PyvirDomainCheckpoint_Get(pyobj_pa= rent); + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval =3D virDomainCheckpointListChildren(parent, &chks, flags); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) + return VIR_PY_NONE; + + if (!(py_retval =3D PyList_New(c_retval))) + goto cleanup; + + for (i =3D 0; i < c_retval; i++) { + VIR_PY_LIST_SET_GOTO(py_retval, i, + libvirt_virDomainCheckpointPtrWrap(chks[i]), = error); + chks[i] =3D NULL; + } + + cleanup: + for (i =3D 0; i < c_retval; i++) + if (chks[i]) + virDomainCheckpointFree(chks[i]); + VIR_FREE(chks); + return py_retval; + + error: + Py_CLEAR(py_retval); + goto cleanup; +} +#endif /* LIBVIR_CHECK_VERSION(5, 1, 0) */ + static PyObject * libvirt_virDomainSnapshotListNames(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) @@ -10100,6 +10192,10 @@ static PyMethodDef libvirtMethods[] =3D { #if LIBVIR_CHECK_VERSION(1, 0, 3) {(char *) "virDomainGetJobStats", libvirt_virDomainGetJobStats, METH_V= ARARGS, NULL}, #endif /* LIBVIR_CHECK_VERSION(1, 0, 3) */ +#if LIBVIR_CHECK_VERSION(5, 1, 0) + {(char *) "virDomainListCheckpoints", libvirt_virDomainListCheckpoints= , METH_VARARGS, NULL}, + {(char *) "virDomainCheckpointListChildren", libvirt_virDomainCheckpoi= ntListChildren, METH_VARARGS, NULL}, +#endif /* LIBVIR_CHECK_VERSION(5, 1, 0) */ {(char *) "virDomainSnapshotListNames", libvirt_virDomainSnapshotListN= ames, METH_VARARGS, NULL}, #if LIBVIR_CHECK_VERSION(0, 9, 13) {(char *) "virDomainListAllSnapshots", libvirt_virDomainListAllSnapsho= ts, METH_VARARGS, NULL}, diff --git a/sanitytest.py b/sanitytest.py index 68dde6b..8cfe966 100644 --- a/sanitytest.py +++ b/sanitytest.py @@ -249,7 +249,7 @@ for name in sorted(basicklassmap): # Remove 'Get' prefix from most APIs, except those in virConnect # and virDomainSnapshot namespaces which stupidly used a different # convention which we now can't fix without breaking API - if func[0:3] =3D=3D "Get" and klass not in ["virConnect", "virDomainSn= apshot", "libvirt"]: + if func[0:3] =3D=3D "Get" and klass not in ["virConnect", "virDomainCh= eckpoint", "virDomainSnapshot", "libvirt"]: if func not in ["GetCPUStats", "GetTime"]: func =3D func[3:] @@ -266,7 +266,7 @@ for name in sorted(basicklassmap): if klass !=3D "virDomain": func =3D klass[3:] + func - if klass =3D=3D "virDomainSnapshot": + if klass in [ "virDomainCheckpoint", "virDomainSnapshot"]: klass =3D "virDomain" func =3D func[6:] elif klass =3D=3D "virStorageVol" and func in ["StorageVolCreateXM= LFrom", "StorageVolCreateXML"]: @@ -297,10 +297,13 @@ for name in sorted(basicklassmap): if func[0:6] =3D=3D "Change": klass =3D "virConnect" - # Need to special case the snapshot APIs + # Need to special case the checkpoint and snapshot APIs if klass =3D=3D "virDomainSnapshot" and func in ["Current", "ListNames= ", "Num"]: klass =3D "virDomain" func =3D "snapshot" + func + elif klass =3D=3D "virDomainCheckpoint" and func =3D=3D "Current": + klass =3D "virDomain" + func =3D "checkpoint" + func # Names should start with lowercase letter... func =3D func[0:1].lower() + func[1:] diff --git a/typewrappers.c b/typewrappers.c index 9ba14b4..cd7a70b 100644 --- a/typewrappers.c +++ b/typewrappers.c @@ -568,6 +568,19 @@ libvirt_virStreamPtrWrap(virStreamPtr node) return ret; } +PyObject * +libvirt_virDomainCheckpointPtrWrap(virDomainCheckpointPtr node) +{ + PyObject *ret; + + if (node =3D=3D NULL) { + return VIR_PY_NONE; + } + + ret =3D libvirt_buildPyObject(node, "virDomainCheckpointPtr", NULL); + return ret; +} + PyObject * libvirt_virDomainSnapshotPtrWrap(virDomainSnapshotPtr node) { diff --git a/typewrappers.h b/typewrappers.h index 4423774..198397b 100644 --- a/typewrappers.h +++ b/typewrappers.h @@ -128,6 +128,15 @@ typedef struct { } PyvirStream_Object; +#define PyvirDomainCheckpoint_Get(v) (((v) =3D=3D Py_None) ? NULL : \ + (((PyvirDomainCheckpoint_Object *)(v))->obj)) + +typedef struct { + PyObject_HEAD + virDomainCheckpointPtr obj; +} PyvirDomainCheckpoint_Object; + + #define PyvirDomainSnapshot_Get(v) (((v) =3D=3D Py_None) ? NULL : \ (((PyvirDomainSnapshot_Object *)(v))->obj)) @@ -204,6 +213,7 @@ PyObject * libvirt_virSecretPtrWrap(virSecretPtr node); PyObject * libvirt_virNWFilterPtrWrap(virNWFilterPtr node); PyObject * libvirt_virNWFilterBindingPtrWrap(virNWFilterBindingPtr node); PyObject * libvirt_virStreamPtrWrap(virStreamPtr node); +PyObject * libvirt_virDomainCheckpointPtrWrap(virDomainCheckpointPtr node); PyObject * libvirt_virDomainSnapshotPtrWrap(virDomainSnapshotPtr node); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list