1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 10:25:13 +03:00

python-lvm: Change snapshot call impl.

Using the new object parameter creation to create the snapshot.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
This commit is contained in:
Tony Asleson 2013-06-06 16:41:35 -04:00
parent 49e3eecc33
commit 8882480083

View File

@ -1582,23 +1582,33 @@ liblvm_lvm_lv_list_lvsegs(lvobject *self)
static PyObject *
liblvm_lvm_lv_snapshot(lvobject *self, PyObject *args)
{
const char *vgname;
uint64_t size;
const char *snap_name;
uint64_t size = 0;
lvobject *lvobj;
lv_create_params_t lvp = NULL;
LV_VALID(self);
if (!PyArg_ParseTuple(args, "sl", &vgname, &size)) {
if (!PyArg_ParseTuple(args, "s|K", &snap_name, &size)) {
return NULL;
}
if ((lvobj = PyObject_New(lvobject, &LibLVMlvType)) == NULL)
return NULL;
if ((lvobj->lv = lvm_lv_snapshot(self->lv, vgname, size)) == NULL) {
lvobj->parent_vgobj = NULL;
lvp = lvm_lv_params_create_snapshot(self->lv, snap_name, size);
if (lvp) {
if ((lvobj->lv = lvm_lv_create(lvp)) == NULL) {
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
Py_DECREF(lvobj);
return NULL;
}
} else {
PyErr_SetObject(LibLVMError, liblvm_get_last_error());
Py_DECREF(lvobj);
return NULL;
Py_DECREF(lvobj);
return NULL;
}
lvobj->parent_vgobj = self->parent_vgobj;