From nobody Thu Apr 25 08:54:19 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=fail(p=none dis=none) header.from=linux.ibm.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1553502569881201.88793252094092; Mon, 25 Mar 2019 01:29:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EC37FC06585C; Mon, 25 Mar 2019 08:29: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 8049A5C241; Mon, 25 Mar 2019 08:29:27 +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 43DBB41F3D; Mon, 25 Mar 2019 08:29:26 +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 x2P8TPD2024172 for ; Mon, 25 Mar 2019 04:29:25 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8D50819C59; Mon, 25 Mar 2019 08:29:25 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 86CED2656E for ; Mon, 25 Mar 2019 08:29:23 +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 4C584308220A for ; Mon, 25 Mar 2019 08:29:22 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x2P8Oguj139513 for ; Mon, 25 Mar 2019 04:29:21 -0400 Received: from e06smtp02.uk.ibm.com (e06smtp02.uk.ibm.com [195.75.94.98]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ressc4wtd-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 25 Mar 2019 04:29:21 -0400 Received: from localhost by e06smtp02.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 25 Mar 2019 08:29:19 -0000 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp02.uk.ibm.com (192.168.101.132) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 25 Mar 2019 08:29:18 -0000 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x2P8TGOg34603116 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Mar 2019 08:29:16 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6FECE42041; Mon, 25 Mar 2019 08:29:16 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44EFB4203F; Mon, 25 Mar 2019 08:29:16 +0000 (GMT) Received: from m46lp64.lnxne.boe (unknown [9.152.108.100]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Mon, 25 Mar 2019 08:29:16 +0000 (GMT) From: Bjoern Walk To: libvir-list@redhat.com Date: Mon, 25 Mar 2019 09:29:14 +0100 X-TM-AS-GCONF: 00 x-cbid: 19032508-0008-0000-0000-000002D129B4 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19032508-0009-0000-0000-0000223D5048 Message-Id: <20190325082914.75907-1-bwalk@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-03-25_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1903250064 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 216 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 25 Mar 2019 08:29:22 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Mon, 25 Mar 2019 08:29:22 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'bwalk@linux.ibm.com' RCPT:'' X-RedHat-Spam-Score: 0.661 (KHOP_DYNAMIC, RCVD_IN_DNSWL_LOW, SPF_PASS) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.47 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: Bjoern Walk , Marc Hartmayer Subject: [libvirt] [PATCH libvirt-python v2] Implement virDomainGetStateParams API 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 25 Mar 2019 08:29:28 +0000 (UTC) Content-Type: text/plain; charset="utf-8" From: Marc Hartmayer This patch adds the Python binding for the virDomainGetStateParams API. The Python side can be generated automatically, the C side cannot. Reviewed-by: Boris Fiuczynski Signed-off-by: Marc Hartmayer Signed-off-by: Bjoern Walk --- Patch series for libvirt is here: https://www.redhat.com/archives/libvir-list/2019-March/msg01648.html generator.py | 1 + libvirt-override-api.xml | 6 +++++ libvirt-override.c | 48 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+) diff --git a/generator.py b/generator.py index ffa3ce56..005be502 100755 --- a/generator.py +++ b/generator.py @@ -496,6 +496,7 @@ skip_impl =3D ( 'virConnectBaselineHypervisorCPU', 'virDomainGetLaunchSecurityInfo', 'virNodeGetSEVInfo', + 'virDomainGetStateParams', ) =20 lxc_skip_impl =3D ( diff --git a/libvirt-override-api.xml b/libvirt-override-api.xml index 7f578e01..fab62447 100644 --- a/libvirt-override-api.xml +++ b/libvirt-override-api.xml @@ -754,5 +754,11 @@ + + Extract domain state and additional information (if available)= . + + + + diff --git a/libvirt-override.c b/libvirt-override.c index c5e2908c..7ae10874 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -9946,6 +9946,51 @@ libvirt_virNodeGetSEVInfo(PyObject *self ATTRIBUTE_U= NUSED, #endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */ =20 =20 +#if LIBVIR_CHECK_VERSION(5, 2, 0) +static PyObject * +libvirt_virDomainGetStateParams(PyObject *self ATTRIBUTE_UNUSED, + PyObject *args) +{ + PyObject *py_retval =3D VIR_PY_NONE; + PyObject *pyobj_domain; + virDomainPtr domain; + int state; + int reason; + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + unsigned int flags; + int c_retval; + + if (!PyArg_ParseTuple(args, (char *)"OI:virDomainGetStateParams", + &pyobj_domain, &flags)) + return NULL; + domain =3D (virDomainPtr) PyvirDomain_Get(pyobj_domain); + + LIBVIRT_BEGIN_ALLOW_THREADS; + c_retval =3D virDomainGetStateParams(domain, &state, &reason, ¶ms, + &nparams, flags); + LIBVIRT_END_ALLOW_THREADS; + + if (c_retval < 0) + goto error; + + if ((py_retval =3D PyTuple_New(3)) =3D=3D NULL) + goto error; + + VIR_PY_TUPLE_SET_GOTO(py_retval, 0, libvirt_intWrap(state), error); + VIR_PY_TUPLE_SET_GOTO(py_retval, 1, libvirt_intWrap(reason), error); + VIR_PY_TUPLE_SET_GOTO(py_retval, 2, getPyVirTypedParameter(params, npa= rams), error); + + return py_retval; + +error: + Py_XDECREF(py_retval); + virTypedParamsFree(params, nparams); + return VIR_PY_NONE; +} +#endif /* LIBVIR_CHECK_VERSION(5, 2, 0) */ + + /************************************************************************ * * * The registration stuff * @@ -10192,6 +10237,9 @@ static PyMethodDef libvirtMethods[] =3D { {(char *) "virDomainGetLaunchSecurityInfo", libvirt_virDomainGetLaunch= SecurityInfo, METH_VARARGS, NULL}, {(char *) "virNodeGetSEVInfo", libvirt_virNodeGetSEVInfo, METH_VARARGS= , NULL}, #endif /* LIBVIR_CHECK_VERSION(4, 5, 0) */ +#if LIBVIR_CHECK_VERSION(5, 2, 0) + {(char *) "virDomainGetStateParams", libvirt_virDomainGetStateParams, = METH_VARARGS, NULL}, +#endif /* LIBVIR_CHECK_VERSION(5, 2, 0) */ {NULL, NULL, 0, NULL} }; =20 --=20 2.17.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list