master - misc: Fix copy+paste error
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=131383963ff7cc...
Commit: 131383963ff7cc9b101b9a80a8e495473ccec4cf
Parent: 4aa8a14fc25e088ff49b6960ce99633b1a6978b3
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Fri Jan 31 17:09:47 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Fri Jan 31 17:09:47 2014 -0600
misc: Fix copy+paste error
'cache_pool_metadata_require_separate_pvs' was added in version 2.02.106
not 2.02.89.
---
lib/config/config_settings.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 2c6953b..e9ae494 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -107,7 +107,7 @@ cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, 0,
cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
cfg(allocation_wipe_signatures_when_zeroing_new_lvs_CFG, "wipe_signatures_when_zeroing_new_lvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 85), NULL)
-cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL)
+cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 106), NULL)
cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL)
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
cfg(allocation_thin_pool_discards_CFG, "thin_pool_discards", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_THIN_POOL_DISCARDS, vsn(2, 2, 99), NULL)
10 years, 1 month
master - compilation: Rename tags variables to tagsl.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4aa8a14fc25e08...
Commit: 4aa8a14fc25e088ff49b6960ce99633b1a6978b3
Parent: 83358d4c039a36d5ef4b42b2213d73bb72ea7c26
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Jan 30 21:09:28 2014 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Jan 30 21:09:28 2014 +0000
compilation: Rename tags variables to tagsl.
---
lib/format_text/export.c | 6 ++--
lib/format_text/tags.c | 10 ++++----
lib/metadata/metadata.c | 6 ++--
lib/metadata/metadata.h | 2 +-
lib/metadata/mirror.c | 8 +++---
lib/report/report.c | 4 +-
python/liblvm.c | 25 +++++++++++---------
tools/toollib.c | 56 +++++++++++++++++++++++-----------------------
tools/toollib.h | 4 +-
9 files changed, 62 insertions(+), 59 deletions(-)
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index 73030e4..883e076 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -367,12 +367,12 @@ static int _print_flag_config(struct formatter *f, uint64_t status, int type)
}
-static int _out_tags(struct formatter *f, struct dm_list *tags)
+static int _out_tags(struct formatter *f, struct dm_list *tagsl)
{
char *tag_buffer;
- if (!dm_list_empty(tags)) {
- if (!(tag_buffer = alloc_printed_tags(tags)))
+ if (!dm_list_empty(tagsl)) {
+ if (!(tag_buffer = alloc_printed_tags(tagsl)))
return_0;
if (!out_text(f, "tags = %s", tag_buffer)) {
dm_free(tag_buffer);
diff --git a/lib/format_text/tags.c b/lib/format_text/tags.c
index b0f0732..d0bf2b1 100644
--- a/lib/format_text/tags.c
+++ b/lib/format_text/tags.c
@@ -19,14 +19,14 @@
#include "str_list.h"
#include "lvm-string.h"
-char *alloc_printed_tags(struct dm_list *tags)
+char *alloc_printed_tags(struct dm_list *tagsl)
{
struct str_list *sl;
int first = 1;
size_t size = 0;
char *buffer, *buf;
- dm_list_iterate_items(sl, tags)
+ dm_list_iterate_items(sl, tagsl)
/* '"' + tag + '"' + ',' + ' ' */
size += strlen(sl->str) + 4;
/* '[' + ']' + '\0' */
@@ -40,7 +40,7 @@ char *alloc_printed_tags(struct dm_list *tags)
if (!emit_to_buffer(&buf, &size, "["))
goto_bad;
- dm_list_iterate_items(sl, tags) {
+ dm_list_iterate_items(sl, tagsl) {
if (!first) {
if (!emit_to_buffer(&buf, &size, ", "))
goto_bad;
@@ -61,7 +61,7 @@ bad:
return_NULL;
}
-int read_tags(struct dm_pool *mem, struct dm_list *tags, const struct dm_config_value *cv)
+int read_tags(struct dm_pool *mem, struct dm_list *tagsl, const struct dm_config_value *cv)
{
if (cv->type == DM_CFG_EMPTY_ARRAY)
return 1;
@@ -72,7 +72,7 @@ int read_tags(struct dm_pool *mem, struct dm_list *tags, const struct dm_config_
return 0;
}
- if (!str_list_add(mem, tags, dm_pool_strdup(mem, cv->v.str)))
+ if (!str_list_add(mem, tagsl, dm_pool_strdup(mem, cv->v.str)))
return_0;
cv = cv->next;
diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 4d4778b..16a5411 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -4653,7 +4653,7 @@ int pv_change_metadataignore(struct physical_volume *pv, uint32_t mda_ignored)
return 1;
}
-char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tags)
+char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tagsl)
{
struct str_list *sl;
@@ -4662,9 +4662,9 @@ char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tags)
return NULL;
}
- dm_list_iterate_items(sl, tags) {
+ dm_list_iterate_items(sl, tagsl) {
if (!dm_pool_grow_object(mem, sl->str, strlen(sl->str)) ||
- (sl->list.n != tags && !dm_pool_grow_object(mem, ",", 1))) {
+ (sl->list.n != tagsl && !dm_pool_grow_object(mem, ",", 1))) {
log_error("dm_pool_grow_object failed");
return NULL;
}
diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h
index fef4b3f..83959bb 100644
--- a/lib/metadata/metadata.h
+++ b/lib/metadata/metadata.h
@@ -488,6 +488,6 @@ int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
struct physical_volume *pv, struct pvcreate_params *pp);
uint64_t find_min_mda_size(struct dm_list *mdas);
-char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tags);
+char *tags_format_and_copy(struct dm_pool *mem, const struct dm_list *tagsl);
#endif
diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c
index 18917d3..5d99c50 100644
--- a/lib/metadata/mirror.c
+++ b/lib/metadata/mirror.c
@@ -279,7 +279,7 @@ static int _write_log_header(struct cmd_context *cmd, struct logical_volume *lv)
*/
static int _init_mirror_log(struct cmd_context *cmd,
struct logical_volume *log_lv, int in_sync,
- struct dm_list *tags, int remove_on_failure)
+ struct dm_list *tagsl, int remove_on_failure)
{
struct str_list *sl;
uint64_t orig_status = log_lv->status;
@@ -315,7 +315,7 @@ static int _init_mirror_log(struct cmd_context *cmd,
lv_set_visible(log_lv);
/* Temporary tag mirror log for activation */
- dm_list_iterate_items(sl, tags)
+ dm_list_iterate_items(sl, tagsl)
if (!str_list_add(cmd->mem, &log_lv->tags, sl->str)) {
log_error("Aborting. Unable to tag mirror log.");
goto activate_lv;
@@ -336,7 +336,7 @@ static int _init_mirror_log(struct cmd_context *cmd,
}
/* Remove the temporary tags */
- dm_list_iterate_items(sl, tags)
+ dm_list_iterate_items(sl, tagsl)
str_list_del(&log_lv->tags, sl->str);
if (activation()) {
@@ -376,7 +376,7 @@ deactivate_and_revert_new_lv:
revert_new_lv:
log_lv->status = orig_status;
- dm_list_iterate_items(sl, tags)
+ dm_list_iterate_items(sl, tagsl)
str_list_del(&log_lv->tags, sl->str);
if (remove_on_failure && !lv_remove(log_lv)) {
diff --git a/lib/report/report.c b/lib/report/report.c
index 3a5119d..18d7579 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -130,10 +130,10 @@ static int _tags_disp(struct dm_report *rh __attribute__((unused)), struct dm_po
struct dm_report_field *field,
const void *data, void *private __attribute__((unused)))
{
- const struct dm_list *tags = (const struct dm_list *) data;
+ const struct dm_list *tagsl = (const struct dm_list *) data;
char *tags_str;
- if (!(tags_str = tags_format_and_copy(mem, tags)))
+ if (!(tags_str = tags_format_and_copy(mem, tagsl)))
return_0;
return _field_set_value(field, tags_str, NULL);
diff --git a/python/liblvm.c b/python/liblvm.c
index 6abd5ff..094aec2 100644
--- a/python/liblvm.c
+++ b/python/liblvm.c
@@ -1043,22 +1043,22 @@ static PyObject *_liblvm_lvm_vg_list_lvs(vgobject *self)
static PyObject *_liblvm_lvm_vg_get_tags(vgobject *self)
{
- struct dm_list *tags;
+ struct dm_list *tagsl;
struct lvm_str_list *strl;
PyObject * pytuple;
int i = 0;
VG_VALID(self);
- if (!(tags = lvm_vg_get_tags(self->vg))) {
+ if (!(tagsl = lvm_vg_get_tags(self->vg))) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
return NULL;
}
- if (!(pytuple = PyTuple_New(dm_list_size(tags))))
+ if (!(pytuple = PyTuple_New(dm_list_size(tagsl))))
return NULL;
- dm_list_iterate_items(strl, tags) {
+ dm_list_iterate_items(strl, tagsl) {
PyTuple_SET_ITEM(pytuple, i, PyString_FromString(strl->str));
i++;
}
@@ -1163,8 +1163,9 @@ static PyObject *_liblvm_lvm_vg_create_lv_thin(vgobject *self, PyObject *args)
static void liblvm_lv_dealloc(lvobject *self)
{
/* We can dealloc an object that didn't get fully created */
- if (self->parent_vgobj)
+ if (self->parent_vgobj) {
Py_DECREF(self->parent_vgobj);
+ }
PyObject_Del(self);
}
@@ -1291,11 +1292,13 @@ static PyObject *_liblvm_lvm_pv_from_uuid(vgobject *self, PyObject *arg)
static void _liblvm_pv_dealloc(pvobject *self)
{
- if (self->parent_vgobj)
+ if (self->parent_vgobj) {
Py_DECREF(self->parent_vgobj);
+ }
- if (self->parent_pvslistobj)
+ if (self->parent_pvslistobj) {
Py_DECREF(self->parent_pvslistobj);
+ }
self->parent_vgobj = NULL;
self->parent_pvslistobj = NULL;
@@ -1474,22 +1477,22 @@ static PyObject *_liblvm_lvm_lv_remove_tag(lvobject *self, PyObject *args)
static PyObject *_liblvm_lvm_lv_get_tags(lvobject *self)
{
- struct dm_list *tags;
+ struct dm_list *tagsl;
struct lvm_str_list *strl;
PyObject * pytuple;
int i = 0;
LV_VALID(self);
- if (!(tags = lvm_lv_get_tags(self->lv))) {
+ if (!(tagsl = lvm_lv_get_tags(self->lv))) {
PyErr_SetObject(_LibLVMError, _liblvm_get_last_error());
return NULL;
}
- if (!(pytuple = PyTuple_New(dm_list_size(tags))))
+ if (!(pytuple = PyTuple_New(dm_list_size(tagsl))))
return NULL;
- dm_list_iterate_items(strl, tags) {
+ dm_list_iterate_items(strl, tagsl) {
PyTuple_SET_ITEM(pytuple, i, PyString_FromString(strl->str));
i++;
}
diff --git a/tools/toollib.c b/tools/toollib.c
index 61c14f1..0662c9e 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -184,7 +184,7 @@ int ignore_vg(struct volume_group *vg, const char *vg_name, int allow_inconsiste
int process_each_lv_in_vg(struct cmd_context *cmd,
struct volume_group *vg,
const struct dm_list *arg_lvnames,
- const struct dm_list *tags,
+ const struct dm_list *tagsl,
struct dm_list *failed_lvnames,
void *handle,
process_single_lv_fn_t process_single_lv)
@@ -201,7 +201,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
if (!vg_check_status(vg, EXPORTED_VG))
return ECMD_FAILED;
- if (tags && !dm_list_empty(tags))
+ if (tagsl && !dm_list_empty(tagsl))
tags_supplied = 1;
if (arg_lvnames && !dm_list_empty(arg_lvnames))
@@ -212,7 +212,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
process_all = 1;
/* Or if VG tags match */
else if (tags_supplied &&
- str_list_match_list(tags, &vg->tags, NULL))
+ str_list_match_list(tagsl, &vg->tags, NULL))
process_all = 1;
/*
@@ -247,7 +247,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
/* LV tag match? skip test, when process_all */
else if (!process_all &&
(!tags_supplied ||
- !str_list_match_list(tags, &lvl->lv->tags, NULL)))
+ !str_list_match_list(tagsl, &lvl->lv->tags, NULL)))
continue;
if (sigint_caught())
@@ -296,7 +296,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
struct cmd_vg *cvl_vg;
struct dm_list cmd_vgs;
struct dm_list failed_lvnames;
- struct dm_list tags, lvnames;
+ struct dm_list tagsl, lvnames;
struct dm_list arg_lvnames; /* Cmdline vgname or vgname/lvname */
struct dm_list arg_vgnames;
char *vglv;
@@ -304,7 +304,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
const char *vgname;
- dm_list_init(&tags);
+ dm_list_init(&tagsl);
dm_list_init(&arg_lvnames);
dm_list_init(&failed_lvnames);
@@ -327,7 +327,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
vgname);
continue;
}
- if (!str_list_add(cmd->mem, &tags,
+ if (!str_list_add(cmd->mem, &tagsl,
dm_pool_strdup(cmd->mem,
vgname + 1))) {
log_error("strlist allocation failed");
@@ -395,7 +395,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
vgnames = &arg_vgnames;
}
- if (!argc || !dm_list_empty(&tags)) {
+ if (!argc || !dm_list_empty(&tagsl)) {
log_verbose("Finding all logical volumes");
if (!lvmetad_vg_list_to_lvmcache(cmd))
stack;
@@ -420,7 +420,7 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv,
continue;
}
- tags_arg = &tags;
+ tags_arg = &tagsl;
dm_list_init(&lvnames); /* LVs to be processed in this VG */
dm_list_iterate_items(sll, &arg_lvnames) {
const char *vg_name = sll->str;
@@ -562,7 +562,7 @@ int process_each_segment_in_lv(struct cmd_context *cmd,
static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
const char *vgid,
- struct dm_list *tags, struct dm_list *arg_vgnames,
+ struct dm_list *tagsl, struct dm_list *arg_vgnames,
uint32_t flags, void *handle, int ret_max,
process_single_vg_fn_t process_single_vg)
{
@@ -591,10 +591,10 @@ static int _process_one_vg(struct cmd_context *cmd, const char *vg_name,
}
}
- if (!dm_list_empty(tags) &&
+ if (!dm_list_empty(tagsl) &&
/* Only process if a tag matches or it's on arg_vgnames */
!str_list_match_item(arg_vgnames, vg_name) &&
- !str_list_match_list(tags, &cvl_vg->vg->tags, NULL))
+ !str_list_match_list(tagsl, &cvl_vg->vg->tags, NULL))
break;
ret = process_single_vg(cmd, vg_name, cvl_vg->vg, handle);
@@ -622,11 +622,11 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
struct str_list *sl;
struct dm_list *vgnames, *vgids;
- struct dm_list arg_vgnames, tags;
+ struct dm_list arg_vgnames, tagsl;
const char *vg_name, *vgid;
- dm_list_init(&tags);
+ dm_list_init(&tagsl);
dm_list_init(&arg_vgnames);
if (argc) {
@@ -642,7 +642,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
ret_max = EINVALID_CMD_LINE;
continue;
}
- if (!str_list_add(cmd->mem, &tags,
+ if (!str_list_add(cmd->mem, &tagsl,
dm_pool_strdup(cmd->mem,
vg_name + 1))) {
log_error("strlist allocation failed");
@@ -669,7 +669,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
vgnames = &arg_vgnames;
}
- if (!argc || !dm_list_empty(&tags)) {
+ if (!argc || !dm_list_empty(&tagsl)) {
log_verbose("Finding all volume groups");
if (!lvmetad_vg_list_to_lvmcache(cmd))
stack;
@@ -683,7 +683,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
vgid = sl->str;
if (!(vgid) || !(vg_name = lvmcache_vgname_from_vgid(cmd->mem, vgid)))
continue;
- ret_max = _process_one_vg(cmd, vg_name, vgid, &tags,
+ ret_max = _process_one_vg(cmd, vg_name, vgid, &tagsl,
&arg_vgnames,
flags, handle,
ret_max, process_single_vg);
@@ -695,7 +695,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
vg_name = sl->str;
if (is_orphan_vg(vg_name))
continue; /* FIXME Unnecessary? */
- ret_max = _process_one_vg(cmd, vg_name, NULL, &tags,
+ ret_max = _process_one_vg(cmd, vg_name, NULL, &tagsl,
&arg_vgnames,
flags, handle,
ret_max, process_single_vg);
@@ -706,7 +706,7 @@ int process_each_vg(struct cmd_context *cmd, int argc, char **argv,
}
int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
- const struct dm_list *tags, void *handle,
+ const struct dm_list *tagsl, void *handle,
process_single_pv_fn_t process_single_pv)
{
int ret_max = ECMD_PROCESSED;
@@ -716,8 +716,8 @@ int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
dm_list_iterate_items(pvl, &vg->pvs) {
if (sigint_caught())
return_ECMD_FAILED;
- if (tags && !dm_list_empty(tags) &&
- !str_list_match_list(tags, &pvl->pv->tags, NULL)) {
+ if (tagsl && !dm_list_empty(tagsl) &&
+ !str_list_match_list(tagsl, &pvl->pv->tags, NULL)) {
continue;
}
if ((ret = process_single_pv(cmd, vg, pvl->pv, handle)) > ret_max)
@@ -801,12 +801,12 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
struct pv_list *pvl;
struct physical_volume *pv;
struct dm_list *pvslist = NULL, *vgnames;
- struct dm_list tags;
+ struct dm_list tagsl;
struct str_list *sll;
char *at_sign, *tagname;
struct device *dev;
- dm_list_init(&tags);
+ dm_list_init(&tagsl);
if (lock_global && !lock_vol(cmd, VG_GLOBAL, LCK_VG_READ, NULL)) {
log_error("Unable to obtain global lock.");
@@ -831,7 +831,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
ret_max = EINVALID_CMD_LINE;
continue;
}
- if (!str_list_add(cmd->mem, &tags,
+ if (!str_list_add(cmd->mem, &tagsl,
dm_pool_strdup(cmd->mem,
tagname))) {
log_error("strlist allocation failed");
@@ -881,7 +881,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
if (ret > ret_max)
ret_max = ret;
}
- if (!dm_list_empty(&tags) && (vgnames = get_vgnames(cmd, 1)) &&
+ if (!dm_list_empty(&tagsl) && (vgnames = get_vgnames(cmd, 1)) &&
!dm_list_empty(vgnames)) {
dm_list_iterate_items(sll, vgnames) {
if (sigint_caught()) {
@@ -895,7 +895,7 @@ int process_each_pv(struct cmd_context *cmd, int argc, char **argv,
continue;
}
- ret = process_each_pv_in_vg(cmd, vg, &tags,
+ ret = process_each_pv_in_vg(cmd, vg, &tagsl,
handle,
process_single_pv);
if (ret > ret_max)
@@ -1215,7 +1215,7 @@ struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int
{
struct dm_list *r;
struct pv_list *pvl;
- struct dm_list tags, arg_pvnames;
+ struct dm_list tagsl, arg_pvnames;
char *pvname = NULL;
char *colon, *at_sign, *tagname;
int i;
@@ -1227,7 +1227,7 @@ struct dm_list *create_pv_list(struct dm_pool *mem, struct volume_group *vg, int
}
dm_list_init(r);
- dm_list_init(&tags);
+ dm_list_init(&tagsl);
dm_list_init(&arg_pvnames);
for (i = 0; i < argc; i++) {
diff --git a/tools/toollib.h b/tools/toollib.h
index d809123..54636ab 100644
--- a/tools/toollib.h
+++ b/tools/toollib.h
@@ -80,14 +80,14 @@ int process_each_segment_in_lv(struct cmd_context *cmd,
process_single_seg_fn_t process_single_seg);
int process_each_pv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
- const struct dm_list *tags, void *handle,
+ const struct dm_list *tagsl, void *handle,
process_single_pv_fn_t process_single_pv);
int process_each_lv_in_vg(struct cmd_context *cmd,
struct volume_group *vg,
const struct dm_list *arg_lvnames,
- const struct dm_list *tags,
+ const struct dm_list *tagsl,
struct dm_list *failed_lvnames,
void *handle,
process_single_lv_fn_t process_single_lv);
10 years, 1 month
master - tools: Add internal tags command.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=83358d4c039a36...
Commit: 83358d4c039a36d5ef4b42b2213d73bb72ea7c26
Parent: e833d84e67f62b9be4f5900381f6e32c4ecf66ca
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Jan 30 13:09:15 2014 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Jan 30 13:09:15 2014 +0000
tools: Add internal tags command.
---
WHATS_NEW | 1 +
lib/display/display.c | 9 +++++++++
lib/display/display.h | 1 +
man/lvm.8.in | 2 ++
tools/Makefile.in | 3 ++-
tools/commands.h | 5 +++++
tools/tags.c | 23 +++++++++++++++++++++++
7 files changed, 43 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index d28ec3c..25293e6 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Add internal tags command to display any tags defined on the host.
Prohibit use of external origin with size incompatible with thin pool.
Avoid trying to convert single to thin pool and volume at the same time.
Add support for partitions on ZFS zvol.
diff --git a/lib/display/display.c b/lib/display/display.c
index 1babffc..9b4f828 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -921,6 +921,15 @@ void display_segtypes(const struct cmd_context *cmd)
}
}
+void display_tags(const struct cmd_context *cmd)
+{
+ const struct str_list *sl;
+
+ dm_list_iterate_items(sl, &cmd->tags) {
+ log_print("%s", sl->str);
+ }
+}
+
void display_name_error(name_error_t name_error)
{
if (name_error != NAME_VALID) {
diff --git a/lib/display/display.h b/lib/display/display.h
index 077fff4..c58df45 100644
--- a/lib/display/display.h
+++ b/lib/display/display.h
@@ -53,6 +53,7 @@ void vgdisplay_short(const struct volume_group *vg);
void display_formats(const struct cmd_context *cmd);
void display_segtypes(const struct cmd_context *cmd);
+void display_tags(const struct cmd_context *cmd);
void display_name_error(name_error_t name_error);
diff --git a/man/lvm.8.in b/man/lvm.8.in
index c377b35..564e98b 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -56,6 +56,8 @@ loading \fBlvm.conf\fP(5) and any other configuration files.
.TP
\fBsegtypes\fP \(em Display recognised Logical Volume segment types.
.TP
+\fBtags\fP \(em Display any tags defined on this host.
+.TP
\fBversion\fP \(em Display version information.
.LP
.SH COMMANDS
diff --git a/tools/Makefile.in b/tools/Makefile.in
index f18d3ea..253c404 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -43,6 +43,7 @@ SOURCES =\
pvscan.c \
reporter.c \
segtypes.c \
+ tags.c \
toollib.c \
vgcfgbackup.c \
vgcfgrestore.c \
@@ -166,7 +167,7 @@ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
.commands: $(srcdir)/commands.h $(srcdir)/cmdnames.h Makefile
$(CC) -E -P $(srcdir)/cmdnames.h 2> /dev/null | \
- egrep -v '^ *(|#.*|devtypes|dumpconfig|formats|help|pvdata|segtypes|version) *$$' > .commands
+ egrep -v '^ *(|#.*|devtypes|dumpconfig|formats|help|pvdata|segtypes|tags|version) *$$' > .commands
ifneq ("$(CFLOW_CMD)", "")
CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
diff --git a/tools/commands.h b/tools/commands.h
index 938898b..b4ae6de 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -789,6 +789,11 @@ xx(segtypes,
PERMITTED_READ_ONLY,
"segtypes\n")
+xx(tags,
+ "List tags defined on this host",
+ PERMITTED_READ_ONLY,
+ "tags\n")
+
xx(vgcfgbackup,
"Backup volume group configuration(s)",
PERMITTED_READ_ONLY,
diff --git a/tools/tags.c b/tools/tags.c
new file mode 100644
index 0000000..bbb446a
--- /dev/null
+++ b/tools/tags.c
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "tools.h"
+
+int tags(struct cmd_context *cmd, int argc __attribute__((unused)),
+ char **argv __attribute__((unused)))
+{
+ display_tags(cmd);
+
+ return ECMD_PROCESSED;
+}
10 years, 1 month
master - hosttags: add missing file to define "hosttags" cmd
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c27e1503a6eed2...
Commit: c27e1503a6eed2faa2300e1b25c8910c6346eda5
Parent: 7a9e7a57e37d6fbab2dcd3c03192fd092811756f
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Jan 30 13:49:47 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Jan 30 13:49:47 2014 +0100
hosttags: add missing file to define "hosttags" cmd
---
tools/hosttags.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
diff --git a/tools/hosttags.c b/tools/hosttags.c
new file mode 100644
index 0000000..11fa7ef
--- /dev/null
+++ b/tools/hosttags.c
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "tools.h"
+
+int hosttags(struct cmd_context *cmd, int argc __attribute__((unused)),
+ char **argv __attribute__((unused)))
+{
+ display_hosttags(cmd);
+
+ return ECMD_PROCESSED;
+}
10 years, 1 month
master - tools: Add internal hosttags command.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7a9e7a57e37d6f...
Commit: 7a9e7a57e37d6fbab2dcd3c03192fd092811756f
Parent: e833d84e67f62b9be4f5900381f6e32c4ecf66ca
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Thu Jan 30 12:06:15 2014 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Thu Jan 30 12:06:15 2014 +0000
tools: Add internal hosttags command.
diff --git a/lib/display/display.c b/lib/display/display.c
index 1babffc..9f52f0b 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -912,6 +912,15 @@ void display_formats(const struct cmd_context *cmd)
}
}
+void display_hosttags(const struct cmd_context *cmd)
+{
+ const struct str_list *sl;
+
+ dm_list_iterate_items(sl, &cmd->tags) {
+ log_print("%s", sl->str);
+ }
+}
+
void display_segtypes(const struct cmd_context *cmd)
{
const struct segment_type *segtype;
diff --git a/lib/display/display.h b/lib/display/display.h
index 077fff4..cfac354 100644
--- a/lib/display/display.h
+++ b/lib/display/display.h
@@ -52,6 +52,7 @@ void vgdisplay_colons(const struct volume_group *vg);
void vgdisplay_short(const struct volume_group *vg);
void display_formats(const struct cmd_context *cmd);
+void display_hosttags(const struct cmd_context *cmd);
void display_segtypes(const struct cmd_context *cmd);
void display_name_error(name_error_t name_error);
diff --git a/man/lvm.8.in b/man/lvm.8.in
index c377b35..34f6764 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -52,6 +52,8 @@ loading \fBlvm.conf\fP(5) and any other configuration files.
.TP
\fBhelp\fP \(em Display the help text.
.TP
+\fBhosttags\fP \(em Display any tags defined on this host.
+.TP
\fBpvdata\fP \(em Not implemented in LVM2.
.TP
\fBsegtypes\fP \(em Display recognised Logical Volume segment types.
diff --git a/tools/Makefile.in b/tools/Makefile.in
index f18d3ea..32f5844 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -19,6 +19,7 @@ top_builddir = @top_builddir@
SOURCES =\
dumpconfig.c \
formats.c \
+ hosttags.c \
lvchange.c \
lvconvert.c \
lvcreate.c \
@@ -166,7 +167,7 @@ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
.commands: $(srcdir)/commands.h $(srcdir)/cmdnames.h Makefile
$(CC) -E -P $(srcdir)/cmdnames.h 2> /dev/null | \
- egrep -v '^ *(|#.*|devtypes|dumpconfig|formats|help|pvdata|segtypes|version) *$$' > .commands
+ egrep -v '^ *(|#.*|devtypes|dumpconfig|formats|help|hosttags|pvdata|segtypes|version) *$$' > .commands
ifneq ("$(CFLOW_CMD)", "")
CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
diff --git a/tools/commands.h b/tools/commands.h
index 938898b..08aae9a 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -80,6 +80,11 @@ xx(help,
PERMITTED_READ_ONLY,
"help <command>" "\n")
+xx(hosttags,
+ "List tags defined on this host",
+ PERMITTED_READ_ONLY,
+ "hosttags\n")
+
/*********
xx(lvactivate,
"Activate logical volume on given partition(s)",
diff --git a/tools/hosttags.c b/tools/hosttags.c
new file mode 100644
index 0000000..09ff8d0
--- /dev/null
+++ b/tools/hosttags.c
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+ *
+ * This file is part of LVM2.
+ *
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License v.2.1.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "tools.h"
+
+int hosttags(struct cmd_context *cmd, int argc __attribute__((unused)),
+ char **argv __attribute__((unused)))
+{
+ display_hosttags(cmd);
+
+ return ECMD_PROCESSED;
+}
---
lib/display/display.c | 9 +++++++++
lib/display/display.h | 1 +
man/lvm.8.in | 2 ++
tools/Makefile.in | 3 ++-
tools/commands.h | 5 +++++
5 files changed, 19 insertions(+), 1 deletions(-)
diff --git a/lib/display/display.c b/lib/display/display.c
index 1babffc..9f52f0b 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -912,6 +912,15 @@ void display_formats(const struct cmd_context *cmd)
}
}
+void display_hosttags(const struct cmd_context *cmd)
+{
+ const struct str_list *sl;
+
+ dm_list_iterate_items(sl, &cmd->tags) {
+ log_print("%s", sl->str);
+ }
+}
+
void display_segtypes(const struct cmd_context *cmd)
{
const struct segment_type *segtype;
diff --git a/lib/display/display.h b/lib/display/display.h
index 077fff4..cfac354 100644
--- a/lib/display/display.h
+++ b/lib/display/display.h
@@ -52,6 +52,7 @@ void vgdisplay_colons(const struct volume_group *vg);
void vgdisplay_short(const struct volume_group *vg);
void display_formats(const struct cmd_context *cmd);
+void display_hosttags(const struct cmd_context *cmd);
void display_segtypes(const struct cmd_context *cmd);
void display_name_error(name_error_t name_error);
diff --git a/man/lvm.8.in b/man/lvm.8.in
index c377b35..34f6764 100644
--- a/man/lvm.8.in
+++ b/man/lvm.8.in
@@ -52,6 +52,8 @@ loading \fBlvm.conf\fP(5) and any other configuration files.
.TP
\fBhelp\fP \(em Display the help text.
.TP
+\fBhosttags\fP \(em Display any tags defined on this host.
+.TP
\fBpvdata\fP \(em Not implemented in LVM2.
.TP
\fBsegtypes\fP \(em Display recognised Logical Volume segment types.
diff --git a/tools/Makefile.in b/tools/Makefile.in
index f18d3ea..32f5844 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -19,6 +19,7 @@ top_builddir = @top_builddir@
SOURCES =\
dumpconfig.c \
formats.c \
+ hosttags.c \
lvchange.c \
lvconvert.c \
lvcreate.c \
@@ -166,7 +167,7 @@ liblvm2cmd.$(LIB_SUFFIX).$(LIB_VERSION): liblvm2cmd.$(LIB_SUFFIX)
.commands: $(srcdir)/commands.h $(srcdir)/cmdnames.h Makefile
$(CC) -E -P $(srcdir)/cmdnames.h 2> /dev/null | \
- egrep -v '^ *(|#.*|devtypes|dumpconfig|formats|help|pvdata|segtypes|version) *$$' > .commands
+ egrep -v '^ *(|#.*|devtypes|dumpconfig|formats|help|hosttags|pvdata|segtypes|version) *$$' > .commands
ifneq ("$(CFLOW_CMD)", "")
CFLOW_SOURCES = $(addprefix $(srcdir)/, $(SOURCES))
diff --git a/tools/commands.h b/tools/commands.h
index 938898b..08aae9a 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -80,6 +80,11 @@ xx(help,
PERMITTED_READ_ONLY,
"help <command>" "\n")
+xx(hosttags,
+ "List tags defined on this host",
+ PERMITTED_READ_ONLY,
+ "hosttags\n")
+
/*********
xx(lvactivate,
"Activate logical volume on given partition(s)",
10 years, 1 month
master - cache/pool: Make the fns in pool_manip.c work with cache pools
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e833d84e67f62b...
Commit: e833d84e67f62b9be4f5900381f6e32c4ecf66ca
Parent: 70fd2139e17568e757fd66f5ebfcea2b1bb9d3f1
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Jan 28 12:25:07 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Jan 28 12:25:07 2014 -0600
cache/pool: Make the fns in pool_manip.c work with cache pools
The functions in pool_manip.c are specific to thin pools. It's
now time to make them more generic and able to handle cache pools
as well.
---
lib/metadata/pool_manip.c | 44 +++++++++++++++++++++++++++++---------------
1 files changed, 29 insertions(+), 15 deletions(-)
diff --git a/lib/metadata/pool_manip.c b/lib/metadata/pool_manip.c
index 18dfad5..afb77d6 100644
--- a/lib/metadata/pool_manip.c
+++ b/lib/metadata/pool_manip.c
@@ -28,14 +28,15 @@
int attach_pool_metadata_lv(struct lv_segment *pool_seg,
struct logical_volume *metadata_lv)
{
- if (!seg_is_thin_pool(pool_seg)) {
+ if (!seg_is_thin_pool(pool_seg) && !seg_is_cache_pool(pool_seg)) {
log_error(INTERNAL_ERROR
"Unable to attach pool metadata LV to %s segtype.",
pool_seg->segtype->ops->name(pool_seg));
return 0;
}
pool_seg->metadata_lv = metadata_lv;
- metadata_lv->status |= THIN_POOL_METADATA;
+ metadata_lv->status |= seg_is_thin_pool(pool_seg) ?
+ THIN_POOL_METADATA : CACHE_POOL_METADATA;
lv_set_hidden(metadata_lv);
return add_seg_to_segs_using_this_lv(metadata_lv, pool_seg);
@@ -44,7 +45,7 @@ int attach_pool_metadata_lv(struct lv_segment *pool_seg,
int attach_pool_data_lv(struct lv_segment *pool_seg,
struct logical_volume *pool_data_lv)
{
- if (!seg_is_thin_pool(pool_seg)) {
+ if (!seg_is_thin_pool(pool_seg) && !seg_is_cache_pool(pool_seg)) {
log_error(INTERNAL_ERROR
"Unable to attach pool data LV to %s segtype.",
pool_seg->segtype->ops->name(pool_seg));
@@ -52,10 +53,12 @@ int attach_pool_data_lv(struct lv_segment *pool_seg,
}
if (!set_lv_segment_area_lv(pool_seg, 0, pool_data_lv,
- 0, THIN_POOL_DATA))
+ 0, seg_is_thin_pool(pool_seg) ?
+ THIN_POOL_DATA : CACHE_POOL_DATA))
return_0;
- pool_seg->lv->status |= THIN_POOL;
+ pool_seg->lv->status |= seg_is_thin_pool(pool_seg) ?
+ THIN_POOL : CACHE_POOL;
lv_set_hidden(pool_data_lv);
return 1;
@@ -66,16 +69,16 @@ int attach_pool_lv(struct lv_segment *seg,
struct logical_volume *origin,
struct logical_volume *merge_lv)
{
- if (!seg_is_thin_volume(seg)) {
+ if (!seg_is_thin_volume(seg) && !seg_is_cache(seg)) {
log_error(INTERNAL_ERROR "Unable to attach pool to %s/%s"
- " that is thin volume.",
+ " that is not cache or thin volume.",
pool_lv->vg->name, seg->lv->name);
return 0;
}
seg->pool_lv = pool_lv;
seg->origin = origin;
- seg->lv->status |= THIN_VOLUME;
+ seg->lv->status |= seg_is_cache(seg) ? CACHE : THIN_VOLUME;
if (origin && !add_seg_to_segs_using_this_lv(origin, seg))
return_0;
@@ -108,6 +111,13 @@ int detach_pool_lv(struct lv_segment *seg)
return 0;
}
+ if (seg_is_cache(seg)) {
+ if (!remove_seg_from_segs_using_this_lv(seg->pool_lv, seg))
+ return_0;
+ seg->pool_lv = NULL;
+ return 1;
+ }
+
if (!lv_is_thin_pool(seg->pool_lv)) {
log_error(INTERNAL_ERROR
"Cannot detach pool from LV %s.",
@@ -189,9 +199,11 @@ struct lv_segment *find_pool_seg(const struct lv_segment *seg)
return NULL;
}
- if (!seg_is_thin_pool(pool_seg)) {
- log_error("%s on %s is not a pool segment.",
- pool_seg->lv->name, seg->lv->name);
+ if ((lv_is_thin_type(seg->lv) && !seg_is_thin_pool(pool_seg)) &&
+ !seg_is_cache_pool(pool_seg)) {
+ log_error("%s on %s is not a %s pool segment",
+ pool_seg->lv->name, seg->lv->name,
+ lv_is_thin_type(seg->lv) ? "thin" : "cache");
return NULL;
}
@@ -208,7 +220,7 @@ int create_pool(struct logical_volume *pool_lv,
char name[NAME_LEN];
if (pool_lv->le_count) {
- log_error(INTERNAL_ERROR "Pool %s has already extents.",
+ log_error(INTERNAL_ERROR "Pool %s already has extents.",
pool_lv->name);
return 0;
}
@@ -259,7 +271,8 @@ int create_pool(struct logical_volume *pool_lv,
}
if (dm_snprintf(name, sizeof(name), "%s_%s", pool_lv->name,
- "tmeta") < 0) {
+ (segtype_is_cache_pool(segtype)) ?
+ "cmeta" : "tmeta") < 0) {
log_error("Name is too long to be a pool name.");
goto bad;
}
@@ -277,7 +290,8 @@ int create_pool(struct logical_volume *pool_lv,
if (!(data_lv = insert_layer_for_lv(pool_lv->vg->cmd, pool_lv,
pool_lv->status,
- "_tdata")))
+ (segtype_is_cache_pool(segtype)) ?
+ "_cdata" : "_tdata")))
goto_bad;
seg = first_seg(pool_lv);
@@ -285,7 +299,7 @@ int create_pool(struct logical_volume *pool_lv,
if (!remove_seg_from_segs_using_this_lv(data_lv, seg))
goto_bad;
- seg->segtype = segtype; /* Set as thin_pool segment */
+ seg->segtype = segtype; /* Set as thin_pool or cache_pool segment */
if (!attach_pool_data_lv(seg, data_lv))
goto_bad;
10 years, 1 month
master - cache: Allocation code changes necessary to support cache_pool
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=70fd2139e17568...
Commit: 70fd2139e17568e757fd66f5ebfcea2b1bb9d3f1
Parent: 75b8ea195cb3783ebe6ed7f95907e8a647a85a74
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Jan 28 12:25:02 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Jan 28 12:25:02 2014 -0600
cache: Allocation code changes necessary to support cache_pool
Cache pools require a data and metadata area (like thin pools). Unlike
thin pool, if 'cache_pool_metadata_require_separate_pvs' is not set to
'1', the metadata and data area will be allocated from the same device.
It is also done in a manner similar to RAID, where a single chunk of
space is allocated and then split to form the metadata and data device -
ensuring that they are together.
---
conf/example.conf.in | 4 ++++
lib/config/config_settings.h | 1 +
lib/config/defaults.h | 2 ++
lib/metadata/lv_manip.c | 39 ++++++++++++++++++++++++++++++++-------
4 files changed, 39 insertions(+), 7 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 0f73cf3..7b98b4b 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -301,6 +301,10 @@ allocation {
# until version 2.02.85.
mirror_logs_require_separate_pvs = 0
+ # Set to 1 to guarantee that cache_pool metadata will always be
+ # placed on different PVs from the cache_pool data.
+ cache_pool_metadata_require_separate_pvs = 0
+
# Set to 1 to guarantee that thin pool metadata will always
# be placed on different PVs from the pool data.
thin_pool_metadata_require_separate_pvs = 0
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 1546b3f..2c6953b 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -107,6 +107,7 @@ cfg(allocation_maximise_cling_CFG, "maximise_cling", allocation_CFG_SECTION, 0,
cfg(allocation_use_blkid_wiping_CFG, "use_blkid_wiping", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
cfg(allocation_wipe_signatures_when_zeroing_new_lvs_CFG, "wipe_signatures_when_zeroing_new_lvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, 1, vsn(2, 2, 105), NULL)
cfg(allocation_mirror_logs_require_separate_pvs_CFG, "mirror_logs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 85), NULL)
+cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL)
cfg(allocation_thin_pool_metadata_require_separate_pvs_CFG, "thin_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 89), NULL)
cfg(allocation_thin_pool_zero_CFG, "thin_pool_zero", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_THIN_POOL_ZERO, vsn(2, 2, 99), NULL)
cfg(allocation_thin_pool_discards_CFG, "thin_pool_discards", allocation_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_THIN_POOL_DISCARDS, vsn(2, 2, 99), NULL)
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
index 141b7ae..a388e13 100644
--- a/lib/config/defaults.h
+++ b/lib/config/defaults.h
@@ -79,6 +79,8 @@
#define DEFAULT_THIN_POOL_ZERO 1
#define DEFAULT_POOL_METADATA_SPARE 1
+#define DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS 0
+
#define DEFAULT_UMASK 0077
#ifdef LVM1_FALLBACK
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index a2831cf..bd1e57c 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -924,6 +924,9 @@ struct alloc_handle {
* that is new_extents + log_len and then split that between two
* allocated areas when found. 'alloc_and_split_meta' indicates
* that this is the desired dynamic.
+ *
+ * This same idea is used by cache LVs to get the metadata device
+ * and data device allocated together.
*/
unsigned alloc_and_split_meta;
@@ -1115,6 +1118,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
* a correct area_multiple.
*/
ah->area_multiple = _calc_area_multiple(segtype, area_count + parity_count, stripes);
+ //FIXME: s/mirror_logs_separate/metadata_separate/ so it can be used by otehrs?
ah->mirror_logs_separate = find_config_tree_bool(cmd, allocation_mirror_logs_require_separate_pvs_CFG, NULL);
if (segtype_is_raid(segtype)) {
@@ -1137,12 +1141,30 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
ah->log_len = 0;
}
} else if (segtype_is_thin_pool(segtype)) {
- ah->log_area_count = metadata_area_count;
- /* thin_pool uses region_size to pass metadata size in extents */
+ /*
+ * thin_pool uses ah->region_size to
+ * pass metadata size in extents
+ */
ah->log_len = ah->region_size;
+ ah->log_area_count = metadata_area_count;
ah->region_size = 0;
ah->mirror_logs_separate =
find_config_tree_bool(cmd, allocation_thin_pool_metadata_require_separate_pvs_CFG, NULL);
+ } else if (segtype_is_cache_pool(segtype)) {
+ /*
+ * Like thin_pool, cache_pool uses ah->region_size to
+ * pass metadata size in extents
+ */
+ ah->log_len = ah->region_size;
+ /* use metadata_area_count, not log_area_count */
+ ah->metadata_area_count = metadata_area_count;
+ ah->region_size = 0;
+ ah->mirror_logs_separate =
+ find_config_tree_bool(cmd, allocation_cache_pool_metadata_require_separate_pvs_CFG, NULL);
+ if (!ah->mirror_logs_separate) {
+ ah->alloc_and_split_meta = 1;
+ ah->new_extents += ah->log_len;
+ }
} else {
ah->log_area_count = metadata_area_count;
ah->log_len = !metadata_area_count ? 0 :
@@ -1956,14 +1978,15 @@ static void _report_needed_allocation_space(struct alloc_handle *ah,
uint32_t parallel_areas_count, parallel_area_size;
uint32_t metadata_count, metadata_size;
- parallel_area_size = (ah->new_extents - alloc_state->allocated) / ah->area_multiple -
- ((ah->alloc_and_split_meta) ? ah->log_len : 0);
+ parallel_area_size = ah->new_extents - alloc_state->allocated;
+ parallel_area_size /= ah->area_multiple;
+ parallel_area_size -= (ah->alloc_and_split_meta) ? ah->log_len : 0;
parallel_areas_count = ah->area_count + ah->parity_count;
metadata_size = ah->log_len;
if (ah->alloc_and_split_meta) {
- metadata_type = "RAID metadata area";
+ metadata_type = "metadata area";
metadata_count = parallel_areas_count;
} else {
metadata_type = "mirror log";
@@ -1975,8 +1998,10 @@ static void _report_needed_allocation_space(struct alloc_handle *ah,
log_debug_alloc(" %" PRIu32 " (%" PRIu32 " data/%" PRIu32
" parity) parallel areas of %" PRIu32 " extents each",
parallel_areas_count, ah->area_count, ah->parity_count, parallel_area_size);
- log_debug_alloc(" %" PRIu32 " %ss of %" PRIu32 " extents each",
- metadata_count, metadata_type, metadata_size);
+ log_debug_alloc(" %" PRIu32 " %s%s of %" PRIu32 " extents each",
+ metadata_count, metadata_type,
+ (metadata_count == 1) ? "" : "s",
+ metadata_size);
}
/*
* Returns 1 regardless of whether any space was found, except on error.
10 years, 1 month
master - cache: New functions for gathering info on cache devices
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=75b8ea195cb378...
Commit: 75b8ea195cb3783ebe6ed7f95907e8a647a85a74
Parent: d9bec60a233ab3d6a4ac7450771940db9c0d48cf
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Jan 28 12:24:51 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Jan 28 12:24:51 2014 -0600
cache: New functions for gathering info on cache devices
Building on the new DM function that parses DM cache status, we
introduce the following LVM level functions to aquire information
about cache devices:
- lv_cache_block_info: retrieves information on the cache's block/chunk usage
- lv_cache_policy_info: retrieves information on the cache's policy
---
lib/activate/activate.c | 168 ++++++++++++++++++++++++++++++++++++++
lib/activate/activate.h | 6 ++
lib/activate/dev_manager.c | 51 +++++++++++-
lib/activate/dev_manager.h | 3 +
lib/metadata/metadata-exported.h | 11 +++
5 files changed, 238 insertions(+), 1 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 4c8c16d..26dc0e1 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -285,6 +285,18 @@ int lv_raid_message(const struct logical_volume *lv, const char *msg)
{
return 0;
}
+int lv_cache_block_info(const struct logical_volume *lv,
+ uint32_t *chunk_size, uint64_t *dirty_count,
+ uint64_t *used_count, uint64_t *total_count)
+{
+ return 0;
+}
+int lv_cache_policy_info(const struct logical_volume *lv,
+ char **policy_name, int *policy_argc,
+ char ***policy_argv)
+{
+ return 0;
+}
int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
percent_t *percent)
{
@@ -969,6 +981,162 @@ out:
return r;
}
+int lv_cache_block_info(struct logical_volume *lv,
+ uint32_t *chunk_size, uint64_t *dirty_count,
+ uint64_t *used_count, uint64_t *total_count)
+{
+ struct lv_segment *cache_seg;
+ struct logical_volume *cache_lv;
+ struct dev_manager *dm;
+ struct dm_status_cache *status;
+
+ /* The user is free to choose which args they are interested in */
+ if (chunk_size)
+ *chunk_size = 0;
+ if (dirty_count)
+ *dirty_count = 0;
+ if (used_count)
+ *used_count = 0;
+ if (total_count)
+ *total_count = 0;
+
+ if (lv_is_cache(lv))
+ cache_lv = lv;
+ else if (lv_is_cache_pool(lv)) {
+ if (dm_list_empty(&lv->segs_using_this_lv)) {
+ //FIXME: Ok to return value not sourced from kernel?
+ // This could be valuable - esp for 'lvs' output
+ log_error(INTERNAL_ERROR "Unable to get block info"
+ " of unlinked cache_pool, %s", lv->name);
+ //FIXME: ... because we could do this:
+ if (chunk_size)
+ *chunk_size = first_seg(lv)->chunk_size;
+ /* Unlinked cache_pools have 0 dirty & used blocks */
+ if (total_count) {
+ *total_count = lv->size; /* in sectors */
+ *total_count /= first_seg(lv)->chunk_size;
+ }
+
+ return 1;
+ }
+ if (!(cache_seg = get_only_segment_using_this_lv(lv)))
+ return_0;
+ cache_lv = cache_seg->lv;
+ } else {
+ log_error(INTERNAL_ERROR
+ "Unable to get block info of non-cache LV, %s",
+ lv->name);
+ return 0;
+ }
+
+ if (!lv_info(cache_lv->vg->cmd, cache_lv, 0, NULL, 0, 0))
+ return_0;
+
+ log_debug_activation("Checking cache block info for LV %s/%s",
+ cache_lv->vg->name, cache_lv->name);
+
+ if (!(dm = dev_manager_create(cache_lv->vg->cmd, cache_lv->vg->name, 1)))
+ return_0;
+
+ if (!dev_manager_cache_status(dm, cache_lv, &status)) {
+ dev_manager_destroy(dm);
+ return_0;
+ }
+
+ if (chunk_size)
+ *chunk_size = status->block_size;
+ if (dirty_count)
+ *dirty_count = status->dirty_blocks;
+ if (used_count)
+ *used_count = status->used_blocks;
+ if (total_count)
+ *total_count = status->total_blocks;
+
+ dev_manager_destroy(dm);
+
+ return 1;
+}
+
+int lv_cache_policy_info(struct logical_volume *lv,
+ char **policy_name, int *policy_argc,
+ char ***policy_argv)
+{
+ int i;
+ struct lv_segment *cache_seg;
+ struct logical_volume *cache_lv;
+ struct dev_manager *dm;
+ struct dm_status_cache *status;
+ struct dm_pool *mem = lv->vg->cmd->mem;
+
+ /* The user is free to choose which args they are interested in */
+ if (policy_name)
+ *policy_name = NULL;
+ if (policy_argc)
+ *policy_argc = 0;
+ if (policy_argv)
+ *policy_argv = NULL;
+
+ if (lv_is_cache(lv))
+ cache_lv = lv;
+ else if (lv_is_cache_pool(lv)) {
+ if (dm_list_empty(&lv->segs_using_this_lv)) {
+ //FIXME: Ok to return value not sourced from kernel?
+ log_error(INTERNAL_ERROR "Unable to get policy info"
+ " of unlinked cache_pool, %s", lv->name);
+ //FIXME: ... because we could do this:
+ if (policy_name)
+ *policy_name = first_seg(lv)->policy_name;
+ if (policy_argc)
+ *policy_argc = first_seg(lv)->policy_argc;
+ if (policy_argv)
+ *policy_argv = first_seg(lv)->policy_argv;
+
+ return 1;
+ }
+ if (!(cache_seg = get_only_segment_using_this_lv(lv)))
+ return_0;
+ cache_lv = cache_seg->lv;
+ } else {
+ log_error(INTERNAL_ERROR
+ "Unable to get policy info of non-cache LV, %s",
+ lv->name);
+ return 0;
+ }
+
+ if (!lv_info(cache_lv->vg->cmd, cache_lv, 0, NULL, 0, 0))
+ return_0;
+
+ log_debug_activation("Checking cache policy for LV %s/%s",
+ cache_lv->vg->name, cache_lv->name);
+
+ if (!(dm = dev_manager_create(cache_lv->vg->cmd, cache_lv->vg->name, 1)))
+ return_0;
+
+ if (!dev_manager_cache_status(dm, cache_lv, &status)) {
+ dev_manager_destroy(dm);
+ return_0;
+ }
+
+ if (policy_name &&
+ !(*policy_name = dm_pool_strdup(mem, status->policy_name)))
+ return_0;
+ if (policy_argc)
+ *policy_argc = status->policy_argc;
+ if (policy_argv) {
+ if (!(*policy_argv =
+ dm_pool_zalloc(mem, sizeof(char *) * *policy_argc)))
+ return_0;
+ for (i = 0; i < *policy_argc; i++)
+ if (!((*policy_argv)[i] =
+ dm_pool_strdup(mem, status->policy_argv[i])))
+ return_0;
+ }
+
+ dev_manager_destroy(dm);
+
+ return 1;
+}
+
/*
* Returns data or metadata percent usage, depends on metadata 0/1.
* Returns 1 if percent set, else 0 on failure.
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index f748a04..3da83ea 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -135,6 +135,12 @@ int lv_raid_dev_health(const struct logical_volume *lv, char **dev_health);
int lv_raid_mismatch_count(const struct logical_volume *lv, uint64_t *cnt);
int lv_raid_sync_action(const struct logical_volume *lv, char **sync_action);
int lv_raid_message(const struct logical_volume *lv, const char *msg);
+int lv_cache_block_info(struct logical_volume *lv,
+ uint32_t *chunk_size, uint64_t *dirty_count,
+ uint64_t *used_count, uint64_t *total_count);
+int lv_cache_policy_info(struct logical_volume *lv,
+ char **policy_name, int *policy_argc,
+ char ***policy_argv);
int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
percent_t *percent);
int lv_thin_percent(const struct logical_volume *lv, int mapped,
diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 7b0b6e2..b48ca99 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2002-2004 Sistina Software, Inc. All rights reserved.
- * Copyright (C) 2004-2013 Red Hat, Inc. All rights reserved.
+ * Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -1160,6 +1160,55 @@ out:
return r;
}
+int dev_manager_cache_status(struct dev_manager *dm,
+ const struct logical_volume *lv,
+ struct dm_status_cache **status)
+{
+ int r = 0;
+ const char *dlid;
+ struct dm_task *dmt;
+ struct dm_info info;
+ uint64_t start, length;
+ char *type = NULL;
+ char *params = NULL;
+ const char *layer = lv_layer(lv);
+
+ if (!(dlid = build_dm_uuid(dm->mem, lv->lvid.s, layer)))
+ return_0;
+
+ log_debug_activation("Getting cache device status for %s.", lv->name);
+
+ if (!(dmt = _setup_task(NULL, dlid, 0, DM_DEVICE_STATUS, 0, 0)))
+ return_0;
+
+ if (!dm_task_no_open_count(dmt))
+ log_error("Failed to disable open_count.");
+
+ if (!dm_task_run(dmt))
+ goto_out;
+
+ if (!dm_task_get_info(dmt, &info) || !info.exists)
+ goto_out;
+
+ dm_get_next_target(dmt, NULL, &start, &length, &type, ¶ms);
+
+ if (!type || strcmp(type, "cache")) {
+ log_debug("Expected cache segment type but got %s instead",
+ type ? type : "NULL");
+ goto out;
+ }
+
+ if (!dm_get_status_cache(dm->mem, params, status))
+ goto_out;
+
+ r = 1;
+out:
+ dm_task_destroy(dmt);
+
+ return r;
+}
+
+//FIXME: Can we get rid of this crap below?
#if 0
log_very_verbose("%s %s", sus ? "Suspending" : "Resuming", name);
diff --git a/lib/activate/dev_manager.h b/lib/activate/dev_manager.h
index 032766e..446b349 100644
--- a/lib/activate/dev_manager.h
+++ b/lib/activate/dev_manager.h
@@ -60,6 +60,9 @@ int dev_manager_raid_status(struct dev_manager *dm,
int dev_manager_raid_message(struct dev_manager *dm,
const struct logical_volume *lv,
const char *msg);
+int dev_manager_cache_status(struct dev_manager *dm,
+ const struct logical_volume *lv,
+ struct dm_status_cache **status);
int dev_manager_thin_pool_status(struct dev_manager *dm,
const struct logical_volume *lv,
struct dm_status_thin_pool **status,
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 1ebf69f..97f05fc 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -110,6 +110,11 @@
this flag dropped during single
LVM command execution. */
+#define CACHE_POOL UINT64_C(0x0000200000000000) /* LV */
+#define CACHE_POOL_DATA UINT64_C(0x0000400000000000) /* LV */
+#define CACHE_POOL_METADATA UINT64_C(0x0000800000000000) /* LV */
+#define CACHE UINT64_C(0x0001000000000000) /* LV */
+
/* Format features flags */
#define FMT_SEGMENTS 0x00000001U /* Arbitrary segment params? */
#define FMT_MDAS 0x00000002U /* Proper metadata areas? */
@@ -169,6 +174,12 @@
#define lv_is_raid(lv) (((lv)->status & (RAID)) ? 1 : 0)
#define lv_is_raid_type(lv) (((lv)->status & (RAID | RAID_IMAGE | RAID_META)) ? 1 : 0)
+#define lv_is_cache(lv) (((lv)->status & (CACHE)) ? 1 : 0)
+#define lv_is_cache_pool(lv) (((lv)->status & (CACHE_POOL)) ? 1 : 0)
+#define lv_is_cache_pool_data(lv) (((lv)->status & (CACHE_POOL_DATA)) ? 1 : 0)
+#define lv_is_cache_pool_metadata(lv) (((lv)->status & (CACHE_POOL_METADATA)) ? 1 : 0)
+#define lv_is_cache_type(lv) (((lv)->status & (CACHE | CACHE_POOL | CACHE_POOL_DATA | CACHE_POOL_METADATA)) ? 1 : 0)
+
#define lv_is_virtual(lv) (((lv)->status & VIRTUAL) ? 1 : 0)
#define lv_is_pool_metadata_spare(lv) (((lv)->status & POOL_METADATA_SPARE) ? 1 : 0)
10 years, 1 month
master - cache/misc: Revert commit 94377dfd
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d9bec60a233ab3...
Commit: d9bec60a233ab3d6a4ac7450771940db9c0d48cf
Parent: 42fa0e6dd14a105d17ca329f73e27f1daa64e9f3
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Jan 28 11:26:05 2014 -0600
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Jan 28 11:26:05 2014 -0600
cache/misc: Revert commit 94377dfd
I am reverting the commit below - removing the new 'dm_config_get_int'
function and simply calling 'dm_config_get_uint32' while casting the
'int *' pointer parameter.
Commit being reverted:
commit 94377dfd5ee7bbbdeb8836eeeea2198bc32c07f5
Author: Jonathan Brassow <jbrassow(a)redhat.com>
Date: Mon Jan 27 05:26:19 2014 -0600
Misc: New function for reading lvm config file fields
Introduce 'dm_config_get_int', which will be used by the upcoming
cachepool segment type.
---
lib/cache_segtype/cache.c | 6 ++++--
libdm/libdevmapper.h | 1 -
libdm/libdm-config.c | 14 --------------
3 files changed, 4 insertions(+), 17 deletions(-)
diff --git a/lib/cache_segtype/cache.c b/lib/cache_segtype/cache.c
index bfc84c3..3e74495 100644
--- a/lib/cache_segtype/cache.c
+++ b/lib/cache_segtype/cache.c
@@ -97,7 +97,8 @@ static int _cache_pool_text_import(struct lv_segment *seg,
if (!dm_config_has_node(sn, "core_argv"))
return SEG_LOG_ERROR("not all core arguments defined in");
- if (!dm_config_get_int(sn, "core_argc", &seg->core_argc))
+ if (!dm_config_get_uint32(sn, "core_argc",
+ (uint32_t *)&seg->core_argc))
return SEG_LOG_ERROR("Unable to read core_argc in");
str = dm_config_find_str(sn, "core_argv", NULL);
@@ -135,7 +136,8 @@ static int _cache_pool_text_import(struct lv_segment *seg,
return SEG_LOG_ERROR("policy_name must be a string in");
seg->policy_name = dm_pool_strdup(mem, str);
- if (!dm_config_get_int(sn, "policy_argc", &seg->policy_argc))
+ if (!dm_config_get_uint32(sn, "policy_argc",
+ (uint32_t *)&seg->policy_argc))
return SEG_LOG_ERROR("Unable to read policy_argc in");
str = dm_config_find_str(sn, "policy_argv", NULL);
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 670c5e09..131bd3f 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1720,7 +1720,6 @@ int dm_config_tree_find_bool(const struct dm_config_tree *cft, const char *path,
int dm_config_find_bool(const struct dm_config_node *cn, const char *path, int fail);
int dm_config_value_is_bool(const struct dm_config_value *v);
-int dm_config_get_int(const struct dm_config_node *cn, const char *path, int *result);
int dm_config_get_uint32(const struct dm_config_node *cn, const char *path, uint32_t *result);
int dm_config_get_uint64(const struct dm_config_node *cn, const char *path, uint64_t *result);
int dm_config_get_str(const struct dm_config_node *cn, const char *path, const char **result);
diff --git a/libdm/libdm-config.c b/libdm/libdm-config.c
index 3297621..ea1af2f 100644
--- a/libdm/libdm-config.c
+++ b/libdm/libdm-config.c
@@ -1047,20 +1047,6 @@ int dm_config_tree_find_bool(const struct dm_config_tree *cft, const char *path,
/************************************/
-int dm_config_get_int(const struct dm_config_node *cn, const char *path,
- int *result)
-{
- const struct dm_config_node *n;
-
- n = _find_config_node(cn, path);
-
- if (!n || !n->v || n->v->type != DM_CFG_INT)
- return 0;
-
- if (result)
- *result = n->v->v.i;
- return 1;
-}
int dm_config_get_uint32(const struct dm_config_node *cn, const char *path,
uint32_t *result)
10 years, 1 month
master - tests: validate acceptable external origin size
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=42fa0e6dd14a10...
Commit: 42fa0e6dd14a105d17ca329f73e27f1daa64e9f3
Parent: 155405b0e1d310fbc44f263c5e3a5c5d23043207
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jan 29 14:23:50 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 29 14:59:09 2014 +0100
tests: validate acceptable external origin size
---
test/shell/lvconvert-thin-external.sh | 8 ++++++--
test/shell/lvcreate-thin-external.sh | 10 ++++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvconvert-thin-external.sh b/test/shell/lvconvert-thin-external.sh
index 53758fc..dbe5972 100644
--- a/test/shell/lvconvert-thin-external.sh
+++ b/test/shell/lvconvert-thin-external.sh
@@ -49,9 +49,13 @@ fi
lvcreate -l10 -T $vg/pool
# Can't convert pool to external origin
-lvcreate -l10 -T $vg/pool1
+lvcreate -l10 -T $vg/pool1 -c 192k
not lvconvert -T --thinpool $vg/pool1 $vg/pool --originname origin
-lvremove -f $vg/pool1
+# Create pool1 chunk_size unaligned LV and check failing conversion
+lvcreate -l2 -n $lv1 $vg
+not lvconvert -T --thinpool $vg/pool1 $vg/$lv1
+
+lvremove -f $vg/pool1 $vg/$lv1
# create plain LV (will be used for external origin)
lvcreate -L8M -n $lv1 $vg
diff --git a/test/shell/lvcreate-thin-external.sh b/test/shell/lvcreate-thin-external.sh
index c9aba6f..14c7f82 100644
--- a/test/shell/lvcreate-thin-external.sh
+++ b/test/shell/lvcreate-thin-external.sh
@@ -26,6 +26,16 @@ aux prepare_pvs 2 64
vgcreate $vg -s 64K $(cat DEVICES)
+# Test validation for external origin being multiple of thin pool chunk size
+lvcreate -L10M -T $vg/pool192 -c 192k
+lvcreate -an -pr -Zn -l1 -n $lv1 $vg
+not lvcreate -s $vg/$lv1 --thinpool $vg/pool192
+
+lvcreate -an -pr -Zn -l5 -n $lv2 $vg
+not lvcreate -s $vg/$lv2 --thinpool $vg/pool192
+lvremove -f $vg
+
+# Prepare pool and external origin with filesystem
lvcreate -L10M -V10M -T $vg/pool --name $lv1
mkfs.ext2 $DM_DEV_DIR/$vg/$lv1
10 years, 1 month