diff options
-rwxr-xr-x | generator.py | 3 | ||||
-rw-r--r-- | libvirt-override-virDomain.py | 12 | ||||
-rw-r--r-- | libvirt-override.c | 97 | ||||
-rw-r--r-- | sanitytest.py | 2 |
4 files changed, 114 insertions, 0 deletions
diff --git a/generator.py b/generator.py index 05ec743..e7b4643 100755 --- a/generator.py +++ b/generator.py @@ -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", diff --git a/libvirt-override-virDomain.py b/libvirt-override-virDomain.py index c96cc5e..e61ad00 100644 --- a/libvirt-override-virDomain.py +++ b/libvirt-override-virDomain.py @@ -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 diff --git a/libvirt-override.c b/libvirt-override.c index 3fa9b9b..c4ac223 100644 --- a/libvirt-override.c +++ b/libvirt-override.c @@ -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} }; diff --git a/sanitytest.py b/sanitytest.py index cff30d5..62fe42b 100644 --- a/sanitytest.py +++ b/sanitytest.py @@ -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 |