mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
python-lvm: Small fixups to new create_lv_snapshot
Tabify Remove use of asize, unneeded. Don't initialize lvobj->parent_vgobj to NULL, the object ctor already zeroed everything on alloc. Redo call to lvm_lv_snapshot to use the liblvm snapshot implementation we went with. Add {}s to silence warning in lv_dealloc. Rename snapshot function for consistency. Update WHATS_NEW. Signed-off-by: Andy Grover <agrover@redhat.com>
This commit is contained in:
parent
0db733f18a
commit
58b61c252a
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.99 -
|
Version 2.02.99 -
|
||||||
===================================
|
===================================
|
||||||
|
Add LV snapshot support to liblvm and python-lvm.
|
||||||
Avoid a global lock in pvs when lvmetad is in use.
|
Avoid a global lock in pvs when lvmetad is in use.
|
||||||
Fix crash in pvscan --cache -aay triggered by non-mda PV.
|
Fix crash in pvscan --cache -aay triggered by non-mda PV.
|
||||||
Allow lvconvert --stripes/stripesize only with --mirrors/--repair/--thinpool.
|
Allow lvconvert --stripes/stripesize only with --mirrors/--repair/--thinpool.
|
||||||
|
@ -897,8 +897,9 @@ static void
|
|||||||
liblvm_lv_dealloc(lvobject *self)
|
liblvm_lv_dealloc(lvobject *self)
|
||||||
{
|
{
|
||||||
/* We can dealloc an object that didn't get fully created */
|
/* We can dealloc an object that didn't get fully created */
|
||||||
if (self->parent_vgobj)
|
if (self->parent_vgobj) {
|
||||||
Py_DECREF(self->parent_vgobj);
|
Py_DECREF(self->parent_vgobj);
|
||||||
|
}
|
||||||
PyObject_Del(self);
|
PyObject_Del(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1313,38 +1314,28 @@ liblvm_lvm_lv_list_lvsegs(lvobject *self)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static PyObject *
|
static PyObject *
|
||||||
liblvm_lvm_vg_create_lv_snapshot(lvobject *self, PyObject *args)
|
liblvm_lvm_lv_snapshot(lvobject *self, PyObject *args)
|
||||||
{
|
{
|
||||||
const char *vgname;
|
const char *vgname;
|
||||||
uint64_t size;
|
uint64_t size;
|
||||||
unsigned long asize;
|
|
||||||
lvobject *lvobj;
|
lvobject *lvobj;
|
||||||
vgobject *vgobj;
|
|
||||||
const char *selfname = NULL;
|
|
||||||
|
|
||||||
LV_VALID(self);
|
LV_VALID(self);
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(args, "sl", &vgname, &asize)) {
|
if (!PyArg_ParseTuple(args, "sl", &vgname, &size)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
size = asize;
|
|
||||||
|
|
||||||
if ((lvobj = PyObject_New(lvobject, &LibLVMlvType)) == NULL)
|
if ((lvobj = PyObject_New(lvobject, &LibLVMlvType)) == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Initialize the parent ptr in case lv create fails and we dealloc lvobj */
|
if ((lvobj->lv = lvm_lv_snapshot(self->lv, vgname, size)) == NULL) {
|
||||||
lvobj->parent_vgobj = NULL;
|
|
||||||
|
|
||||||
selfname = lvm_lv_get_name(self->lv);
|
|
||||||
vgobj = self->parent_vgobj;
|
|
||||||
if ((lvobj->lv = lvm_vg_create_lv_snapshot(vgobj->vg, selfname,
|
|
||||||
vgname, size)) == NULL) {
|
|
||||||
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
|
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
|
||||||
Py_DECREF(lvobj);
|
Py_DECREF(lvobj);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
lvobj->parent_vgobj = vgobj;
|
lvobj->parent_vgobj = self->parent_vgobj;
|
||||||
Py_INCREF(lvobj->parent_vgobj);
|
Py_INCREF(lvobj->parent_vgobj);
|
||||||
|
|
||||||
return (PyObject *)lvobj;
|
return (PyObject *)lvobj;
|
||||||
@ -1618,7 +1609,7 @@ static PyMethodDef liblvm_lv_methods[] = {
|
|||||||
{ "rename", (PyCFunction)liblvm_lvm_lv_rename, METH_VARARGS },
|
{ "rename", (PyCFunction)liblvm_lvm_lv_rename, METH_VARARGS },
|
||||||
{ "resize", (PyCFunction)liblvm_lvm_lv_resize, METH_VARARGS },
|
{ "resize", (PyCFunction)liblvm_lvm_lv_resize, METH_VARARGS },
|
||||||
{ "listLVsegs", (PyCFunction)liblvm_lvm_lv_list_lvsegs, METH_NOARGS },
|
{ "listLVsegs", (PyCFunction)liblvm_lvm_lv_list_lvsegs, METH_NOARGS },
|
||||||
{ "snapshot", (PyCFunction)liblvm_lvm_vg_create_lv_snapshot, METH_VARARGS },
|
{ "snapshot", (PyCFunction)liblvm_lvm_lv_snapshot, METH_VARARGS },
|
||||||
{ NULL, NULL} /* sentinel */
|
{ NULL, NULL} /* sentinel */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user