mirror of
https://gitlab.com/libvirt/libvirt-python.git
synced 2025-07-10 00:59:41 +03:00
override: add virDomainFSFreeze and virDomainFSThaw API
Add binding for the new virDomainFSFreeze and virDomainFSThaw functions added in libvirt 1.2.5. These require override since these take a list of mountpoints path string. The methods are named 'fsFreeze' and 'fsThaw'. Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
committed by
Michal Privoznik
parent
e8e1de7f1f
commit
c5bbd5bd9d
@ -517,6 +517,9 @@ skip_function = (
|
||||
'virDomainCreateXMLWithFiles', # overridden in virConnect.py
|
||||
'virDomainCreateWithFiles', # overridden in virDomain.py
|
||||
|
||||
'virDomainFSFreeze', # overridden in virDomain.py
|
||||
'virDomainFSThaw', # overridden in virDomain.py
|
||||
|
||||
# 'Ref' functions have no use for bindings users.
|
||||
"virConnectRef",
|
||||
"virDomainRef",
|
||||
|
@ -47,3 +47,15 @@
|
||||
ret = libvirtmod.virDomainCreateWithFiles(self._o, files, flags)
|
||||
if ret == -1: raise libvirtError ('virDomainCreateWithFiles() failed', dom=self)
|
||||
return ret
|
||||
|
||||
def fsFreeze(self, mountpoints=None, flags=0):
|
||||
"""Freeze specified filesystems within the guest """
|
||||
ret = libvirtmod.virDomainFSFreeze(self._o, mountpoints, flags)
|
||||
if ret == -1: raise libvirtError ('virDomainFSFreeze() failed', dom=self)
|
||||
return ret
|
||||
|
||||
def fsThaw(self, mountpoints=None, flags=0):
|
||||
"""Thaw specified filesystems within the guest """
|
||||
ret = libvirtmod.virDomainFSThaw(self._o, mountpoints, flags)
|
||||
if ret == -1: raise libvirtError ('virDomainFSThaw() failed', dom=self)
|
||||
return ret
|
||||
|
@ -7554,6 +7554,99 @@ cleanup:
|
||||
#endif /* LIBVIR_CHECK_VERSION(1, 1, 1) */
|
||||
|
||||
|
||||
#if LIBVIR_CHECK_VERSION(1, 2, 5)
|
||||
static PyObject *
|
||||
libvirt_virDomainFSFreeze(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
PyObject *py_retval = NULL;
|
||||
int c_retval;
|
||||
virDomainPtr domain;
|
||||
PyObject *pyobj_domain;
|
||||
PyObject *pyobj_list;
|
||||
unsigned int flags;
|
||||
unsigned int nmountpoints = 0;
|
||||
char **mountpoints = NULL;
|
||||
size_t i = 0, j;
|
||||
|
||||
if (!PyArg_ParseTuple(args, (char *)"OOi:virDomainFSFreeze",
|
||||
&pyobj_domain, &pyobj_list, &flags))
|
||||
return NULL;
|
||||
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
|
||||
|
||||
if (PyList_Check(pyobj_list)) {
|
||||
nmountpoints = PyList_Size(pyobj_list);
|
||||
|
||||
if (VIR_ALLOC_N(mountpoints, nmountpoints) < 0)
|
||||
return PyErr_NoMemory();
|
||||
|
||||
for (i = 0; i < nmountpoints; i++) {
|
||||
if (libvirt_charPtrUnwrap(PyList_GetItem(pyobj_list, i),
|
||||
mountpoints+i) < 0 ||
|
||||
mountpoints[i] == NULL)
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||
c_retval = virDomainFSFreeze(domain, (const char **) mountpoints,
|
||||
nmountpoints, flags);
|
||||
LIBVIRT_END_ALLOW_THREADS;
|
||||
|
||||
py_retval = libvirt_intWrap(c_retval);
|
||||
|
||||
cleanup:
|
||||
for (j = 0 ; j < i ; j++)
|
||||
VIR_FREE(mountpoints[j]);
|
||||
VIR_FREE(mountpoints);
|
||||
return py_retval;
|
||||
}
|
||||
|
||||
|
||||
static PyObject *
|
||||
libvirt_virDomainFSThaw(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) {
|
||||
PyObject *py_retval = NULL;
|
||||
int c_retval;
|
||||
virDomainPtr domain;
|
||||
PyObject *pyobj_domain;
|
||||
PyObject *pyobj_list;
|
||||
unsigned int flags;
|
||||
unsigned int nmountpoints = 0;
|
||||
char **mountpoints = NULL;
|
||||
size_t i = 0, j;
|
||||
|
||||
if (!PyArg_ParseTuple(args, (char *)"OOi:virDomainFSThaw",
|
||||
&pyobj_domain, &pyobj_list, &flags))
|
||||
return NULL;
|
||||
domain = (virDomainPtr) PyvirDomain_Get(pyobj_domain);
|
||||
|
||||
if (PyList_Check(pyobj_list)) {
|
||||
nmountpoints = PyList_Size(pyobj_list);
|
||||
|
||||
if (VIR_ALLOC_N(mountpoints, nmountpoints) < 0)
|
||||
return PyErr_NoMemory();
|
||||
|
||||
for (i = 0; i < nmountpoints; i++) {
|
||||
if (libvirt_charPtrUnwrap(PyList_GetItem(pyobj_list, i),
|
||||
mountpoints+i) < 0 ||
|
||||
mountpoints[i] == NULL)
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
LIBVIRT_BEGIN_ALLOW_THREADS;
|
||||
c_retval = virDomainFSThaw(domain, (const char **) mountpoints,
|
||||
nmountpoints, flags);
|
||||
LIBVIRT_END_ALLOW_THREADS;
|
||||
|
||||
py_retval = libvirt_intWrap(c_retval);
|
||||
|
||||
cleanup:
|
||||
for (j = 0 ; j < i ; j++)
|
||||
VIR_FREE(mountpoints[j]);
|
||||
VIR_FREE(mountpoints);
|
||||
return py_retval;
|
||||
}
|
||||
#endif /* LIBVIR_CHECK_VERSION(1, 2, 5) */
|
||||
|
||||
/************************************************************************
|
||||
* *
|
||||
* The registration stuff *
|
||||
@ -7729,6 +7822,10 @@ static PyMethodDef libvirtMethods[] = {
|
||||
{(char *) "virDomainCreateXMLWithFiles", libvirt_virDomainCreateXMLWithFiles, METH_VARARGS, NULL},
|
||||
{(char *) "virDomainCreateWithFiles", libvirt_virDomainCreateWithFiles, METH_VARARGS, NULL},
|
||||
#endif /* LIBVIR_CHECK_VERSION(1, 1, 1) */
|
||||
#if LIBVIR_CHECK_VERSION(1, 2, 5)
|
||||
{(char *) "virDomainFSFreeze", libvirt_virDomainFSFreeze, METH_VARARGS, NULL},
|
||||
{(char *) "virDomainFSThaw", libvirt_virDomainFSThaw, METH_VARARGS, NULL},
|
||||
#endif /* LIBVIR_CHECK_VERSION(1, 2, 5) */
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
|
@ -207,6 +207,8 @@ for name in sorted(basicklassmap):
|
||||
func = func[0:1].lower() + func[1:]
|
||||
if func[0:8] == "nWFilter":
|
||||
func = "nwfilter" + func[8:]
|
||||
if func[0:8] == "fSFreeze" or func[0:6] == "fSThaw":
|
||||
func = "fs" + func[2:]
|
||||
|
||||
# ...except when they don't. More stupid naming
|
||||
# decisions we can't fix
|
||||
|
Reference in New Issue
Block a user