Commit de51dc9c9aed0e615c8b301cccb89f4859324eb0 primarily added
virConnectGetCPUModelNames as libvirt.getCPUModelNames(conn, arch)
instead of libvirt.virConnect.getCPUModelNames(arch) so revert the code
that does the former while leaving the code that does the later.
---
So to test this do the following before building this:
$ python
>> import libvirt
>> "getCPUModelNames" in dir(libvirt)
True
>> "getCPUModelNames" in dir(libvirt.virConnect)
True
>> conn = libvirt.open()
>> libvirt.getCPUModelNames(conn, "x86_64")
['486',
'pentium', 'pentium2', 'pentium3', 'pentiumpro',
'coreduo', 'n270', 'core2duo', 'qemu32', 'kvm32',
'cpu64-rhel5', 'cpu64-rhel6', 'kvm64', 'qemu64',
'Conroe', 'Penryn', 'Nehalem', 'Westmere',
'SandyBridge', 'Haswell', 'athlon', 'phenom',
'Opteron_G1', 'Opteron_G2', 'Opteron_G3', 'Opteron_G4',
'Opteron_G5']
>> conn.getCPUModelNames("x86_64")
['486', 'pentium', 'pentium2', 'pentium3',
'pentiumpro', 'coreduo', 'n270', 'core2duo',
'qemu32', 'kvm32', 'cpu64-rhel5', 'cpu64-rhel6',
'kvm64', 'qemu64', 'Conroe', 'Penryn', 'Nehalem',
'Westmere', 'SandyBridge', 'Haswell', 'athlon',
'phenom', 'Opteron_G1', 'Opteron_G2', 'Opteron_G3',
'Opteron_G4', 'Opteron_G5']
Then build this and assuming you're in the top level of libvirt:
$ python
>> import sys
>> sys.path.insert(0, 'python/')
>> import libvirt
.... repeat the steps above and watch the case
libvirt.getCPUModelNames fail
---
---
python/generator.py | 1 -
python/libvirt-override.c | 53 ----------------------------------------------
python/libvirt-override.py | 11 ----------
3 files changed, 65 deletions(-)
diff --git a/python/generator.py b/python/generator.py
index 87ecf5a..0e86bed 100755
--- a/python/generator.py
+++ b/python/generator.py
@@ -250,7 +250,6 @@ lxc_functions_failed = []
qemu_functions_failed = []
functions_skipped = [
"virConnectListDomains",
- "virConnectGetCPUModelNames",
]
lxc_functions_skipped = []
qemu_functions_skipped = []
diff --git a/python/libvirt-override.c b/python/libvirt-override.c
index 747c877..bd7a610 100644
--- a/python/libvirt-override.c
+++ b/python/libvirt-override.c
@@ -2276,58 +2276,6 @@ libvirt_virConnectGetVersion(PyObject *self ATTRIBUTE_UNUSED,
return PyInt_FromLong(hvVersion);
}
-PyObject *
-libvirt_virConnectGetCPUModelNames(PyObject *self ATTRIBUTE_UNUSED,
- PyObject *args)
-{
- int c_retval;
- virConnectPtr conn;
- PyObject *rv = NULL, *pyobj_conn;
- char **models = NULL;
- size_t i;
- int flags = 0;
- const char *arch = NULL;
-
- if (!PyArg_ParseTuple(args, (char *)"Osi:virConnectGetCPUModelNames",
- &pyobj_conn, &arch, &flags))
- return NULL;
- conn = (virConnectPtr) PyvirConnect_Get(pyobj_conn);
-
- LIBVIRT_BEGIN_ALLOW_THREADS;
-
- c_retval = virConnectGetCPUModelNames(conn, arch, &models, flags);
-
- LIBVIRT_END_ALLOW_THREADS;
-
- if (c_retval == -1)
- return VIR_PY_INT_FAIL;
-
- if ((rv = PyList_New(c_retval)) == NULL)
- goto error;
-
- for (i = 0; i < c_retval; i++) {
- PyObject *str;
- if ((str = PyString_FromString(models[i])) == NULL)
- goto error;
-
- PyList_SET_ITEM(rv, i, str);
- }
-
-done:
- if (models) {
- for (i = 0; i < c_retval; i++)
- VIR_FREE(models[i]);
- VIR_FREE(models);
- }
-
- return rv;
-
-error:
- Py_XDECREF(rv);
- rv = VIR_PY_INT_FAIL;
- goto done;
-}
-
static PyObject *
libvirt_virConnectGetLibVersion(PyObject *self ATTRIBUTE_UNUSED,
PyObject *args)
@@ -7228,7 +7176,6 @@ static PyMethodDef libvirtMethods[] = {
#include "libvirt-export.c"
{(char *) "virGetVersion", libvirt_virGetVersion, METH_VARARGS, NULL},
{(char *) "virConnectGetVersion", libvirt_virConnectGetVersion,
METH_VARARGS, NULL},
- {(char *) "virConnectGetCPUModelNames", libvirt_virConnectGetCPUModelNames,
METH_VARARGS, NULL},
{(char *) "virConnectGetLibVersion", libvirt_virConnectGetLibVersion,
METH_VARARGS, NULL},
{(char *) "virConnectOpenAuth", libvirt_virConnectOpenAuth, METH_VARARGS,
NULL},
{(char *) "virConnectListDomainsID", libvirt_virConnectListDomainsID,
METH_VARARGS, NULL},
diff --git a/python/libvirt-override.py b/python/libvirt-override.py
index 3471a43..ccfec48 100644
--- a/python/libvirt-override.py
+++ b/python/libvirt-override.py
@@ -207,14 +207,3 @@ def virEventAddTimeout(timeout, cb, opaque):
ret = libvirtmod.virEventAddTimeout(timeout, cbData)
if ret == -1: raise libvirtError ('virEventAddTimeout() failed')
return ret
-
-def getCPUModelNames(conn, arch, flags=0):
- """
- get the list of supported CPU models.
- @conn: virConnect connection
- @arch: Architecture
- @flags: extra flags; not used yet, so callers should always pass 0.
- """
- ret = libvirtmod.virConnectGetCPUModelNames(conn._o, arch, flags)
- if ret == None: raise libvirtError ('virConnectGetCPUModelNames() failed',
conn=self)
- return ret
--
1.8.3.2