master - config: update doc
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b185a3e3334e72...
Commit: b185a3e3334e72c3aae6791ec4cb8768d55e0b9b
Parent: aa0c735e2ccbea969bad846f3e89c91a81d88fbf
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Feb 13 09:58:46 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Feb 13 10:06:07 2017 +0100
config: update doc
---
conf/example.conf.in | 1 +
lib/config/config_settings.h | 4 +++-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 7cb6f4a..5e238e4 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -2054,6 +2054,7 @@ dmeventd {
# or metadata volume gets above 50%.
# Command which starts with 'lvm ' prefix is internal lvm command.
# You can write your own handler to customise behaviour in more details.
+ # User handler is specified with the full path starting with '/'.
# This configuration option has an automatic default value.
# thin_command = "lvm lvextend --use-policies"
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 8f49b12..1d9603f 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -1863,7 +1863,9 @@ cfg(dmeventd_thin_command_CFG, "thin_command", dmeventd_CFG_SECTION, CFG_DEFAULT
"The plugin runs command with each 5% increment when thin-pool data volume\n"
"or metadata volume gets above 50%.\n"
"Command which starts with 'lvm ' prefix is internal lvm command.\n"
- "You can write your own handler to customise behaviour in more details.\n")
+ "You can write your own handler to customise behaviour in more details.\n"
+ "User handler is specified with the full path starting with '/'.\n")
+ /* TODO: systemd service handler */
cfg(dmeventd_executable_CFG, "executable", dmeventd_CFG_SECTION, CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_DMEVENTD_PATH, vsn(2, 2, 73), "@DMEVENTD_PATH@", 0, NULL,
"The full path to the dmeventd binary.\n")
7 years, 2 months
master - dmeventd: limit thin_command usage
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=aa0c735e2ccbea...
Commit: aa0c735e2ccbea969bad846f3e89c91a81d88fbf
Parent: 416f9512830ff81e32852f2fce0ee7e36fcdb50f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Feb 12 22:07:23 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Feb 13 09:43:53 2017 +0100
dmeventd: limit thin_command usage
Require usable command string to begining with '/'
So 'thin_command = "/some/path/command"' is the only supported variant
to internal 'lvm' command.
---
daemons/dmeventd/plugins/thin/dmeventd_thin.c | 47 +++++++++++++++---------
1 files changed, 29 insertions(+), 18 deletions(-)
diff --git a/daemons/dmeventd/plugins/thin/dmeventd_thin.c b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
index cf57d20..e447ba2 100644
--- a/daemons/dmeventd/plugins/thin/dmeventd_thin.c
+++ b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
@@ -58,8 +58,8 @@ struct dso_state {
int restore_sigset;
sigset_t old_sigset;
pid_t pid;
- char **argv;
- char cmd_str[1024];
+ char *argv[3];
+ char *cmd_str;
};
DM_EVENT_LOG_FN("thin")
@@ -85,7 +85,7 @@ static int _run_command(struct dso_state *state)
} else {
/* For an error event it's for a user to check status and decide */
env[1] = NULL;
- log_debug("Error event processing");
+ log_debug("Error event processing.");
}
log_verbose("Executing command: %s", state->cmd_str);
@@ -115,7 +115,7 @@ static int _use_policy(struct dm_task *dmt, struct dso_state *state)
#if THIN_DEBUG
log_debug("dmeventd executes: %s.", state->cmd_str);
#endif
- if (state->argv)
+ if (state->argv[0])
return _run_command(state);
if (!dmeventd_lvm2_run_with_lock(state->cmd_str)) {
@@ -352,34 +352,43 @@ int register_device(const char *device,
void **user)
{
struct dso_state *state;
- int maxcmd;
char *str;
+ char cmd_str[PATH_MAX + 128 + 2]; /* cmd ' ' vg/lv \0 */
if (!dmeventd_lvm2_init_with_pool("thin_pool_state", state))
goto_bad;
- if (!dmeventd_lvm2_command(state->mem, state->cmd_str,
- sizeof(state->cmd_str),
+ if (!dmeventd_lvm2_command(state->mem, cmd_str, sizeof(cmd_str),
"_dmeventd_thin_command", device)) {
dmeventd_lvm2_exit_with_pool(state);
goto_bad;
}
- if (strncmp(state->cmd_str, "lvm ", 4)) {
- maxcmd = 2; /* space for last NULL element */
- for (str = state->cmd_str; *str; str++)
- if (*str == ' ')
- maxcmd++;
- if (!(str = dm_pool_strdup(state->mem, state->cmd_str)) ||
- !(state->argv = dm_pool_zalloc(state->mem, maxcmd * sizeof(char *)))) {
- log_error("Failed to allocate memory for command.");
+ if (strncmp(cmd_str, "lvm ", 4) == 0) {
+ if (!(state->cmd_str = dm_pool_strdup(state->mem, cmd_str + 4))) {
+ log_error("Failed to copy lvm command.");
+ goto bad;
+ }
+ } else if (cmd_str[0] == '/') {
+ if (!(state->cmd_str = dm_pool_strdup(state->mem, cmd_str))) {
+ log_error("Failed to copy thin command.");
goto bad;
}
- dm_split_words(str, maxcmd - 1, 0, state->argv);
+ /* Find last space before 'vg/lv' */
+ if (!(str = strrchr(state->cmd_str, ' ')))
+ goto inval;
+
+ if (!(state->argv[0] = dm_pool_strndup(state->mem, state->cmd_str,
+ str - state->cmd_str))) {
+ log_error("Failed to copy command.");
+ goto bad;
+ }
+
+ state->argv[1] = str + 1; /* 1 argument - vg/lv */
_init_thread_signals(state);
- } else
- memmove(state->cmd_str, state->cmd_str + 4, strlen(state->cmd_str + 4) + 1);
+ } else /* Unuspported command format */
+ goto inval;
state->pid = -1;
*user = state;
@@ -387,6 +396,8 @@ int register_device(const char *device,
log_info("Monitoring thin pool %s.", device);
return 1;
+inval:
+ log_error("Invalid command for monitoring: %s.", cmd_str);
bad:
log_error("Failed to monitor thin pool %s.", device);
7 years, 2 months
master - coverity: fix double free
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=416f9512830ff8...
Commit: 416f9512830ff81e32852f2fce0ee7e36fcdb50f
Parent: a7d2ee4bc2dd032cd15db028b3c118ce7138c854
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Feb 11 21:20:12 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Feb 12 17:28:44 2017 +0100
coverity: fix double free
Do not try to free hist_arg twice.
---
libdm/libdm-stats.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index 032be03..34e117e 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4725,7 +4725,7 @@ static uint64_t *_stats_map_file_regions(struct dm_stats *dms, int fd,
dm_pool_free(extent_mem, extents);
dm_pool_destroy(extent_mem);
- dm_free(hist_arg);
+
return regions;
out_remove:
7 years, 2 months
master - coverity: fix mem leak on error path in dm stats
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a7d2ee4bc2dd03...
Commit: a7d2ee4bc2dd032cd15db028b3c118ce7138c854
Parent: 0844b20f985177f60db48dc84bcde7170d17a77e
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Feb 11 21:17:41 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sun Feb 12 17:28:13 2017 +0100
coverity: fix mem leak on error path in dm stats
Free allocated resouces on error path.
---
libdm/libdm-stats.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-stats.c b/libdm/libdm-stats.c
index f68874c..032be03 100644
--- a/libdm/libdm-stats.c
+++ b/libdm/libdm-stats.c
@@ -4842,7 +4842,7 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
if (!bounds) {
log_error("Could not allocate memory for group "
"histogram bounds.");
- return NULL;
+ goto out;
}
_stats_copy_histogram_bounds(bounds,
dms->regions[group_id].bounds);
@@ -4869,6 +4869,8 @@ uint64_t *dm_stats_update_regions_from_fd(struct dm_stats *dms, int fd,
bad:
_stats_cleanup_region_ids(dms, regions, count);
dm_free(bounds);
+ dm_free(regions);
+out:
dm_free((char *) alias);
return NULL;
}
7 years, 2 months
master - coverity: remove unneeded header files
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=0844b20f985177...
Commit: 0844b20f985177f60db48dc84bcde7170d17a77e
Parent: 375e38709ca2842c97ee56899a8a3f34abc61a30
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Feb 11 21:17:27 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Feb 11 21:17:27 2017 +0100
coverity: remove unneeded header files
---
daemons/dmeventd/plugins/thin/dmeventd_thin.c | 1 -
lib/metadata/raid_manip.c | 1 -
lib/misc/lvm-flock.c | 1 -
3 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/daemons/dmeventd/plugins/thin/dmeventd_thin.c b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
index f551971..cf57d20 100644
--- a/daemons/dmeventd/plugins/thin/dmeventd_thin.c
+++ b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
@@ -18,7 +18,6 @@
#include <sys/wait.h>
#include <stdarg.h>
-#include <pthread.h>
/* TODO - move this mountinfo code into library to be reusable */
#ifdef __linux__
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 25783a8..0f0631f 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -21,7 +21,6 @@
#include "activate.h"
#include "lv_alloc.h"
#include "lvm-string.h"
-#include "lvm-signal.h"
static int _check_restriping(uint32_t new_stripes, struct logical_volume *lv)
{
diff --git a/lib/misc/lvm-flock.c b/lib/misc/lvm-flock.c
index 0b90f8f..22eb128 100644
--- a/lib/misc/lvm-flock.c
+++ b/lib/misc/lvm-flock.c
@@ -15,7 +15,6 @@
#include "lib.h"
#include "config.h"
-#include "lvm-file.h"
#include "lvm-flock.h"
#include "lvm-signal.h"
#include "locking.h"
7 years, 2 months
master - cleanup: drop double const specifier
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=375e38709ca284...
Commit: 375e38709ca2842c97ee56899a8a3f34abc61a30
Parent: 2a9eda1229c9d5d7150acdd3d8dd4908fbc784a8
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Feb 11 20:30:16 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Feb 11 20:30:16 2017 +0100
cleanup: drop double const specifier
Remove duplicated 'const' specifier.
Reindent.
---
daemons/lvmpolld/lvmpolld-cmd-utils.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/daemons/lvmpolld/lvmpolld-cmd-utils.c b/daemons/lvmpolld/lvmpolld-cmd-utils.c
index f70fd0d..601338f 100644
--- a/daemons/lvmpolld/lvmpolld-cmd-utils.c
+++ b/daemons/lvmpolld/lvmpolld-cmd-utils.c
@@ -19,10 +19,12 @@
#define MIN_ARGV_SIZE 8
-static const char *const const polling_ops[] = { [PVMOVE] = LVMPD_REQ_PVMOVE,
- [CONVERT] = LVMPD_REQ_CONVERT,
- [MERGE] = LVMPD_REQ_MERGE,
- [MERGE_THIN] = LVMPD_REQ_MERGE_THIN };
+static const char *const polling_ops[] = {
+ [PVMOVE] = LVMPD_REQ_PVMOVE,
+ [CONVERT] = LVMPD_REQ_CONVERT,
+ [MERGE] = LVMPD_REQ_MERGE,
+ [MERGE_THIN] = LVMPD_REQ_MERGE_THIN
+};
const char *polling_op(enum poll_type type)
{
7 years, 2 months
master - mem: add extra mem pages for pthread stack
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2a9eda1229c9d5...
Commit: 2a9eda1229c9d5d7150acdd3d8dd4908fbc784a8
Parent: 8296b99a89b849d7d7b5dcac6214582b3eaad639
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Feb 11 18:14:00 2017 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Sat Feb 11 18:23:15 2017 +0100
mem: add extra mem pages for pthread stack
Some archs can use even 64K pages and then lvm2 runs into trouble if
the stack is 'too small' to fit extra page capturing stack overwrite.
So when lvm2 limits stack - add extra mem page - be it 4K or 64K.
Relates to ppc64le bug: https://bugzilla.redhat.com/1387279
---
WHATS_NEW | 1 +
WHATS_NEW_DM | 1 +
daemons/clvmd/clvmd.c | 2 +-
daemons/dmeventd/dmeventd.c | 2 +-
libdaemon/server/daemon-server.c | 2 +-
5 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index e5f1ba1..b497c7e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.169 -
=====================================
+ Add extra memory page when limiting pthread stack size in clvmd.
Support striped/raid0* <-> raid10_near conversions
Support shrinking of RaidLvs
Support region size changes on existing RaidLVs
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 47f647a..f11b28c 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.138 -
=====================================
+ Add extra memory page when limiting pthread stack size in dmeventd.
Avoids immediate resume when preloaded device is smaller.
Do not suppress kernel key description in dmsetup table output.
Support configurable command executed from dmeventd thin plugin.
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index a276c63..dcc986b 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -517,7 +517,7 @@ int main(int argc, char *argv[])
/* Initialise the LVM thread variables */
dm_list_init(&lvm_cmd_head);
if (pthread_attr_init(&stack_attr) ||
- pthread_attr_setstacksize(&stack_attr, STACK_SIZE)) {
+ pthread_attr_setstacksize(&stack_attr, STACK_SIZE + getpagesize())) {
log_sys_error("pthread_attr_init", "");
exit(1);
}
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 58922ac..a2883a1 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -468,7 +468,7 @@ static int _pthread_create_smallstack(pthread_t *t, void *(*fun)(void *), void *
/*
* We use a smaller stack since it gets preallocated in its entirety
*/
- pthread_attr_setstacksize(&attr, THREAD_STACK_SIZE);
+ pthread_attr_setstacksize(&attr, THREAD_STACK_SIZE + getpagesize());
/*
* If no-one will be waiting, we need to detach.
diff --git a/libdaemon/server/daemon-server.c b/libdaemon/server/daemon-server.c
index 6af6de9..10cc8f7 100644
--- a/libdaemon/server/daemon-server.c
+++ b/libdaemon/server/daemon-server.c
@@ -42,7 +42,7 @@ static int _pthread_create(pthread_t *t, void *(*fun)(void *), void *arg, int st
/*
* We use a smaller stack since it gets preallocated in its entirety
*/
- pthread_attr_setstacksize(&attr, stacksize);
+ pthread_attr_setstacksize(&attr, stacksize + getpagesize());
return pthread_create(t, &attr, fun, arg);
}
#endif
7 years, 2 months
master - lvconvert: remove test code
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8296b99a89b849...
Commit: 8296b99a89b849d7d7b5dcac6214582b3eaad639
Parent: 28ea66d46d46414d6ab1c452115ff5120f4a9525
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Feb 10 23:43:56 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Feb 10 23:44:27 2017 +0100
lvconvert: remove test code
Remove allocate_pvs from raid_manip.c:_region_size_change_request() API
and lv_extend() using it added for temporary test purpose.
Related: rhbz1366296
---
lib/metadata/raid_manip.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index dbb6128..25783a8 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -4122,8 +4122,7 @@ replaced:
* Change region size on raid @lv to @region_size if
* different from current region_size and adjusted region size
*/
-static int _region_size_change_requested(struct logical_volume *lv, int yes, const uint32_t region_size,
- struct dm_list *allocate_pvs)
+static int _region_size_change_requested(struct logical_volume *lv, int yes, const uint32_t region_size)
{
uint32_t old_region_size;
const char *seg_region_size_str;
@@ -4185,7 +4184,6 @@ static int _region_size_change_requested(struct logical_volume *lv, int yes, con
_raid_rmeta_extents(lv->vg->cmd, lv->le_count, seg->region_size, lv->vg->extent_size)) {
log_error("Region size %s on %s is too small for metadata LV size.",
seg_region_size_str, display_lvname(lv));
-if (!lv_extend(lv, seg->segtype, seg->area_count - seg->segtype->parity_devs, seg->stripe_size, 1, seg->region_size, 0, allocate_pvs, lv->vg->alloc, 0))
return 0;
}
@@ -4290,7 +4288,7 @@ int lv_raid_convert(struct logical_volume *lv,
if (new_segtype == seg->segtype &&
new_region_size != seg->region_size &&
seg_is_raid(seg) && !seg_is_any_raid0(seg))
- return _region_size_change_requested(lv, yes, new_region_size, allocate_pvs);
+ return _region_size_change_requested(lv, yes, new_region_size);
} else
region_size = seg->region_size ? : get_default_region_size(lv->vg->cmd);
7 years, 2 months
master - lvconvert: add region size checks
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=28ea66d46d4641...
Commit: 28ea66d46d46414d6ab1c452115ff5120f4a9525
Parent: caa2094e33188806137a8fe6d8c6ecce779ecc59
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Feb 10 23:35:53 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Feb 10 23:37:08 2017 +0100
lvconvert: add region size checks
Add:
- region size checks to raid_manip.c types array and supporting functions
- tests to lvconvert-raid-takeover.sh to check bogus
"lvconvert --type --regionsize N " requests
Related: rhbz1366296
---
lib/metadata/raid_manip.c | 72 +++++++++++++++++++++------------
test/shell/lvconvert-raid-takeover.sh | 5 ++
2 files changed, 51 insertions(+), 26 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 3ed8ee3..dbb6128 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -2763,6 +2763,7 @@ static struct lv_segment *_convert_striped_to_raid0(struct logical_volume *lv,
#define ALLOW_NONE 0x0
#define ALLOW_STRIPES 0x2
#define ALLOW_STRIPE_SIZE 0x4
+#define ALLOW_REGION_SIZE 0x8
struct possible_takeover_reshape_type {
/* First 2 have to stay... */
@@ -2779,64 +2780,77 @@ struct possible_type {
};
static struct possible_takeover_reshape_type _possible_takeover_reshape_types[] = {
- /* striped -> */
+ /* striped -> raid1 */
{ .current_types = SEG_STRIPED_TARGET, /* linear, i.e. seg->area_count = 1 */
.possible_types = SEG_RAID1,
.current_areas = 1,
- .options = ALLOW_NONE }, /* FIXME: ALLOW_REGION_SIZE */
+ .options = ALLOW_REGION_SIZE },
+
{ .current_types = SEG_STRIPED_TARGET, /* linear, i.e. seg->area_count = 1 */
.possible_types = SEG_RAID0|SEG_RAID0_META,
.current_areas = 1,
.options = ALLOW_STRIPE_SIZE },
- /* raid0* -> */
+ /* raid0* -> raid1 */
{ .current_types = SEG_RAID0|SEG_RAID0_META, /* seg->area_count = 1 */
.possible_types = SEG_RAID1,
.current_areas = 1,
- .options = ALLOW_NONE }, /* FIXME: ALLOW_REGION_SIZE */
+ .options = ALLOW_REGION_SIZE },
+
+ /* striped,raid0* <-> striped,raid0* */
+ { .current_types = SEG_STRIPED_TARGET|SEG_RAID0|SEG_RAID0_META,
+ .possible_types = SEG_STRIPED_TARGET|SEG_RAID0|SEG_RAID0_META,
+ .current_areas = ~0U,
+ .options = ALLOW_NONE },
- /* striped,raid0*,raid4,raid5_n,raid6_n_6 <-> striped,raid0*,raid4,raid5_n,raid6_n_6 */
- { .current_types = SEG_STRIPED_TARGET|SEG_RAID0|SEG_RAID0_META|SEG_RAID4|SEG_RAID5_N|SEG_RAID6_N_6,
- .possible_types = SEG_STRIPED_TARGET|SEG_RAID0|SEG_RAID0_META|SEG_RAID4|SEG_RAID5_N|SEG_RAID6_N_6,
+ /* striped,raid0* -> raid4,raid5_n,raid6_n_6,raid10_near */
+ { .current_types = SEG_STRIPED_TARGET|SEG_RAID0|SEG_RAID0_META,
+ .possible_types = SEG_RAID4|SEG_RAID5_N|SEG_RAID6_N_6|SEG_RAID10_NEAR,
.current_areas = ~0U,
- .options = ALLOW_NONE }, /* FIXME: ALLOW_REGION_SIZE */
+ .options = ALLOW_REGION_SIZE },
- /* striped,raid0* <-> raid10_near */
- { .current_types = SEG_STRIPED_TARGET|SEG_RAID0|SEG_RAID0_META|SEG_RAID10_NEAR,
- .possible_types = SEG_STRIPED_TARGET|SEG_RAID0|SEG_RAID0_META|SEG_RAID10_NEAR,
+ /* raid4,raid5_n,raid6_n_6,raid10_near -> striped/raid0* */
+ { .current_types = SEG_RAID4|SEG_RAID5_N|SEG_RAID6_N_6|SEG_RAID10_NEAR,
+ .possible_types = SEG_STRIPED_TARGET|SEG_RAID0|SEG_RAID0_META,
.current_areas = ~0U,
- .options = ALLOW_NONE }, /* FIXME: ALLOW_REGION_SIZE */
+ .options = ALLOW_NONE },
+
+ /* raid4,raid5_n,raid6_n_6 <-> raid4,raid5_n,raid6_n_6 */
+ { .current_types = SEG_RAID4|SEG_RAID5_N|SEG_RAID6_N_6,
+ .possible_types = SEG_RAID4|SEG_RAID5_N|SEG_RAID6_N_6,
+ .current_areas = ~0U,
+ .options = ALLOW_REGION_SIZE },
+
/* raid5_ls <-> raid6_ls_6 */
{ .current_types = SEG_RAID5_LS|SEG_RAID6_LS_6,
.possible_types = SEG_RAID5_LS|SEG_RAID6_LS_6,
.current_areas = ~0U,
- .options = ALLOW_NONE }, /* FIXME: ALLOW_REGION_SIZE */
+ .options = ALLOW_REGION_SIZE },
/* raid5_rs -> raid6_rs_6 */
{ .current_types = SEG_RAID5_RS|SEG_RAID6_RS_6,
.possible_types = SEG_RAID5_RS|SEG_RAID6_RS_6,
.current_areas = ~0U,
- .options = ALLOW_NONE }, /* FIXME: ALLOW_REGION_SIZE */
+ .options = ALLOW_REGION_SIZE },
/* raid5_ls -> raid6_la_6 */
{ .current_types = SEG_RAID5_LA|SEG_RAID6_LA_6,
.possible_types = SEG_RAID5_LA|SEG_RAID6_LA_6,
.current_areas = ~0U,
- .options = ALLOW_NONE }, /* FIXME: ALLOW_REGION_SIZE */
+ .options = ALLOW_REGION_SIZE },
/* raid5_ls -> raid6_ra_6 */
{ .current_types = SEG_RAID5_RA|SEG_RAID6_RA_6,
.possible_types = SEG_RAID5_RA|SEG_RAID6_RA_6,
.current_areas = ~0U,
- .options = ALLOW_NONE }, /* FIXME: ALLOW_REGION_SIZE */
-
+ .options = ALLOW_REGION_SIZE },
/* mirror <-> raid1 with arbitrary number of legs */
{ .current_types = SEG_MIRROR|SEG_RAID1,
.possible_types = SEG_MIRROR|SEG_RAID1,
.current_areas = ~0U,
- .options = ALLOW_NONE }, /* FIXME: ALLOW_REGION_SIZE */
+ .options = ALLOW_REGION_SIZE },
/* END */
{ .current_types = 0 }
@@ -4108,7 +4122,7 @@ replaced:
* Change region size on raid @lv to @region_size if
* different from current region_size and adjusted region size
*/
-static int _region_size_change_requested(struct logical_volume *lv, int yes, uint32_t region_size,
+static int _region_size_change_requested(struct logical_volume *lv, int yes, const uint32_t region_size,
struct dm_list *allocate_pvs)
{
uint32_t old_region_size;
@@ -4187,7 +4201,7 @@ if (!lv_extend(lv, seg->segtype, seg->area_count - seg->segtype->parity_devs, se
static int _conversion_options_allowed(const struct lv_segment *seg_from,
const struct segment_type **segtype_to,
uint32_t new_image_count,
- int new_data_copies, int region_size,
+ int new_data_copies, int new_region_size,
int stripes, unsigned new_stripe_size_supplied)
{
int r = 1;
@@ -4214,6 +4228,12 @@ static int _conversion_options_allowed(const struct lv_segment *seg_from,
r = 0;
}
+ if (new_region_size && !(opts & ALLOW_REGION_SIZE)) {
+ if (!_log_prohibited_option(seg_from, *segtype_to, "-R/--regionsize"))
+ stack;
+ r = 0;
+ }
+
return r;
}
@@ -4234,13 +4254,13 @@ int lv_raid_convert(struct logical_volume *lv,
const unsigned new_stripes,
const unsigned new_stripe_size_supplied,
const unsigned new_stripe_size,
- /* FIXME: workaround with volatile new_region_size until cli validation patches got merged */
- uint32_t new_region_size,
+ const uint32_t new_region_size,
struct dm_list *allocate_pvs)
{
struct lv_segment *seg = first_seg(lv);
uint32_t stripes, stripe_size;
uint32_t new_image_count = seg->area_count;
+ uint32_t region_size = new_region_size;
takeover_fn_t takeover_fn;
if (!new_segtype) {
@@ -4262,7 +4282,7 @@ int lv_raid_convert(struct logical_volume *lv,
/* Change RAID region size */
/*
- * FIXME: workaround with volatile new_region_size until the
+ * FIXME: workaround with new_region_size until the
* cli validation patches got merged when we'll change
* the API to have new_region_size_supplied to check for.
*/
@@ -4272,7 +4292,7 @@ int lv_raid_convert(struct logical_volume *lv,
seg_is_raid(seg) && !seg_is_any_raid0(seg))
return _region_size_change_requested(lv, yes, new_region_size, allocate_pvs);
} else
- new_region_size = seg->region_size ? : get_default_region_size(lv->vg->cmd);
+ region_size = seg->region_size ? : get_default_region_size(lv->vg->cmd);
/*
* Check acceptible options mirrors, region_size,
@@ -4287,7 +4307,7 @@ int lv_raid_convert(struct logical_volume *lv,
/* Exit without doing activation checks if the combination isn't possible */
if (_takeover_not_possible(takeover_fn))
return takeover_fn(lv, new_segtype, yes, force, new_image_count, 0, new_stripes, stripe_size,
- new_region_size, allocate_pvs);
+ region_size, allocate_pvs);
log_verbose("Converting %s from %s to %s.",
display_lvname(lv), lvseg_name(first_seg(lv)),
@@ -4318,7 +4338,7 @@ int lv_raid_convert(struct logical_volume *lv,
}
return takeover_fn(lv, new_segtype, yes, force, new_image_count, 0, new_stripes, stripe_size,
- new_region_size, allocate_pvs);
+ region_size, allocate_pvs);
}
static int _remove_partial_multi_segment_image(struct logical_volume *lv,
diff --git a/test/shell/lvconvert-raid-takeover.sh b/test/shell/lvconvert-raid-takeover.sh
index 257d169..a219829 100644
--- a/test/shell/lvconvert-raid-takeover.sh
+++ b/test/shell/lvconvert-raid-takeover.sh
@@ -163,6 +163,7 @@ _lvcreate raid4 3 4 64M $vg $lv1
aux wait_for_sync $vg $lv1
# Convert raid4 -> striped
+not _lvconvert striped striped 3 $vg $lv1 512k
_lvconvert striped striped 3 $vg $lv1
# Convert striped -> raid4
@@ -195,6 +196,7 @@ _lvconvert raid0_meta raid0_meta 3 $vg $lv1
_lvconvert raid5 raid5_n 4 $vg $lv1
# Convert raid4 -> raid0_meta
+not _lvconvert raid0_meta raid0_meta 3 $vg $lv1 256k
_lvconvert raid0_meta raid0_meta 3 $vg $lv1
# Convert raid0_meta -> raid4
@@ -243,12 +245,14 @@ _lvconvert raid0_meta raid0_meta 3 $vg $lv1
_lvconvert raid6 raid6_n_6 5 $vg $lv1
# Convert raid6_n_6 -> striped
+not _lvconvert striped striped 3 $vg $lv1 128k
_lvconvert striped striped 3 $vg $lv1
# Convert striped -> raid10
_lvconvert raid10 raid10 6 $vg $lv1
# Convert raid10 -> raid0
+not _lvconvert raid0 raid0 3 $vg $lv1 64k
_lvconvert raid0 raid0 3 $vg $lv1
# Convert raid0 -> raid10
@@ -261,6 +265,7 @@ _lvconvert raid0_meta raid0_meta 3 $vg $lv1
_lvconvert raid10 raid10 6 $vg $lv1
# Convert raid10 -> striped
+not _lvconvert striped striped 3 $vg $lv1 256k
_lvconvert striped striped 3 $vg $lv1
# Clean up
7 years, 2 months
master - test: lvresize-raid.sh missing conditional
by Heinz Mauelshagen
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=caa2094e331888...
Commit: caa2094e33188806137a8fe6d8c6ecce779ecc59
Parent: c908a8b131d0ae12cf87a271b10dfeaf65d4e0a7
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Fri Feb 10 21:19:03 2017 +0100
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Fri Feb 10 21:22:38 2017 +0100
test: lvresize-raid.sh missing conditional
Test missed to check for raid0 present in the kernel.
Related: rhbz1366296
---
test/shell/lvresize-raid.sh | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/shell/lvresize-raid.sh b/test/shell/lvresize-raid.sh
index b4f6058..691946d 100644
--- a/test/shell/lvresize-raid.sh
+++ b/test/shell/lvresize-raid.sh
@@ -1,5 +1,5 @@
#!/bin/sh
-# Copyright (C) 2012 Red Hat, Inc. All rights reserved.
+# Copyright (C) 2012,2017 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
@@ -17,7 +17,8 @@ SKIP_WITH_LVMPOLLD=1
aux have_raid 1 3 0 || skip
levels="5 6 10"
-aux have_raid4 && levels="0 0_meta 4 $levels"
+aux have_raid4 && levels="4 $levels"
+aux have_raid 1 7 0 && levels="0 0_meta $levels"
aux prepare_pvs 6
7 years, 2 months