summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorTony Asleson <tasleson@redhat.com>2013-06-06 16:41:35 -0400
committerTony Asleson <tasleson@redhat.com>2013-07-02 14:24:34 -0500
commit8882480083f9b4f769cc8756a2f641ae0452040d (patch)
treea06dc6dd73b67ffddd8213872262aea334a0fb8a /python
parent49e3eecc33dbe0a47d8dcdbf225ddd52a8a6b75d (diff)
downloadlvm2-8882480083f9b4f769cc8756a2f641ae0452040d.tar.gz
python-lvm: Change snapshot call impl.
Using the new object parameter creation to create the snapshot. Signed-off-by: Tony Asleson <tasleson@redhat.com>
Diffstat (limited to 'python')
-rw-r--r--python/liblvm.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/python/liblvm.c b/python/liblvm.c
index e631ab131..e696a8107 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -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;