master - metadata.c: Call refactored vgreduce_single
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5074dcc8966814...
Commit: 5074dcc896681494309c59830803b54a84429fd0
Parent: fe474e1452866476b7f17175d92417d6d827ae4c
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Sep 3 18:07:43 2013 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Tue Nov 19 14:40:30 2013 -0600
metadata.c: Call refactored vgreduce_single
Replace the code with the refactored vgreduce_single instead
of calling its own implementation.
Corrects bug: https://bugzilla.redhat.com/show_bug.cgi?id=989174
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
lib/metadata/metadata-exported.h | 2 +-
lib/metadata/metadata.c | 35 ++++++-----------------------------
lib/metadata/vg.c | 37 ++++++++++++++++++++++---------------
tools/vgreduce.c | 2 +-
4 files changed, 30 insertions(+), 46 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index cac5b3c..7429241 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -594,7 +594,7 @@ int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names
int vg_reduce(struct volume_group *vg, const char *pv_name);
int vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
- struct physical_volume *pv);
+ struct physical_volume *pv, int commit);
int vg_change_tag(struct volume_group *vg, const char *tag, int add_tag);
int vg_split_mdas(struct cmd_context *cmd, struct volume_group *vg_from,
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 398def6..7177ff0 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -691,50 +691,27 @@ int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names
return 1;
}
-/* FIXME: use this inside vgreduce_single? */
int vg_reduce(struct volume_group *vg, const char *pv_name)
{
struct physical_volume *pv;
struct pv_list *pvl;
- if (_vg_bad_status_bits(vg, RESIZEABLE_VG))
- return 0;
-
- if (!archive(vg))
- goto bad;
-
- /* remove each pv */
if (!(pvl = find_pv_in_vg(vg, pv_name))) {
log_error("Physical volume %s not in volume group %s.",
pv_name, vg->name);
- goto bad;
+ return 0;
}
pv = pvl->pv;
- if (pv_pe_alloc_count(pv)) {
- log_error("Physical volume %s still in use.",
- pv_name);
- goto bad;
- }
-
- if (!dev_get_size(pv_dev(pv), &pv->size)) {
- log_error("%s: Couldn't get size.", pv_name);
- goto bad;
+ if (vgreduce_single(vg->cmd, vg, pv, 0)) {
+ dm_list_add(&vg->removed_pvs, &pvl->list);
+ return 1;
}
- vg->free_count -= pv_pe_count(pv) - pv_pe_alloc_count(pv);
- vg->extent_count -= pv_pe_count(pv);
- del_pvl_from_vgs(vg, pvl);
-
- /* add pv to the remove_pvs list */
- dm_list_add(&vg->removed_pvs, &pvl->list);
-
- return 1;
-
- bad:
log_error("Unable to remove physical volume '%s' from "
- "volume group '%s'.", pv_name, vg->name);
+ "volume group '%s'.", pv_name, vg->name);
+
return 0;
}
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index 20b4b4d..877371e 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -576,7 +576,7 @@ char *vg_attr_dup(struct dm_pool *mem, const struct volume_group *vg)
}
int vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
- struct physical_volume *pv)
+ struct physical_volume *pv, int commit)
{
struct pv_list *pvl;
struct volume_group *orphan_vg = NULL;
@@ -637,25 +637,32 @@ int vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
goto bad;
}
- if (!vg_write(vg) || !vg_commit(vg)) {
- log_error("Removal of physical volume \"%s\" from "
- "\"%s\" failed", name, vg->name);
- goto bad;
- }
+ /*
+ * Only write out the needed changes if so requested by caller.
+ */
+ if (commit) {
+ if (!vg_write(vg) || !vg_commit(vg)) {
+ log_error("Removal of physical volume \"%s\" from "
+ "\"%s\" failed", name, vg->name);
+ goto bad;
+ }
- if (!pv_write(cmd, pv, 0)) {
- log_error("Failed to clear metadata from physical "
- "volume \"%s\" "
- "after removal from \"%s\"", name, vg->name);
- goto bad;
- }
+ if (!pv_write(cmd, pv, 0)) {
+ log_error("Failed to clear metadata from physical "
+ "volume \"%s\" "
+ "after removal from \"%s\"", name, vg->name);
+ goto bad;
+ }
- backup(vg);
+ backup(vg);
- log_print_unless_silent("Removed \"%s\" from volume group \"%s\"", name, vg->name);
+ log_print_unless_silent("Removed \"%s\" from volume group \"%s\"",
+ name, vg->name);
+ }
r = 1;
bad:
- if (pvl)
+ /* If we are committing here or we had an error then we will free fid */
+ if (pvl && (commit || r != 1))
free_pv_fid(pvl->pv);
unlock_and_release_vg(cmd, orphan_vg, VG_ORPHANS);
return r;
diff --git a/tools/vgreduce.c b/tools/vgreduce.c
index 534a4fb..0ade4fa 100644
--- a/tools/vgreduce.c
+++ b/tools/vgreduce.c
@@ -125,7 +125,7 @@ static int _vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
struct physical_volume *pv,
void *handle __attribute__((unused)))
{
- int r = vgreduce_single(cmd, vg, pv);
+ int r = vgreduce_single(cmd, vg, pv, 1);
if (!r)
return ECMD_FAILED;
10 years, 5 months
master - vgreduce: Move _vgreduce_single functionality
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fe474e14528664...
Commit: fe474e1452866476b7f17175d92417d6d827ae4c
Parent: 20ffb0f721e72fb25905e9ae77689e901babf4ce
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Sep 3 17:31:45 2013 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Tue Nov 19 14:40:28 2013 -0600
vgreduce: Move _vgreduce_single functionality
Moving the core functionality of vgreduce single into
lib/metadata/vg.c so that the command line and lvm2app library
can call the same core functionality. New function is
vgreduce_single.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
lib/metadata/metadata-exported.h | 4 ++
lib/metadata/vg.c | 87 ++++++++++++++++++++++++++++++++++++++
tools/vgreduce.c | 81 ++---------------------------------
3 files changed, 95 insertions(+), 77 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 1bf5236..cac5b3c 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -592,6 +592,10 @@ int vg_rename(struct cmd_context *cmd, struct volume_group *vg,
int vg_extend(struct volume_group *vg, int pv_count, const char *const *pv_names,
struct pvcreate_params *pp);
int vg_reduce(struct volume_group *vg, const char *pv_name);
+
+int vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
+ struct physical_volume *pv);
+
int vg_change_tag(struct volume_group *vg, const char *tag, int add_tag);
int vg_split_mdas(struct cmd_context *cmd, struct volume_group *vg_from,
struct volume_group *vg_to);
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index 476292e..20b4b4d 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -19,6 +19,7 @@
#include "activate.h"
#include "toolcontext.h"
#include "lvmcache.h"
+#include "archiver.h"
struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
const char *vg_name)
@@ -573,3 +574,89 @@ char *vg_attr_dup(struct dm_pool *mem, const struct volume_group *vg)
repstr[5] = (vg_is_clustered(vg)) ? 'c' : '-';
return repstr;
}
+
+int vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
+ struct physical_volume *pv)
+{
+ struct pv_list *pvl;
+ struct volume_group *orphan_vg = NULL;
+ int r = 0;
+ const char *name = pv_dev_name(pv);
+
+ if (!vg) {
+ log_error(INTERNAL_ERROR "VG is NULL.");
+ return r;
+ }
+
+ if (pv_pe_alloc_count(pv)) {
+ log_error("Physical volume \"%s\" still in use", name);
+ return r;
+ }
+
+ if (vg->pv_count == 1) {
+ log_error("Can't remove final physical volume \"%s\" from "
+ "volume group \"%s\"", name, vg->name);
+ return r;
+ }
+
+ if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
+ log_error("Can't get lock for orphan PVs");
+ return r;
+ }
+
+ pvl = find_pv_in_vg(vg, name);
+
+ if (!archive(vg))
+ goto_bad;
+
+ log_verbose("Removing \"%s\" from volume group \"%s\"", name, vg->name);
+
+ if (pvl)
+ del_pvl_from_vgs(vg, pvl);
+
+ pv->vg_name = vg->fid->fmt->orphan_vg_name;
+ pv->status = ALLOCATABLE_PV;
+
+ if (!dev_get_size(pv_dev(pv), &pv->size)) {
+ log_error("%s: Couldn't get size.", pv_dev_name(pv));
+ goto bad;
+ }
+
+ vg->free_count -= pv_pe_count(pv) - pv_pe_alloc_count(pv);
+ vg->extent_count -= pv_pe_count(pv);
+
+ orphan_vg = vg_read_for_update(cmd, vg->fid->fmt->orphan_vg_name,
+ NULL, 0);
+
+ if (vg_read_error(orphan_vg))
+ goto bad;
+
+ if (!vg_split_mdas(cmd, vg, orphan_vg) || !vg->pv_count) {
+ log_error("Cannot remove final metadata area on \"%s\" from \"%s\"",
+ name, vg->name);
+ goto bad;
+ }
+
+ if (!vg_write(vg) || !vg_commit(vg)) {
+ log_error("Removal of physical volume \"%s\" from "
+ "\"%s\" failed", name, vg->name);
+ goto bad;
+ }
+
+ if (!pv_write(cmd, pv, 0)) {
+ log_error("Failed to clear metadata from physical "
+ "volume \"%s\" "
+ "after removal from \"%s\"", name, vg->name);
+ goto bad;
+ }
+
+ backup(vg);
+
+ log_print_unless_silent("Removed \"%s\" from volume group \"%s\"", name, vg->name);
+ r = 1;
+bad:
+ if (pvl)
+ free_pv_fid(pvl->pv);
+ unlock_and_release_vg(cmd, orphan_vg, VG_ORPHANS);
+ return r;
+}
diff --git a/tools/vgreduce.c b/tools/vgreduce.c
index 8803899..534a4fb 100644
--- a/tools/vgreduce.c
+++ b/tools/vgreduce.c
@@ -125,88 +125,15 @@ static int _vgreduce_single(struct cmd_context *cmd, struct volume_group *vg,
struct physical_volume *pv,
void *handle __attribute__((unused)))
{
- struct pv_list *pvl;
- struct volume_group *orphan_vg = NULL;
- int r = ECMD_FAILED;
- const char *name = pv_dev_name(pv);
-
- if (!vg) {
- log_error(INTERNAL_ERROR "VG is NULL.");
- return ECMD_FAILED;
- }
+ int r = vgreduce_single(cmd, vg, pv);
- if (pv_pe_alloc_count(pv)) {
- log_error("Physical volume \"%s\" still in use", name);
- return ECMD_FAILED;
- }
-
- if (vg->pv_count == 1) {
- log_error("Can't remove final physical volume \"%s\" from "
- "volume group \"%s\"", name, vg->name);
+ if (!r)
return ECMD_FAILED;
- }
-
- if (!lock_vol(cmd, VG_ORPHANS, LCK_VG_WRITE, NULL)) {
- log_error("Can't get lock for orphan PVs");
- return ECMD_FAILED;
- }
-
- pvl = find_pv_in_vg(vg, name);
-
- if (!archive(vg))
- goto_bad;
-
- log_verbose("Removing \"%s\" from volume group \"%s\"", name, vg->name);
- if (pvl)
- del_pvl_from_vgs(vg, pvl);
-
- pv->vg_name = vg->fid->fmt->orphan_vg_name;
- pv->status = ALLOCATABLE_PV;
-
- if (!dev_get_size(pv_dev(pv), &pv->size)) {
- log_error("%s: Couldn't get size.", pv_dev_name(pv));
- goto bad;
- }
-
- vg->free_count -= pv_pe_count(pv) - pv_pe_alloc_count(pv);
- vg->extent_count -= pv_pe_count(pv);
-
- orphan_vg = vg_read_for_update(cmd, vg->fid->fmt->orphan_vg_name,
- NULL, 0);
-
- if (vg_read_error(orphan_vg))
- goto bad;
-
- if (!vg_split_mdas(cmd, vg, orphan_vg) || !vg->pv_count) {
- log_error("Cannot remove final metadata area on \"%s\" from \"%s\"",
- name, vg->name);
- goto bad;
- }
-
- if (!vg_write(vg) || !vg_commit(vg)) {
- log_error("Removal of physical volume \"%s\" from "
- "\"%s\" failed", name, vg->name);
- goto bad;
- }
-
- if (!pv_write(cmd, pv, 0)) {
- log_error("Failed to clear metadata from physical "
- "volume \"%s\" "
- "after removal from \"%s\"", name, vg->name);
- goto bad;
- }
+ return ECMD_PROCESSED;
+}
- backup(vg);
- log_print_unless_silent("Removed \"%s\" from volume group \"%s\"", name, vg->name);
- r = ECMD_PROCESSED;
-bad:
- if (pvl)
- free_pv_fid(pvl->pv);
- unlock_and_release_vg(cmd, orphan_vg, VG_ORPHANS);
- return r;
-}
int vgreduce(struct cmd_context *cmd, int argc, char **argv)
{
10 years, 5 months
master - python-lvm: Ensure library handle is correct after python gc() call
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=20ffb0f721e72f...
Commit: 20ffb0f721e72fb25905e9ae77689e901babf4ce
Parent: 1f744733a15fe56404dbd0c4d8e1aab339fef774
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Jul 31 15:16:01 2013 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Tue Nov 19 14:40:27 2013 -0600
python-lvm: Ensure library handle is correct after python gc() call
In a previous commit we added the ability for the library to do garbage
collection, to free all the memory used by the library handle buffer by closing
and re-opening the library handle. When we introduced this functionality we
also opened up the opportunity that the user of the python bindings to have
an object that references the old library handle. In this case if the user
tried to use the old object a segmentation fault could occur because the
memory had been previously freed.
This patch tries to mitigate this by storing a copy of the library handle that
was used when the object was created so that it can compare the current in
use pointer with what existed when the object was created. In the case where
they match the operation is permitted to continue, otherwise an exception is
throw, thus avoiding a segmentation fault.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
python/liblvm.c | 219 ++++++++++++++++++++++++++-----------------------------
1 files changed, 103 insertions(+), 116 deletions(-)
diff --git a/python/liblvm.c b/python/liblvm.c
index 42a327e..36b64e4 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -30,11 +30,13 @@ static lvm_t _libh;
typedef struct {
PyObject_HEAD
vg_t vg; /* vg handle */
+ lvm_t libh_copy;
} vgobject;
typedef struct {
PyObject_HEAD
struct dm_list *pvslist;
+ lvm_t libh_copy;
} pvslistobject;
typedef struct {
@@ -71,9 +73,14 @@ static PyTypeObject _LibLVMpvsegType;
static PyObject *_LibLVMError;
-#define LVM_VALID() \
+#define LVM_VALID(ptr) \
do { \
- if (!_libh) { \
+ if (ptr && _libh) { \
+ if (ptr != _libh) { \
+ PyErr_SetString(PyExc_UnboundLocalError, "LVM handle reference stale"); \
+ return NULL; \
+ } \
+ } else if (!_libh) { \
PyErr_SetString(PyExc_UnboundLocalError, "LVM handle invalid"); \
return NULL; \
} \
@@ -99,17 +106,42 @@ static vgobject *_create_py_vg(void)
{
vgobject *vgobj = PyObject_New(vgobject, &_LibLVMvgType);
- if (vgobj)
+ if (vgobj) {
vgobj->vg = NULL;
+ vgobj->libh_copy = _libh;
+ }
return vgobj;
}
+static pvslistobject *_create_py_pvlist(void)
+{
+ pvslistobject *pvlistobj = PyObject_New(pvslistobject, &_LibLVMpvlistType);
+
+ if (pvlistobj) {
+ pvlistobj->pvslist = NULL;
+ pvlistobj->libh_copy = _libh;
+ }
+
+ return pvlistobj;
+}
+
+static lvobject *_create_py_lv(vgobject *parent, lv_t lv)
+{
+ lvobject * lvobj = PyObject_New(lvobject, &_LibLVMlvType);
+ if (lvobj) {
+ lvobj->parent_vgobj = parent;
+ Py_INCREF(lvobj->parent_vgobj);
+ lvobj->lv = lv;
+ }
+ return lvobj;
+}
+
static PyObject *_liblvm_get_last_error(void)
{
PyObject *info;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!(info = PyTuple_New(2)))
return NULL;
@@ -122,7 +154,7 @@ static PyObject *_liblvm_get_last_error(void)
static PyObject *_liblvm_library_get_version(void)
{
- LVM_VALID();
+ LVM_VALID(NULL);
return Py_BuildValue("s", lvm_library_get_version());
}
@@ -131,7 +163,7 @@ static const char _gc_doc[] = "Garbage collect the C library";
static PyObject *_liblvm_lvm_gc(void)
{
- LVM_VALID();
+ LVM_VALID(NULL);
lvm_quit(_libh);
@@ -152,7 +184,7 @@ static PyObject *_liblvm_lvm_list_vg_names(void)
PyObject * pytuple;
int i = 0;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!(vgnames = lvm_list_vg_names(_libh))) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
@@ -177,7 +209,7 @@ static PyObject *_liblvm_lvm_list_vg_uuids(void)
PyObject * pytuple;
int i = 0;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!(uuids = lvm_list_vg_uuids(_libh))) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
@@ -261,23 +293,16 @@ static PyObject *_liblvm_pvlist_dealloc(pvslistobject *self)
static PyObject *_liblvm_lvm_list_pvs(void)
{
- pvslistobject *pvslistobj;
-
- LVM_VALID();
-
- if (!(pvslistobj = PyObject_New(pvslistobject, &_LibLVMpvlistType)))
- return NULL;
+ LVM_VALID(NULL);
- pvslistobj->pvslist = NULL;
-
- return (PyObject *)pvslistobj;
+ return (PyObject *)_create_py_pvlist();
}
static PyObject *_liblvm_lvm_pv_remove(PyObject *self, PyObject *arg)
{
const char *pv_name;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!PyArg_ParseTuple(arg, "s", &pv_name))
return NULL;
@@ -297,7 +322,7 @@ static PyObject *_liblvm_lvm_pv_create(PyObject *self, PyObject *arg)
const char *pv_name;
unsigned long long size;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!PyArg_ParseTuple(arg, "sK", &pv_name, &size))
return NULL;
@@ -317,7 +342,7 @@ static PyObject *_liblvm_lvm_percent_to_float(PyObject *self, PyObject *arg)
double converted;
int percent;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!PyArg_ParseTuple(arg, "i", &percent))
return NULL;
@@ -332,7 +357,7 @@ static PyObject *_liblvm_lvm_vgname_from_pvid(PyObject *self, PyObject *arg)
const char *pvid;
const char *vgname;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!PyArg_ParseTuple(arg, "s", &pvid))
return NULL;
@@ -350,7 +375,7 @@ static PyObject *_liblvm_lvm_vgname_from_device(PyObject *self, PyObject *arg)
const char *device;
const char *vgname;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!PyArg_ParseTuple(arg, "s", &device))
return NULL;
@@ -370,7 +395,7 @@ static PyObject *_liblvm_lvm_config_find_bool(PyObject *self, PyObject *arg)
int rval;
PyObject *rc;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!PyArg_ParseTuple(arg, "s", &config))
return NULL;
@@ -390,7 +415,7 @@ static PyObject *_liblvm_lvm_config_find_bool(PyObject *self, PyObject *arg)
static PyObject *_liblvm_lvm_config_reload(void)
{
- LVM_VALID();
+ LVM_VALID(NULL);
if (lvm_config_reload(_libh) == -1) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
@@ -405,7 +430,7 @@ static PyObject *_liblvm_lvm_config_reload(void)
static PyObject *_liblvm_lvm_scan(void)
{
- LVM_VALID();
+ LVM_VALID(NULL);
if (lvm_scan(_libh) == -1) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
@@ -421,7 +446,7 @@ static PyObject *_liblvm_lvm_config_override(PyObject *self, PyObject *arg)
{
const char *config;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!PyArg_ParseTuple(arg, "s", &config))
return NULL;
@@ -447,7 +472,7 @@ static PyObject *_liblvm_lvm_vg_open(PyObject *self, PyObject *args)
vgobject *vgobj;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!PyArg_ParseTuple(args, "s|s", &vgname, &mode))
return NULL;
@@ -472,7 +497,7 @@ static PyObject *_liblvm_lvm_vg_create(PyObject *self, PyObject *args)
const char *vgname;
vgobject *vgobj;
- LVM_VALID();
+ LVM_VALID(NULL);
if (!PyArg_ParseTuple(args, "s", &vgname))
return NULL;
@@ -495,6 +520,7 @@ static void liblvm_vg_dealloc(vgobject *self)
if (self->vg != NULL) {
lvm_vg_close(self->vg);
self->vg = NULL;
+ self->libh_copy = NULL;
}
PyObject_Del(self);
@@ -504,20 +530,20 @@ static void liblvm_vg_dealloc(vgobject *self)
#define VG_VALID(vgobject) \
do { \
- LVM_VALID(); \
- if (!vgobject->vg) { \
+ if (!vgobject || !vgobject->vg) { \
PyErr_SetString(PyExc_UnboundLocalError, "VG object invalid"); \
return NULL; \
} \
+ LVM_VALID(vgobject->libh_copy); \
} while (0)
#define PVSLIST_VALID(pvslistobject) \
do { \
- LVM_VALID(); \
- if (!pvslistobject->pvslist) { \
+ if (!pvslistobject || !pvslistobject->pvslist) { \
PyErr_SetString(PyExc_UnboundLocalError, "PVS object invalid"); \
return NULL; \
} \
+ LVM_VALID(pvslistobject->libh_copy); \
} while (0)
static PyObject *_liblvm_lvm_vg_close(vgobject *self)
@@ -526,6 +552,7 @@ static PyObject *_liblvm_lvm_vg_close(vgobject *self)
if (self->vg) {
lvm_vg_close(self->vg);
self->vg = NULL;
+ self->libh_copy = NULL;
}
Py_INCREF(Py_None);
@@ -941,15 +968,11 @@ static PyObject *_liblvm_lvm_vg_list_lvs(vgobject *self)
dm_list_iterate_items(lvl, lvs) {
/* Create and initialize the object */
- if (!(lvobj = PyObject_New(lvobject, &_LibLVMlvType))) {
+ if (!(lvobj = _create_py_lv(self, lvl->lv))) {
Py_DECREF(pytuple);
return NULL;
}
- lvobj->parent_vgobj = self;
- Py_INCREF(lvobj->parent_vgobj);
-
- lvobj->lv = lvl->lv;
PyTuple_SET_ITEM(pytuple, i, (PyObject *) lvobj);
i++;
}
@@ -986,29 +1009,19 @@ static PyObject *_liblvm_lvm_vg_create_lv_linear(vgobject *self, PyObject *args)
{
const char *vgname;
unsigned long long size;
- lvobject *lvobj;
+ lv_t lv;
VG_VALID(self);
if (!PyArg_ParseTuple(args, "sK", &vgname, &size))
return NULL;
- if (!(lvobj = PyObject_New(lvobject, &_LibLVMlvType)))
- return NULL;
-
- /* Initialize the parent ptr in case lv create fails and we dealloc lvobj */
- lvobj->parent_vgobj = NULL;
-
- if (!(lvobj->lv = lvm_vg_create_lv_linear(self->vg, vgname, size))) {
+ if (!(lv = lvm_vg_create_lv_linear(self->vg, vgname, size))) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
- Py_DECREF(lvobj);
return NULL;
}
- lvobj->parent_vgobj = self;
- Py_INCREF(lvobj->parent_vgobj);
-
- return (PyObject *)lvobj;
+ return (PyObject *)_create_py_lv(self, lv);
}
static PyObject *_liblvm_lvm_vg_create_lv_thinpool(vgobject *self, PyObject *args)
@@ -1019,7 +1032,7 @@ static PyObject *_liblvm_lvm_vg_create_lv_thinpool(vgobject *self, PyObject *arg
unsigned long chunk_size = 0;
int skip_zero = 0;
lvm_thin_discards_t discard = LVM_THIN_DISCARDS_PASSDOWN;
- lvobject *lvobj;
+ lv_t lv;
lv_create_params_t lvp = NULL;
struct lvm_property_value prop_value;
@@ -1029,17 +1042,10 @@ static PyObject *_liblvm_lvm_vg_create_lv_thinpool(vgobject *self, PyObject *arg
&meta_size, &discard, &skip_zero))
return NULL;
- if (!(lvobj = PyObject_New(lvobject, &_LibLVMlvType)))
- return NULL;
-
- /* Initialize the parent ptr in case lv create fails and we dealloc lvobj */
- lvobj->parent_vgobj = NULL;
-
if (!(lvp = lvm_lv_params_create_thin_pool(self->vg, pool_name, size, chunk_size,
meta_size, discard))) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
- Py_DECREF(lvobj);
return NULL;
}
@@ -1051,23 +1057,20 @@ static PyObject *_liblvm_lvm_vg_create_lv_thinpool(vgobject *self, PyObject *arg
if (lvm_lv_params_set_property(lvp, "skip_zero",
&prop_value) == -1) {
- PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
- Py_DECREF(lvobj);
- return NULL;
+ goto error;
}
}
}
- if (!(lvobj->lv = lvm_lv_create(lvp))) {
- PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
- Py_DECREF(lvobj);
- return NULL;
+ if (!(lv = lvm_lv_create(lvp))) {
+ goto error;
}
- lvobj->parent_vgobj = self;
- Py_INCREF(lvobj->parent_vgobj);
+ return (PyObject *)_create_py_lv(self, lv);
- return (PyObject *)lvobj;
+error:
+ PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
+ return NULL;
}
static PyObject *_liblvm_lvm_vg_create_lv_thin(vgobject *self, PyObject *args)
@@ -1075,7 +1078,7 @@ static PyObject *_liblvm_lvm_vg_create_lv_thin(vgobject *self, PyObject *args)
const char *pool_name;
const char *lv_name;
unsigned long long size = 0;
- lvobject *lvobj;
+ lv_t lv;
lv_create_params_t lvp = NULL;
VG_VALID(self);
@@ -1083,28 +1086,17 @@ static PyObject *_liblvm_lvm_vg_create_lv_thin(vgobject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "ssK", &pool_name, &lv_name, &size))
return NULL;
- if (!(lvobj = PyObject_New(lvobject, &_LibLVMlvType)))
- return NULL;
-
- /* Initialize the parent ptr in case lv create fails and we dealloc lvobj */
- lvobj->parent_vgobj = NULL;
-
if (!(lvp = lvm_lv_params_create_thin(self->vg, pool_name, lv_name,size))) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
- Py_DECREF(lvobj);
return NULL;
}
- if (!(lvobj->lv = lvm_lv_create(lvp))) {
+ if (!(lv = lvm_lv_create(lvp))) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
- Py_DECREF(lvobj);
return NULL;
}
- lvobj->parent_vgobj = self;
- Py_INCREF(lvobj->parent_vgobj);
-
- return (PyObject *)lvobj;
+ return (PyObject *)_create_py_lv(self, lv);
}
static void liblvm_lv_dealloc(lvobject *self)
@@ -1157,7 +1149,6 @@ typedef pv_t (*pv_fetch_by_N)(vg_t vg, const char *id);
static PyObject *_liblvm_lvm_lv_from_N(vgobject *self, PyObject *arg, lv_fetch_by_N method)
{
const char *id;
- lvobject *lvobj;
lv_t lv = NULL;
VG_VALID(self);
@@ -1170,15 +1161,7 @@ static PyObject *_liblvm_lvm_lv_from_N(vgobject *self, PyObject *arg, lv_fetch_b
return NULL;
}
- if (!(lvobj = PyObject_New(lvobject, &_LibLVMlvType)))
- return NULL;
-
- lvobj->parent_vgobj = self;
- Py_INCREF(lvobj->parent_vgobj);
-
- lvobj->lv = lv;
-
- return (PyObject *)lvobj;
+ return (PyObject *)_create_py_lv(self, lv);
}
static PyObject *_liblvm_lvm_lv_from_name(vgobject *self, PyObject *arg)
@@ -1242,12 +1225,12 @@ static void _liblvm_pv_dealloc(pvobject *self)
/* LV Methods */
#define LV_VALID(lvobject) \
- do { \
- VG_VALID(lvobject->parent_vgobj); \
- if (!lvobject->lv) { \
+ do { \
+ if (!lvobject || !lvobject->lv) { \
PyErr_SetString(PyExc_UnboundLocalError, "LV object invalid"); \
- return NULL; \
- } \
+ return NULL; \
+ }\
+ VG_VALID(lvobject->parent_vgobj); \
} while (0)
static PyObject *_liblvm_lvm_lv_get_attr(lvobject *self)
@@ -1510,7 +1493,7 @@ static PyObject *_liblvm_lvm_lv_snapshot(lvobject *self, PyObject *args)
{
const char *snap_name;
unsigned long long size = 0;
- lvobject *lvobj;
+ lv_t lv;
lv_create_params_t lvp = NULL;
LV_VALID(self);
@@ -1518,43 +1501,33 @@ static PyObject *_liblvm_lvm_lv_snapshot(lvobject *self, PyObject *args)
if (!PyArg_ParseTuple(args, "s|K", &snap_name, &size))
return NULL;
- if (!(lvobj = PyObject_New(lvobject, &_LibLVMlvType)))
- return NULL;
-
- lvobj->parent_vgobj = NULL;
-
if (!(lvp = lvm_lv_params_create_snapshot(self->lv, snap_name, size))) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
- Py_DECREF(lvobj);
return NULL;
}
- if (!(lvobj->lv = lvm_lv_create(lvp))) {
+ if (!(lv = lvm_lv_create(lvp))) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
- Py_DECREF(lvobj);
return NULL;
}
- lvobj->parent_vgobj = self->parent_vgobj;
- Py_INCREF(lvobj->parent_vgobj);
-
- return (PyObject *)lvobj;
+ return (PyObject *)_create_py_lv(self->parent_vgobj, lv);
}
/* PV Methods */
#define PV_VALID(pvobject) \
do { \
+ if (!pvobject || !pvobject->pv) { \
+ PyErr_SetString(PyExc_UnboundLocalError, "PV object invalid"); \
+ return NULL; \
+ } \
if (pvobject->parent_vgobj) { \
VG_VALID(pvobject->parent_vgobj); \
} \
if (pvobject->parent_pvslistobj) { \
PVSLIST_VALID(pvobject->parent_pvslistobj); \
} \
- if (!pvobject->pv) { \
- PyErr_SetString(PyExc_UnboundLocalError, "PV object invalid"); \
- return NULL; \
- } \
} while (0)
static PyObject *_liblvm_lvm_pv_get_name(pvobject *self)
@@ -1673,7 +1646,14 @@ static PyObject *_liblvm_lvm_pv_list_pvsegs(pvobject *self)
* No way to close/destroy an lvseg, just need to make sure parents are
* still good
*/
-#define LVSEG_VALID(lvsegobject) LV_VALID(lvsegobject->parent_lvobj)
+#define LVSEG_VALID(lvsegobject) \
+ do { \
+ if ( !lvsegobject || !lvsegobject->parent_lvobj ) { \
+ PyErr_SetString(PyExc_UnboundLocalError, "LV segment object invalid"); \
+ return NULL; \
+ } \
+ LV_VALID(lvsegobject->parent_lvobj); \
+ } while(0)
static void _liblvm_lvseg_dealloc(lvsegobject *self)
{
@@ -1702,7 +1682,14 @@ static PyObject *_liblvm_lvm_lvseg_get_property(lvsegobject *self, PyObject *arg
* No way to close/destroy a pvseg, just need to make sure parents are
* still good
*/
-#define PVSEG_VALID(pvsegobject) PV_VALID(pvsegobject->parent_pvobj)
+#define PVSEG_VALID(pvsegobject) \
+ do { \
+ if (!pvsegobject || !pvsegobject->parent_pvobj) { \
+ PyErr_SetString(PyExc_UnboundLocalError, "PV segment object invalid"); \
+ return NULL; \
+ } \
+ PV_VALID(pvsegobject->parent_pvobj); \
+ } while(0)
static void _liblvm_pvseg_dealloc(pvsegobject *self)
{
10 years, 5 months
master - python-lvm: Correct names
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1f744733a15fe5...
Commit: 1f744733a15fe56404dbd0c4d8e1aab339fef774
Parent: b0b061cdbc4856cf6f5b43bd9ae835e678440890
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Wed Jul 31 12:56:41 2013 -0400
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Tue Nov 19 14:40:25 2013 -0600
python-lvm: Correct names
The existing names do not follow accepted guidelines.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
python/liblvm.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/python/liblvm.c b/python/liblvm.c
index a9de817..42a327e 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -1846,7 +1846,7 @@ static PyMethodDef _liblvm_pvseg_methods[] = {
static PyTypeObject _LibLVMvgType = {
PyObject_HEAD_INIT(&PyType_Type)
- .tp_name = "liblvm.Liblvm_vg",
+ .tp_name = "lvm.Liblvm_vg",
.tp_basicsize = sizeof(vgobject),
.tp_new = PyType_GenericNew,
.tp_dealloc = (destructor)liblvm_vg_dealloc,
@@ -1857,7 +1857,7 @@ static PyTypeObject _LibLVMvgType = {
static PyTypeObject _LibLVMlvType = {
PyObject_HEAD_INIT(&PyType_Type)
- .tp_name = "liblvm.Liblvm_lv",
+ .tp_name = "lvm.Liblvm_lv",
.tp_basicsize = sizeof(lvobject),
.tp_new = PyType_GenericNew,
.tp_dealloc = (destructor)liblvm_lv_dealloc,
@@ -1868,7 +1868,7 @@ static PyTypeObject _LibLVMlvType = {
static PyTypeObject _LibLVMpvlistType = {
PyObject_HEAD_INIT(&PyType_Type)
- .tp_name = "liblvm.Liblvm_pvlist",
+ .tp_name = "lvm.Liblvm_pvlist",
.tp_basicsize = sizeof(pvslistobject),
.tp_new = PyType_GenericNew,
.tp_dealloc = (destructor)_liblvm_pvlist_dealloc,
@@ -1879,7 +1879,7 @@ static PyTypeObject _LibLVMpvlistType = {
static PyTypeObject _LibLVMpvType = {
PyObject_HEAD_INIT(&PyType_Type)
- .tp_name = "liblvm.Liblvm_pv",
+ .tp_name = "lvm.Liblvm_pv",
.tp_basicsize = sizeof(pvobject),
.tp_new = PyType_GenericNew,
.tp_dealloc = (destructor)_liblvm_pv_dealloc,
@@ -1890,7 +1890,7 @@ static PyTypeObject _LibLVMpvType = {
static PyTypeObject _LibLVMlvsegType = {
PyObject_HEAD_INIT(&PyType_Type)
- .tp_name = "liblvm.Liblvm_lvseg",
+ .tp_name = "lvm.Liblvm_lvseg",
.tp_basicsize = sizeof(lvsegobject),
.tp_new = PyType_GenericNew,
.tp_dealloc = (destructor)_liblvm_lvseg_dealloc,
@@ -1901,7 +1901,7 @@ static PyTypeObject _LibLVMlvsegType = {
static PyTypeObject _LibLVMpvsegType = {
PyObject_HEAD_INIT(&PyType_Type)
- .tp_name = "liblvm.Liblvm_pvseg",
+ .tp_name = "lvm.Liblvm_pvseg",
.tp_basicsize = sizeof(pvsegobject),
.tp_new = PyType_GenericNew,
.tp_dealloc = (destructor)_liblvm_pvseg_dealloc,
@@ -1952,7 +1952,7 @@ PyMODINIT_FUNC initlvm(void)
LVM_THIN_DISCARDS_PASSDOWN) < 0)
return;
- if ((_LibLVMError = PyErr_NewException("Liblvm._LibLVMError", NULL, NULL))) {
+ if ((_LibLVMError = PyErr_NewException("lvm.LibLVMError", NULL, NULL))) {
/* Each call to PyModule_AddObject decrefs it; compensate: */
Py_INCREF(_LibLVMError);
Py_INCREF(_LibLVMError);
10 years, 5 months
master - tests: skip raid test on 3.12.0
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b0b061cdbc4856...
Commit: b0b061cdbc4856cf6f5b43bd9ae835e678440890
Parent: fe609141a894d33b92a6eb5fb9b5ee62bdc6c4ee
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Nov 19 11:47:28 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 19 11:49:33 2013 +0100
tests: skip raid test on 3.12.0
3.12.0 kernel prevents raid test to be usable,
leaving unremovable devices in table.
This needs to be fixed ASAP, meanwhile disable test to make
test machines at least usable.
---
test/lib/aux.sh | 6 ++++++
test/shell/lvconvert-raid.sh | 5 +----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 6f21e8b..4ef1132 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -689,6 +689,12 @@ target_at_least()
dm-*) modprobe "$1" || true ;;
esac
+ if test "$1" = dm-raid; then
+ case "$(uname -r)" in
+ 3.12.0*) return 1 ;;
+ esac
+ fi
+
local version=$(dmsetup targets 2>/dev/null | grep "${1##dm-} " 2>/dev/null)
version=${version##* v}
shift
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index 680710e..0bdb023 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -22,10 +22,7 @@ get_image_pvs() {
########################################################
# MAIN
########################################################
-if ! aux target_at_least dm-raid 1 2 0; then
- dmsetup targets | grep raid
- skip
-fi
+aux target_at_least dm-raid 1 2 0 || skip
# 9 PVs needed for RAID10 testing (3-stripes/2-mirror - replacing 3 devs)
aux prepare_pvs 9 80
10 years, 5 months
master - tests: on 32bit test with <16T devs
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=fe609141a894d3...
Commit: fe609141a894d33b92a6eb5fb9b5ee62bdc6c4ee
Parent: c697f501c7d9f29b6e0b32225b962d1632654004
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 15 23:47:14 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 19 10:55:14 2013 +0100
tests: on 32bit test with <16T devs
Add 'can_use_16T' to detect systems where we could
safely use 16T devices without causing system deadlocks.
16T size leads on those to endless loops in udevd
- it calls blkid which tries cached read from such device
- this ends in endless loop.
Related problems:
https://bugzilla.redhat.com/show_bug.cgi?id=1015028
---
test/lib/aux.sh | 6 ++++++
test/shell/lvconvert-thin.sh | 9 ++++++++-
test/shell/lvcreate-large-raid.sh | 3 +++
test/shell/lvcreate-large-raid10.sh | 3 +++
test/shell/lvcreate-large.sh | 3 +++
test/shell/snapshot-usage.sh | 11 ++++++++++-
6 files changed, 33 insertions(+), 2 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index f51fc0d..6f21e8b 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -670,6 +670,12 @@ wait_for_sync() {
return 1
}
+# Check if tests are running on 64bit architecture
+can_use_16T()
+{
+ test "$(getconf LONG_BIT)" -eq 64
+}
+
#
# Check wheter kernel [dm module] target exist
# at least in expected version
diff --git a/test/shell/lvconvert-thin.sh b/test/shell/lvconvert-thin.sh
index 0081e45..d177f9a 100644
--- a/test/shell/lvconvert-thin.sh
+++ b/test/shell/lvconvert-thin.sh
@@ -28,7 +28,11 @@ aux prepare_pvs 4 64
# build one large PV
vgcreate $vg1 $(cut -d ' ' -f -3 DEVICES)
-lvcreate -s -l 100%FREE -n $lv $vg1 --virtualsize 64T
+# 32bit linux kernels are fragille with device size >= 16T
+# maybe uname -m [ x86_64 | i686 ]
+TSIZE=64T
+aux can_use_16T || TSIZE=15T
+lvcreate -s -l 100%FREE -n $lv $vg1 --virtualsize $TSIZE
aux extend_filter_LVMTEST
pvcreate "$DM_DEV_DIR/$vg1/$lv"
@@ -97,10 +101,13 @@ lvconvert --thinpool $vg/$lv1 --poolmetadata $vg/$lv2 |& tee err
grep "WARNING: Maximum size" err
lvremove -f $vg
+
+if test "$TSIZE" -eq 64T; then
lvcreate -L24T -n $lv1 $vg
# Warning about bigger then needed (24T data and 16G -> 128K chunk)
lvconvert -c 64 --thinpool $vg/$lv1 |& tee err
grep "WARNING: Chunk size is too small" err
+fi
#lvs -a -o+chunk_size,stripe_size,seg_pe_ranges
diff --git a/test/shell/lvcreate-large-raid.sh b/test/shell/lvcreate-large-raid.sh
index a91da05..395cf2b 100644
--- a/test/shell/lvcreate-large-raid.sh
+++ b/test/shell/lvcreate-large-raid.sh
@@ -13,6 +13,9 @@
. lib/test
+# FIXME update test to make something useful on <16T
+aux can_use_16T || skip
+
aux target_at_least dm-raid 1 1 0 || skip
aux prepare_vg 5
diff --git a/test/shell/lvcreate-large-raid10.sh b/test/shell/lvcreate-large-raid10.sh
index d971d74..4f97997 100644
--- a/test/shell/lvcreate-large-raid10.sh
+++ b/test/shell/lvcreate-large-raid10.sh
@@ -13,6 +13,9 @@
. lib/test
+# FIXME update test to make something useful on <16T
+aux can_use_16T || skip
+
aux target_at_least dm-raid 1 3 0 || skip
aux prepare_vg 5
diff --git a/test/shell/lvcreate-large.sh b/test/shell/lvcreate-large.sh
index 63b2b03..c8790f1 100644
--- a/test/shell/lvcreate-large.sh
+++ b/test/shell/lvcreate-large.sh
@@ -13,6 +13,9 @@
. lib/test
+# FIXME update test to make something useful on <16T
+aux can_use_16T || skip
+
aux prepare_vg 4
lvcreate -s -l 100%FREE -n $lv $vg --virtualsize 1024T
diff --git a/test/shell/snapshot-usage.sh b/test/shell/snapshot-usage.sh
index 3d4d308..9e6a14f 100644
--- a/test/shell/snapshot-usage.sh
+++ b/test/shell/snapshot-usage.sh
@@ -27,7 +27,10 @@ cleanup_tail()
aux prepare_pvs 1
vgcreate -s 4M $vg $(cat DEVICES)
-lvcreate -s -l 100%FREE -n $lv $vg --virtualsize 15P
+TSIZE=15P
+aux can_use_16T || TSIZE=15T
+
+lvcreate -s -l 100%FREE -n $lv $vg --virtualsize $TSIZE
aux extend_filter_LVMTEST
aux lvmconf "activation/snapshot_autoextend_percent = 20" \
@@ -106,6 +109,9 @@ check lv_field $vg1/lvol1 size "28.00k"
fill 20K
vgremove -ff $vg1
+# Can't test >= 16T devices on 32bit
+if test "$TSIZE" -eq 15P ; then
+
# Check usability with largest extent size
pvcreate $DM_DEV_DIR/$vg/$lv
vgcreate -s 4G $vg1 $DM_DEV_DIR/$vg/$lv
@@ -119,4 +125,7 @@ lvcreate -aey -V15E -l1 -n $lv1 -s $vg1
check lv_field $vg1/$lv1 origin_size "15.00e"
vgremove -ff $vg1
+
+fi
+
vgremove -ff $vg
10 years, 5 months
master - Makefile: fix build in non src dir
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c697f501c7d9f2...
Commit: c697f501c7d9f29b6e0b32225b962d1632654004
Parent: 3a6f91d7139119bea664050a957cbc21490398bc
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 15 23:44:18 2013 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Nov 19 10:55:11 2013 +0100
Makefile: fix build in non src dir
Fix 'make install' from builddir != srcdir.
---
WHATS_NEW | 1 +
conf/Makefile.in | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0a4909a..bd18c6f 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.105 -
=====================================
+ Fix install of conf subdir when not building in srcdir.
Add reporting of thin_id device id for thin volumes.
Fix reporting of empty numerical values.
Simplify reporting code.
diff --git a/conf/Makefile.in b/conf/Makefile.in
index 8b5238a..3f66621 100644
--- a/conf/Makefile.in
+++ b/conf/Makefile.in
@@ -19,7 +19,7 @@ CONFSRC=example.conf
CONFDEST=lvm.conf
DEFAULT_PROFILE=default.profile
-PROFILES=$(DEFAULT_PROFILE) thin-performance.profile
+PROFILES=$(DEFAULT_PROFILE) $(srcdir)/thin-performance.profile
include $(top_builddir)/make.tmpl
10 years, 5 months
master - metadata: Make the fid mda routines a little more resilient.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3a6f91d7139119...
Commit: 3a6f91d7139119bea664050a957cbc21490398bc
Parent: 03d3e1d9c17e959dc78a5bfa82cd69878653a9d2
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Nov 18 18:00:49 2013 +0100
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Mon Nov 18 18:00:49 2013 +0100
metadata: Make the fid mda routines a little more resilient.
---
lib/metadata/metadata.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index aa5f124..398def6 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4400,6 +4400,9 @@ int fid_add_mda(struct format_instance *fid, struct metadata_area *mda,
if (!key)
return 1;
+ if (!fid->metadata_areas_index)
+ return_0;
+
/* Add metadata area to index. */
if (!_convert_key_to_string(key, key_len, sub_key,
full_key, sizeof(full_key)))
@@ -4439,10 +4442,13 @@ struct metadata_area *fid_get_mda_indexed(struct format_instance *fid,
static char full_key[PATH_MAX];
struct metadata_area *mda = NULL;
+ if (!fid->metadata_areas_index)
+ return_NULL;
if (!_convert_key_to_string(key, key_len, sub_key,
full_key, sizeof(full_key)))
return_NULL;
+
mda = (struct metadata_area *) dm_hash_lookup(fid->metadata_areas_index,
full_key);
10 years, 5 months
master - lvmetad: Set up device pointers in synthetic lvmcache_infos.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=03d3e1d9c17e95...
Commit: 03d3e1d9c17e959dc78a5bfa82cd69878653a9d2
Parent: b8a6b8f467fadd5334fdb0c4a149753916e097db
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Nov 18 17:53:45 2013 +0100
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Mon Nov 18 17:53:45 2013 +0100
lvmetad: Set up device pointers in synthetic lvmcache_infos.
---
lib/cache/lvmetad.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 8940704..5119ab1 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -277,6 +277,7 @@ static struct lvmcache_info *_pv_populate_lvmcache(
return_NULL;
lvmcache_get_label(info)->sector = label_sector;
+ lvmcache_get_label(info)->dev = dev;
lvmcache_set_device_size(info, devsize);
lvmcache_del_das(info);
lvmcache_del_mdas(info);
10 years, 5 months
master - test: Force label-based reporting in pv-duplicate.sh.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b8a6b8f467fadd...
Commit: b8a6b8f467fadd5334fdb0c4a149753916e097db
Parent: ae337d472eb973bbde80d641da9567acfa7874ff
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Nov 18 17:53:06 2013 +0100
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Mon Nov 18 17:53:06 2013 +0100
test: Force label-based reporting in pv-duplicate.sh.
---
test/shell/pv-duplicate.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/pv-duplicate.sh b/test/shell/pv-duplicate.sh
index 40d1f68..f315d86 100644
--- a/test/shell/pv-duplicate.sh
+++ b/test/shell/pv-duplicate.sh
@@ -21,5 +21,5 @@ vgcreate --metadatasize 128k $vg1 "$dev1"
dd if="$dev1" of="$dev2" bs=256K count=1
dd if="$dev1" of="$dev3" bs=256K count=1
-pvs "$dev3"
+pvs "$dev3" -o pv_uuid
vgs $vg1
10 years, 5 months