1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvm2app: No special behavior for 0 for max_snap_size in lvm_lv_snapshot()

It isn't possible to choose a sane default for snapshot size, so just
play it straight and use the passed size instead of adding special
behavior for 0.

Also revert change to Python lib, size parameter must be supplied.

Signed-off-by: Andy Grover <agrover@redhat.com>
This commit is contained in:
Andy Grover 2012-12-17 14:14:38 -08:00
parent 69099e7ef5
commit 86e528c667
2 changed files with 3 additions and 12 deletions

View File

@ -326,17 +326,8 @@ lv_t lvm_lv_snapshot(const lv_t lv, const char *snap_name, uint64_t max_snap_siz
if (!vg_check_write_mode(lv->vg)) if (!vg_check_write_mode(lv->vg))
return NULL; return NULL;
/* Determine the correct size */
if (0 == max_snap_size){
size = lv->size;
} else {
size = max_snap_size >> SECTOR_SHIFT; size = max_snap_size >> SECTOR_SHIFT;
if (size > lv->size) {
size = lv->size;
}
}
if (!(extents = extents_from_size(lv->vg->cmd, size, if (!(extents = extents_from_size(lv->vg->cmd, size,
lv->vg->extent_size))) { lv->vg->extent_size))) {
log_error("Unable to create LV snapshot without size."); log_error("Unable to create LV snapshot without size.");

View File

@ -1317,12 +1317,12 @@ static PyObject *
liblvm_lvm_lv_snapshot(lvobject *self, PyObject *args) liblvm_lvm_lv_snapshot(lvobject *self, PyObject *args)
{ {
const char *vgname; const char *vgname;
uint64_t size = 0; uint64_t size;
lvobject *lvobj; lvobject *lvobj;
LV_VALID(self); LV_VALID(self);
if (!PyArg_ParseTuple(args, "s|l", &vgname, &size)) { if (!PyArg_ParseTuple(args, "sl", &vgname, &size)) {
return NULL; return NULL;
} }