1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-12-24 16:23:50 +03:00

Compare commits

..

55 Commits

Author SHA1 Message Date
Alasdair Kergon
f9c8c1b964 pre-release 2008-10-17 17:42:08 +00:00
Alasdair Kergon
5650f67ef5 Use temp table to set device size when converting mirrors.
(Avoids having same mirror table loaded twice concurrently by first
using a 'zero' table to set the size of the device so when mirror
table is preloaded it doesn't have to be activated immediately.)
2008-10-17 10:57:15 +00:00
Alasdair Kergon
5ec25dfb94 In resume_mirror_images replace activate_lv with resume_lv as workaround.
(The resume has the side-effect of resuming all of the original
mirror's sub-lvs in addition to the new 'error' target middle layer.)
2008-10-17 10:50:14 +00:00
Alasdair Kergon
ef16682725 Avoid overwriting in-use on-disk text metadata by forgetting MDA_HEADER_SIZE. (Edward Allcutt) 2008-10-17 00:55:46 +00:00
Petr Rockai
883486cc67 Re-indent test-utils.sh consistently, using tabs. 2008-10-14 19:48:01 +00:00
Petr Rockai
f367f9b747 Conversion of last 2 tests to use test-utils.sh, by jstava. 2008-10-14 19:41:12 +00:00
Milan Broz
a3d987fa73 Fix snapshot monitoring library to not cancel monitoring invalid snapshot.
snapshot DSO unregistered itself when snapshot changed state to invalid.

This can cause a race (and several timeouts), when for example another snapshot
is added and in the middle of operation (suspend/resume) the monitoring thread
unregister itself.

Fix it by keeping the snapshot monitored after invalidation - just reset
threshold to not really print any messages to syslog.
2008-10-13 12:06:30 +00:00
Alasdair Kergon
2d48685673 . 2008-10-09 10:47:37 +00:00
Alasdair Kergon
9b21ace1e9 Generate man pages from templates and include version. (romster) 2008-10-08 12:50:13 +00:00
Alasdair Kergon
be2c03fa96 Add usrlibdir & usrsbindir to configure. 2008-10-07 19:11:59 +00:00
Alasdair Kergon
f5585e9252 Add usrsbindir to configure. 2008-10-07 19:08:46 +00:00
Petr Rockai
4d534dd7e4 Add a workaround for missing losetup -s by jstava, and a print a stacktrace
on errors (also by jstava). Currently requires bash, a fix for that may come
later -- explicitly using bash to run tests in the meantime.
2008-10-06 16:55:30 +00:00
Petr Rockai
c8584e1cce More test conversions by jstava. Make check still passes. 2008-10-06 16:47:07 +00:00
Alasdair Kergon
84a1de464c Fix conversion of md chunk size into sectors. 2008-10-03 14:22:18 +00:00
Alasdair Kergon
3966f3d319 device->devices 2008-10-01 22:48:26 +00:00
Petr Rockai
e6166cf711 Make harness.sh exit with non-zero status when tests fail. 2008-09-30 21:45:42 +00:00
Petr Rockai
2285712834 Cosmetic: get rid of trailing garbage on comments in t-vgslpit-usage.sh. 2008-09-30 21:43:55 +00:00
Petr Rockai
53cb6128e8 Improve harness.sh output: also mention failing test's name near the end of its
output. Avoids the need to scroll back just to see which failing test you are
looking at.
2008-09-30 21:43:16 +00:00
Alasdair Kergon
8c317baf19 Free text metadata buffer after a failure writing it. 2008-09-30 20:37:52 +00:00
Petr Rockai
8cac933c71 Fix [ a = b ] usage in t-vgsplit-operation: string comparison is '=', not '=='. 2008-09-30 18:29:10 +00:00
Petr Rockai
03e61a4bf8 Conversion of t-vgsplit-operation.sh by jstava. 2008-09-30 17:56:54 +00:00
Petr Rockai
71446a76b2 Fix a syntax error in one of the scripts, introduced by last commit. 2008-09-30 17:50:56 +00:00
Petr Rockai
28db8d6c7c More test conversions, all of these are by jstava. 2008-09-30 17:47:34 +00:00
Petr Rockai
786e33d7d5 Port over t-vgreduce-usage. Should fix testsuite hangs where pvremove -ff would
have waited for input on certain test failures.
2008-09-30 17:17:04 +00:00
Petr Rockai
b140d6c50e Convert t-vgsplit-usage.sh to use the new test-utils.sh. Original conversion by
jstava. Lvm1 testing restored by mornfall.
2008-09-30 15:20:09 +00:00
Petr Rockai
64a95abdee Convert t-pvremove-usage to use the new test-utils.sh. 2008-09-30 13:19:56 +00:00
Petr Rockai
57f926be17 Update test/Makefile.in to use the new harness for calling tests. 2008-09-29 16:07:02 +00:00
Petr Rockai
4933b67959 Add a test for reappearing lost PVs causing endless metadata correction
updates. (A problem Milan fixed recently.)
2008-09-29 16:06:10 +00:00
Petr Rockai
370b4f1b9e Add a simple test for partial activation. 2008-09-29 16:04:57 +00:00
Petr Rockai
f3b7baa84e Update a bunch of tests to use functionality from test-utils.sh. 2008-09-29 16:02:50 +00:00
Petr Rockai
eafdb2c807 Export testlib_cleanup_ from test-lib.sh, which is needed for test-utils.sh to
be able to call proper EXIT traps.
2008-09-29 16:00:53 +00:00
Petr Rockai
a91fa821ab Import new test utilities and a test harness. 2008-09-29 15:59:19 +00:00
Milan Broz
37ef162cda Fix misleading error message when there is no allocatable extents in VG. 2008-09-29 09:59:10 +00:00
Milan Broz
770928acfc Fix handling of PVs which reappeared with old metadata version. 2008-09-25 15:59:10 +00:00
Milan Broz
d0f3570219 Try to fix possible infinite loop in dependency tree walking (by mornfall). 2008-09-25 15:57:02 +00:00
Milan Broz
3d07c2605f Fix mirror DSO to call vgreduce with proper parameters. 2008-09-25 15:52:29 +00:00
Milan Broz
c350798528 Fix validation of --minor and --major in lvcreate to require -My always. 2008-09-24 16:32:51 +00:00
Alasdair Kergon
6bc3cc0bec . 2008-09-19 18:31:20 +00:00
Alasdair Kergon
2e3e5fcc81 suppress warning if old value found for now 2008-09-19 18:26:41 +00:00
Milan Broz
dfdb10f6de Add more vgreduce tests. (Jaroslav Stava) 2008-09-19 16:12:25 +00:00
Milan Broz
5cbe5909eb Fix vgreduce test, now requires --force flag. (Jaroslav Stava) 2008-09-19 16:10:46 +00:00
Alasdair Kergon
04d52b450b fix last release 2008-09-19 15:44:03 +00:00
Alasdair Kergon
a586a89547 . 2008-09-19 07:18:03 +00:00
Alasdair Kergon
1905eacf15 rename var 2008-09-19 07:12:45 +00:00
Alasdair Kergon
858ec0d740 revert unexplained removal of a '<backtrace>' message 2008-09-19 07:03:23 +00:00
Alasdair Kergon
76cfd406ca pre-release 2008-09-19 06:48:48 +00:00
Alasdair Kergon
9dbaad859d . 2008-09-19 06:44:54 +00:00
Alasdair Kergon
95d43e17b3 Improve the way VGs with PVs missing are handled so manual intervention
is required in fewer circumstances.  (mornfall)
2008-09-19 06:42:00 +00:00
Alasdair Kergon
09a2dff8de Add device/md_chunk_alignment to lvm.conf 2008-09-19 05:33:37 +00:00
Alasdair Kergon
57208f879a adjust pe_align for md chunk size 2008-09-19 05:19:09 +00:00
Alasdair Kergon
149638431d remove unsed var 2008-09-19 04:30:02 +00:00
Alasdair Kergon
30d2940c67 Pass struct physical_volume to pe_align. 2008-09-19 04:28:58 +00:00
Alasdair Kergon
5ee86fc5d0 remove unused var 2008-09-19 03:45:34 +00:00
Alasdair Kergon
a03d0e2c3f Store sysfs location in struct cmd_context. 2008-09-19 03:42:37 +00:00
Alasdair Kergon
8bd367d58d fix last patch return code 2008-09-19 00:20:39 +00:00
131 changed files with 5470 additions and 6393 deletions

View File

@@ -1 +1 @@
2.02.40-cvs (2008-06-27)
2.02.41-cvs (2008-10-17)

View File

@@ -1,5 +1,31 @@
Version 2.02.40 -
================================
Version 2.02.41 - 17th October 2008
===================================
Use temp table to set device size when converting mirrors.
In resume_mirror_images replace activate_lv with resume_lv as workaround.
Avoid overwriting in-use on-disk text metadata by forgetting MDA_HEADER_SIZE.
Fix snapshot monitoring library to not cancel monitoring invalid snapshot.
Generate man pages from templates and include version.
Add usrlibdir and usrsbindir to configure.
Fix conversion of md chunk size into sectors.
Free text metadata buffer after a failure writing it.
Fix misleading error message when there are no allocatable extents in VG.
Fix handling of PVs which reappeared with old metadata version.
Fix mirror DSO to call vgreduce with proper parameters.
Fix validation of --minor and --major in lvcreate to require -My always.
Fix release: clvmd build, vgreduce consolidate & tests, /dev/ioerror warning.
Version 2.02.40 - 19th September 2008
=====================================
Allow lvremove to remove LVs from VGs with missing PVs.
In VG with PVs missing, by default allow activation of LVs that are complete.
Track PARTIAL_LV and MISSING_PV flags internally.
Require --force with --removemissing in vgreduce to remove partial LVs.
No longer write out PARTIAL flag into metadata backups.
Treat new default activation/missing_stripe_filler "error" as an error target.
Remove internal partial_mode.
Add devices/md_chunk_alignment to lvm.conf.
Pass struct physical_volume to pe_align and adjust for md chunk size.
Store sysfs location in struct cmd_context.
Avoid shuffling remaining mirror images when removing one, retaining primary.
Add missing LV error target activation in _remove_mirror_images.
Prevent resizing an LV while lvconvert is using it.

View File

@@ -1,5 +1,6 @@
Version 1.02.29 -
=====================================
Add usrsbindir to configure.
Version 1.02.28 - 18th September 2008
=====================================

5509
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -62,6 +62,7 @@ esac
################################################################################
dnl -- Checks for programs.
AC_PROG_SED
AC_PROG_AWK
AC_PROG_CC
@@ -581,6 +582,16 @@ case $DMDIR in
*) DMDIR="`pwd`/$DMDIR" ;;
esac
AC_ARG_WITH(usrlibdir,
[ --with-usrlibdir=DIR],
[ usrlibdir="$withval"],
[ usrlibdir='${prefix}/lib' ])
AC_ARG_WITH(usrsbindir,
[ --with-usrsbindir=DIR],
[ usrsbindir="$withval"],
[ usrsbindir='${prefix}/sbin' ])
################################################################################
dnl -- Ensure additional headers required
if test x$READLINE = xyes; then
@@ -673,6 +684,8 @@ AC_SUBST(SNAPSHOTS)
AC_SUBST(STATICDIR)
AC_SUBST(STATIC_LINK)
AC_SUBST([LIB_PTHREAD])
AC_SUBST(usrlibdir)
AC_SUBST(usrsbindir)
################################################################################
dnl -- First and last lines should not contain files to generate in order to

View File

@@ -90,7 +90,7 @@ clvmd: $(OBJECTS) $(top_srcdir)/lib/liblvm.a
install_clvmd: $(TARGETS)
$(INSTALL) -D $(OWNER) $(GROUP) -m 555 $(STRIP) clvmd \
$(sbindir)/clvmd
$(usrsbindir)/clvmd
install: $(INSTALL_TARGETS)

View File

@@ -141,8 +141,7 @@ static const char *decode_flags(unsigned char flags)
{
static char buf[128];
sprintf(buf, "0x%x (%s%s%s)", flags,
flags & LCK_PARTIAL_MODE ? "PARTIAL " : "",
sprintf(buf, "0x%x (%s%s)", flags,
flags & LCK_MIRROR_NOSYNC_MODE ? "MIRROR_NOSYNC " : "",
flags & LCK_DMEVENTD_MONITOR_MODE ? "DMEVENTD_MONITOR " : "");
@@ -413,9 +412,6 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
}
}
if (lock_flags & LCK_PARTIAL_MODE)
init_partial(1);
if (lock_flags & LCK_MIRROR_NOSYNC_MODE)
init_mirror_in_sync(1);
@@ -454,9 +450,6 @@ int do_lock_lv(unsigned char command, unsigned char lock_flags, char *resource)
break;
}
if (lock_flags & LCK_PARTIAL_MODE)
init_partial(0);
if (lock_flags & LCK_MIRROR_NOSYNC_MODE)
init_mirror_in_sync(0);

View File

@@ -152,7 +152,7 @@ static int _remove_failed_devices(const char *device)
}
/* FIXME Is any sanity-checking required on %s? */
if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing %s", vg)) {
if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing --force %s", vg)) {
/* this error should be caught above, but doesn't hurt to check again */
syslog(LOG_ERR, "Unable to form LVM command: Device name too long");
dm_pool_empty(_mem_pool); /* FIXME: not safe with multiple threads */

View File

@@ -99,24 +99,6 @@ static void _parse_snapshot_params(char *params, struct snap_status *stat)
stat->max = atoi(p);
}
/* send unregister command to itself */
static void _unregister_self(struct dm_task *dmt)
{
const char *name = dm_task_get_name(dmt);
struct dm_event_handler *dmevh;
if (!(dmevh = dm_event_handler_create()))
return;
if (dm_event_handler_set_dev_name(dmevh, name))
goto fail;
dm_event_handler_set_event_mask(dmevh, DM_EVENT_ALL_ERRORS|DM_EVENT_TIMEOUT);
dm_event_unregister_handler(dmevh);
fail:
dm_event_handler_destroy(dmevh);
}
void process_event(struct dm_task *dmt,
enum dm_event_mask event __attribute((unused)),
void **private)
@@ -149,7 +131,6 @@ void process_event(struct dm_task *dmt,
*/
if (stat.invalid || !stat.max) {
syslog(LOG_ERR, "Snapshot %s changed state to: %s\n", device, params);
_unregister_self(dmt);
*percent_warning = 0;
goto out;
}

View File

@@ -152,7 +152,7 @@ static int _remove_failed_devices(const char *device)
}
/* FIXME Is any sanity-checking required on %s? */
if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing %s", vg)) {
if (CMD_SIZE <= snprintf(cmd_str, CMD_SIZE, "vgreduce --config devices{ignore_suspended_devices=1} --removemissing --force %s", vg)) {
/* this error should be caught above, but doesn't hurt to check again */
syslog(LOG_ERR, "Unable to form LVM command: Device name too long");
dm_pool_empty(_mem_pool); /* FIXME: not safe with multiple threads */

View File

@@ -99,24 +99,6 @@ static void _parse_snapshot_params(char *params, struct snap_status *stat)
stat->max = atoi(p);
}
/* send unregister command to itself */
static void _unregister_self(struct dm_task *dmt)
{
const char *name = dm_task_get_name(dmt);
struct dm_event_handler *dmevh;
if (!(dmevh = dm_event_handler_create()))
return;
if (dm_event_handler_set_dev_name(dmevh, name))
goto fail;
dm_event_handler_set_event_mask(dmevh, DM_EVENT_ALL_ERRORS|DM_EVENT_TIMEOUT);
dm_event_unregister_handler(dmevh);
fail:
dm_event_handler_destroy(dmevh);
}
void process_event(struct dm_task *dmt,
enum dm_event_mask event __attribute((unused)),
void **private)
@@ -149,7 +131,6 @@ void process_event(struct dm_task *dmt,
*/
if (stat.invalid || !stat.max) {
syslog(LOG_ERR, "Snapshot %s changed state to: %s\n", device, params);
_unregister_self(dmt);
*percent_warning = 0;
goto out;
}

View File

@@ -93,6 +93,11 @@ devices {
# 1 enables; 0 disables.
md_component_detection = 1
# By default, if a PV is placed directly upon an md device, LVM2
# will align its data blocks with the the chunk_size exposed in sysfs.
# 1 enables; 0 disables.
md_chunk_alignment = 1
# If, while scanning the system for PVs, LVM2 encounters a device-mapper
# device that has its I/O suspended, it waits for it to become accessible.
# Set this to 1 to skip such devices. This should only be needed
@@ -266,11 +271,13 @@ global {
}
activation {
# Device used in place of missing stripes if activating incomplete volume.
# For now, you need to set this up yourself first (e.g. with 'dmsetup')
# For example, you could make it return I/O errors using the 'error'
# target or make it return zeros.
missing_stripe_filler = "/dev/ioerror"
# How to fill in missing stripes if activating an incomplete volume.
# Using "error" will make inaccessible parts of the device return
# I/O errors on access. You can instead use a device path, in which
# case, that device will be used to in place of missing stripes.
# But note that using anything other than "error" with mirrored
# or snapshotted volumes is likely to result in data corruption.
missing_stripe_filler = "error"
# How much stack (in KB) to reserve for use while devices suspended
reserved_stack = 256

View File

@@ -1027,6 +1027,12 @@ static int _lv_activate(struct cmd_context *cmd, const char *lvid_s,
return 0;
}
if ((!lv->vg->cmd->partial_activation) && (lv->status & PARTIAL_LV)) {
log_error("Refusing activation of partial LV %s. Use --partial to override.",
lv->name);
return_0;
}
if (test_mode()) {
_skip("Activating '%s'.", lv->name);
return 1;

View File

@@ -47,7 +47,6 @@ struct dev_manager {
struct cmd_context *cmd;
const char *stripe_filler;
void *target_state;
uint32_t pvmove_mirror_count;
@@ -59,8 +58,6 @@ struct lv_layer {
const char *old_name;
};
static const char *stripe_filler = NULL;
static char *_build_dlid(struct dm_pool *mem, const char *lvid, const char *layer)
{
char *dlid;
@@ -443,13 +440,6 @@ struct dev_manager *dev_manager_create(struct cmd_context *cmd,
dm->cmd = cmd;
dm->mem = mem;
if (!stripe_filler) {
stripe_filler = find_config_tree_str(cmd,
"activation/missing_stripe_filler",
DEFAULT_STRIPE_FILLER);
}
dm->stripe_filler = stripe_filler;
if (!(dm->vg_name = dm_pool_strdup(dm->mem, vg_name)))
goto_bad;
@@ -699,6 +689,68 @@ bad:
return NULL;
}
static char *_add_error_device(struct dev_manager *dm, struct dm_tree *dtree,
struct lv_segment *seg, int s)
{
char *id, *name;
char errid[32];
struct dm_tree_node *node;
struct lv_segment *seg_i;
int segno = -1, i = 0;;
uint64_t size = seg->len * seg->lv->vg->extent_size;
list_iterate_items(seg_i, &seg->lv->segments) {
if (seg == seg_i)
segno = i;
++i;
}
if (segno < 0) {
log_error("_add_error_device called with bad segment");
return_NULL;
}
sprintf(errid, "missing_%d_%d", segno, s);
if (!(id = build_dlid(dm, seg->lv->lvid.s, errid)))
return_NULL;
if (!(name = build_dm_name(dm->mem, seg->lv->vg->name,
seg->lv->name, errid)))
return_NULL;
if (!(node = dm_tree_add_new_dev(dtree, name, id, 0, 0, 0, 0, 0)))
return_NULL;
if (!dm_tree_node_add_error_target(node, size))
return_NULL;
return id;
}
static int _add_error_area(struct dev_manager *dm, struct dm_tree_node *node,
struct lv_segment *seg, int s)
{
char *dlid;
uint64_t extent_size = seg->lv->vg->extent_size;
if (!strcmp(dm->cmd->stripe_filler, "error")) {
/*
* FIXME, the tree pointer is first field of dm_tree_node, but
* we don't have the struct definition available.
*/
struct dm_tree **tree = (struct dm_tree **) node;
dlid = _add_error_device(dm, *tree, seg, s);
if (!dlid)
return_0;
dm_tree_node_add_target_area(node, NULL, dlid,
extent_size * seg_le(seg, s));
} else
dm_tree_node_add_target_area(node,
dm->cmd->stripe_filler,
NULL, UINT64_C(0));
return 1;
}
int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
struct dm_tree_node *node, uint32_t start_area,
uint32_t areas)
@@ -712,11 +764,10 @@ int add_areas_line(struct dev_manager *dm, struct lv_segment *seg,
(!seg_pvseg(seg, s) ||
!seg_pv(seg, s) ||
!seg_dev(seg, s))) ||
(seg_type(seg, s) == AREA_LV && !seg_lv(seg, s)))
dm_tree_node_add_target_area(node,
dm->stripe_filler,
NULL, UINT64_C(0));
else if (seg_type(seg, s) == AREA_PV)
(seg_type(seg, s) == AREA_LV && !seg_lv(seg, s))) {
if (!_add_error_area(dm, node, seg, s))
return_0;
} else if (seg_type(seg, s) == AREA_PV)
dm_tree_node_add_target_area(node,
dev_name(seg_dev(seg, s)),
NULL,

View File

@@ -75,6 +75,49 @@ static int _get_env_vars(struct cmd_context *cmd)
return 1;
}
static void _get_sysfs_dir(struct cmd_context *cmd)
{
static char proc_mounts[PATH_MAX];
static char *split[4], buffer[PATH_MAX + 16];
FILE *fp;
char *sys_mnt = NULL;
cmd->sysfs_dir[0] = '\0';
if (!*cmd->proc_dir) {
log_debug("No proc filesystem found: skipping sysfs detection");
return;
}
if (dm_snprintf(proc_mounts, sizeof(proc_mounts),
"%s/mounts", cmd->proc_dir) < 0) {
log_error("Failed to create /proc/mounts string for sysfs detection");
return;
}
if (!(fp = fopen(proc_mounts, "r"))) {
log_sys_error("_get_sysfs_dir: fopen %s", proc_mounts);
return;
}
while (fgets(buffer, sizeof(buffer), fp)) {
if (dm_split_words(buffer, 4, 0, split) == 4 &&
!strcmp(split[2], "sysfs")) {
sys_mnt = split[1];
break;
}
}
if (fclose(fp))
log_sys_error("fclose", proc_mounts);
if (!sys_mnt) {
log_error("Failed to find sysfs mount point");
return;
}
strncpy(cmd->sysfs_dir, sys_mnt, sizeof(cmd->sysfs_dir));
}
static void _init_logging(struct cmd_context *cmd)
{
int append = 1;
@@ -154,6 +197,7 @@ static int _process_config(struct cmd_context *cmd)
{
mode_t old_umask;
const char *read_ahead;
struct stat st;
/* umask */
cmd->default_settings.umask = find_config_tree_int(cmd,
@@ -189,6 +233,8 @@ static int _process_config(struct cmd_context *cmd)
cmd->proc_dir[0] = '\0';
}
_get_sysfs_dir(cmd);
/* activation? */
cmd->default_settings.activation = find_config_tree_int(cmd,
"global/activation",
@@ -218,6 +264,30 @@ static int _process_config(struct cmd_context *cmd)
return 0;
}
cmd->stripe_filler = find_config_tree_str(cmd,
"activation/missing_stripe_filler",
DEFAULT_STRIPE_FILLER);
/* FIXME Missing error code checks from the stats, not log_warn?, notify if setting overridden, delay message/check till it is actually used (eg consider if lvm shell - file could appear later after this check)? */
if (!strcmp(cmd->stripe_filler, "/dev/ioerror") &&
stat(cmd->stripe_filler, &st))
cmd->stripe_filler = "error";
if (strcmp(cmd->stripe_filler, "error")) {
if (stat(cmd->stripe_filler, &st)) {
log_warn("WARNING: activation/missing_stripe_filler = \"%s\" "
"is invalid,", cmd->stripe_filler);
log_warn(" stat failed: %s", strerror(errno));
log_warn("Falling back to \"error\" missing_stripe_filler.");
cmd->stripe_filler = "error";
} else if (!S_ISBLK(st.st_mode)) {
log_warn("WARNING: activation/missing_stripe_filler = \"%s\" "
"is not a block device.", cmd->stripe_filler);
log_warn("Falling back to \"error\" missing_stripe_filler.");
cmd->stripe_filler = "error";
}
}
return 1;
}
@@ -534,7 +604,7 @@ static struct dev_filter *_init_filter_components(struct cmd_context *cmd)
*/
if (find_config_tree_bool(cmd, "devices/sysfs_scan",
DEFAULT_SYSFS_SCAN)) {
if ((filters[nr_filt] = sysfs_filter_create(cmd->proc_dir)))
if ((filters[nr_filt] = sysfs_filter_create(cmd->sysfs_dir)))
nr_filt++;
}
@@ -936,6 +1006,7 @@ struct cmd_context *create_toolcontext(struct arg *the_args, unsigned is_static,
cmd->args = the_args;
cmd->is_static = is_static;
cmd->is_long_lived = is_long_lived;
cmd->handles_missing_pvs = 0;
cmd->hosttags = 0;
list_init(&cmd->formats);
list_init(&cmd->segtypes);

View File

@@ -66,8 +66,10 @@ struct cmd_context {
struct command *command;
struct arg *args;
char **argv;
unsigned is_static; /* Static binary? */
unsigned is_long_lived; /* Optimises persistent_filter handling */
unsigned is_static:1; /* Static binary? */
unsigned is_long_lived:1; /* Optimises persistent_filter handling */
unsigned handles_missing_pvs:1;
unsigned partial_activation:1;
struct dev_filter *filter;
int dump_filter; /* Dump filter when exiting? */
@@ -81,6 +83,7 @@ struct cmd_context {
struct archive_params *archive_params;
struct backup_params *backup_params;
const char *stripe_filler;
/* List of defined tags */
struct list tags;
@@ -89,6 +92,7 @@ struct cmd_context {
char sys_dir[PATH_MAX];
char dev_dir[PATH_MAX];
char proc_dir[PATH_MAX];
char sysfs_dir[PATH_MAX];
};
struct cmd_context *create_toolcontext(struct arg *the_args, unsigned is_static, unsigned is_long_lived);

View File

@@ -32,6 +32,7 @@
#define DEFAULT_PROC_DIR "/proc"
#define DEFAULT_SYSFS_SCAN 1
#define DEFAULT_MD_COMPONENT_DETECTION 1
#define DEFAULT_MD_CHUNK_ALIGNMENT 1
#define DEFAULT_IGNORE_SUSPENDED_DEVICES 1
#define DEFAULT_LOCK_DIR "/var/lock/lvm"
@@ -91,7 +92,7 @@
# define DEFAULT_ACTIVATION 0
#endif
#define DEFAULT_STRIPE_FILLER "/dev/ioerror"
#define DEFAULT_STRIPE_FILLER "error"
#define DEFAULT_MIRROR_REGION_SIZE 512 /* KB */
#define DEFAULT_INTERVAL 15

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2004 Luca Berra
* Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved.
* Copyright (C) 2004-2008 Red Hat, Inc. All rights reserved.
*
* This file is part of LVM2.
*
@@ -16,6 +16,7 @@
#include "lib.h"
#include "metadata.h"
#include "xlate.h"
#include "filter.h"
#ifdef linux
@@ -124,6 +125,62 @@ out:
return ret;
}
/*
* Retrieve chunk size from md device using sysfs.
*/
unsigned long dev_md_chunk_size(const char *sysfs_dir, struct device *dev)
{
char path[PATH_MAX+1], buffer[64];
FILE *fp;
struct stat info;
unsigned long chunk_size_bytes = 0UL;
if (MAJOR(dev->dev) != md_major())
return 0;
if (!sysfs_dir || !*sysfs_dir)
return_0;
if (dm_snprintf(path, PATH_MAX, "%s/dev/block/%d:%d/md/chunk_size",
sysfs_dir, MAJOR(dev->dev), MINOR(dev->dev)) < 0) {
log_error("dm_snprintf md chunk_size failed");
return 0;
}
/* old sysfs structure */
if (stat(path, &info) &&
dm_snprintf(path, PATH_MAX, "%s/block/md%d/md/chunk_size",
sysfs_dir, MINOR(dev->dev)) < 0) {
log_error("dm_snprintf old md chunk size failed");
return 0;
}
if (!(fp = fopen(path, "r"))) {
log_sys_error("fopen", path);
return 0;
}
if (!fgets(buffer, sizeof(buffer), fp)) {
log_sys_error("fgets", path);
goto out;
}
if (sscanf(buffer, "%lu", &chunk_size_bytes) != 1) {
log_error("sysfs file %s not in expected format: %s", path,
buffer);
goto out;
}
log_very_verbose("Device %s md chunk size is %lu bytes.",
dev_name(dev), chunk_size_bytes);
out:
if (fclose(fp))
log_sys_error("fclose", path);
return chunk_size_bytes >> SECTOR_SHIFT;
}
#else
int dev_is_md(struct device *dev __attribute((unused)),
@@ -132,4 +189,10 @@ int dev_is_md(struct device *dev __attribute((unused)),
return 0;
}
unsigned long dev_md_chunk_size(const char *sysfs_dir __attribute((unused)),
struct device *dev __attribute((unused)))
{
return 0UL;
}
#endif

View File

@@ -93,6 +93,7 @@ const char *dev_name_confirmed(struct device *dev, int quiet);
/* Does device contain md superblock? If so, where? */
int dev_is_md(struct device *dev, uint64_t *sb);
unsigned long dev_md_chunk_size(const char *sysfs_dir, struct device *dev);
int is_partitioned_dev(struct device *dev);

View File

@@ -578,10 +578,7 @@ void vgdisplay_full(const struct volume_group *vg)
struct lv_list *lvl;
char uuid[64] __attribute((aligned(8)));
if (vg->status & PARTIAL_VG)
active_pvs = list_size(&vg->pvs);
else
active_pvs = vg->pv_count;
active_pvs = vg->pv_count - vg_missing_pv_count(vg);
log_print("--- Volume group ---");
log_print("VG Name %s", vg->name);
@@ -664,10 +661,7 @@ void vgdisplay_colons(const struct volume_group *vg)
const char *access;
char uuid[64] __attribute((aligned(8)));
if (vg->status & PARTIAL_VG)
active_pvs = list_size(&vg->pvs);
else
active_pvs = vg->pv_count;
active_pvs = vg->pv_count - vg_missing_pv_count(vg);
list_iterate_items(lvl, &vg->lvs)
if (lv_is_visible(lvl->lv) && !(lvl->lv->status & SNAPSHOT))

View File

@@ -20,47 +20,11 @@
#include <dirent.h>
static int _locate_sysfs_blocks(const char *proc, char *path, size_t len,
static int _locate_sysfs_blocks(const char *sysfs_dir, char *path, size_t len,
unsigned *sysfs_depth)
{
char proc_mounts[PATH_MAX];
FILE *fp;
char *split[4], buffer[PATH_MAX + 16];
const char *sys_mnt = NULL;
struct stat info;
if (!*proc) {
log_verbose("No proc filesystem found: skipping sysfs filter");
return 0;
}
if (dm_snprintf(proc_mounts, sizeof(proc_mounts),
"%s/mounts", proc) < 0) {
log_error("Failed to create /proc/mounts string");
return 0;
}
if (!(fp = fopen(proc_mounts, "r"))) {
log_sys_error("fopen %s", proc_mounts);
return 0;
}
while (fgets(buffer, sizeof(buffer), fp)) {
if (dm_split_words(buffer, 4, 0, split) == 4 &&
!strcmp(split[2], "sysfs")) {
sys_mnt = split[1];
break;
}
}
if (fclose(fp))
log_sys_error("fclose", proc_mounts);
if (!sys_mnt) {
log_error("Failed to find sysfs mount point");
return 0;
}
/*
* unified classification directory for all kernel subsystems
*
@@ -70,7 +34,7 @@ static int _locate_sysfs_blocks(const char *proc, char *path, size_t len,
* `-- sr0 -> ../../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
*
*/
if (dm_snprintf(path, len, "%s/%s", sys_mnt,
if (dm_snprintf(path, len, "%s/%s", sysfs_dir,
"subsystem/block/devices") >= 0) {
if (!stat(path, &info)) {
*sysfs_depth = 0;
@@ -87,7 +51,7 @@ static int _locate_sysfs_blocks(const char *proc, char *path, size_t len,
* `-- sr0 -> ../../devices/pci0000:00/0000:00:1f.2/host1/target1:0:0/1:0:0:0/block/sr0
*
*/
if (dm_snprintf(path, len, "%s/%s", sys_mnt, "class/block") >= 0) {
if (dm_snprintf(path, len, "%s/%s", sysfs_dir, "class/block") >= 0) {
if (!stat(path, &info)) {
*sysfs_depth = 0;
return 1;
@@ -112,7 +76,7 @@ static int _locate_sysfs_blocks(const char *proc, char *path, size_t len,
* ...
*
*/
if (dm_snprintf(path, len, "%s/%s", sys_mnt, "block") >= 0) {
if (dm_snprintf(path, len, "%s/%s", sysfs_dir, "block") >= 0) {
if (!stat(path, &info)) {
*sysfs_depth = 1;
return 1;
@@ -321,7 +285,7 @@ static void _destroy(struct dev_filter *f)
dm_pool_destroy(ds->mem);
}
struct dev_filter *sysfs_filter_create(const char *proc)
struct dev_filter *sysfs_filter_create(const char *sysfs_dir)
{
char sys_block[PATH_MAX];
unsigned sysfs_depth;
@@ -329,7 +293,12 @@ struct dev_filter *sysfs_filter_create(const char *proc)
struct dev_set *ds;
struct dev_filter *f;
if (!_locate_sysfs_blocks(proc, sys_block, sizeof(sys_block), &sysfs_depth))
if (!*sysfs_dir) {
log_verbose("No proc filesystem found: skipping sysfs filter");
return NULL;
}
if (!_locate_sysfs_blocks(sysfs_dir, sys_block, sizeof(sys_block), &sysfs_depth))
return NULL;
if (!(mem = dm_pool_create("sysfs", 256))) {
@@ -357,7 +326,7 @@ struct dev_filter *sysfs_filter_create(const char *proc)
#else
struct dev_filter *sysfs_filter_create(const char *proc __attribute((unused)))
struct dev_filter *sysfs_filter_create(const char *sysfs_dir __attribute((unused)))
{
return NULL;
}

View File

@@ -18,6 +18,6 @@
#include "config.h"
#include "dev-cache.h"
struct dev_filter *sysfs_filter_create(const char *proc);
struct dev_filter *sysfs_filter_create(const char *sysfs_dir);
#endif

View File

@@ -356,7 +356,7 @@ static struct disk_list *__read_disk(const struct format_type *fmt,
list_init(&dl->lvds);
if (!_read_pvd(dev, &dl->pvd))
goto bad;
goto_bad;
/*
* is it an orphan ?

View File

@@ -212,7 +212,7 @@ int export_pv(struct cmd_context *cmd, struct dm_pool *mem,
struct pv_disk *pvd, struct physical_volume *pv);
int import_vg(struct dm_pool *mem,
struct volume_group *vg, struct disk_list *dl, int partial);
struct volume_group *vg, struct disk_list *dl);
int export_vg(struct vg_disk *vgd, struct volume_group *vg);
int import_lv(struct dm_pool *mem, struct logical_volume *lv, struct lv_disk *lvd);

View File

@@ -23,7 +23,7 @@
#include "segtype.h"
/* VG consistency checks */
static int _check_vgs(struct list *pvs, int *partial)
static int _check_vgs(struct list *pvs)
{
struct list *pvh, *t;
struct disk_list *dl = NULL;
@@ -33,8 +33,6 @@ static int _check_vgs(struct list *pvs, int *partial)
uint32_t exported = 0;
int first_time = 1;
*partial = 0;
/*
* If there are exported and unexported PVs, ignore exported ones.
* This means an active VG won't be affected if disks are inserted
@@ -98,10 +96,6 @@ static int _check_vgs(struct list *pvs, int *partial)
dl->vgd.pe_total, dl->vgd.pe_allocated,
dl->vgd.pvg_total);
list_del(pvh);
if (partial_mode()) {
*partial = 1;
continue;
}
return 0;
}
pv_count++;
@@ -111,9 +105,6 @@ static int _check_vgs(struct list *pvs, int *partial)
if (pv_count != first->vgd.pv_cur) {
log_error("%d PV(s) found for VG %s: expected %d",
pv_count, first->pvd.vg_name, first->vgd.pv_cur);
if (!partial_mode())
return 0;
*partial = 1;
}
return 1;
@@ -125,7 +116,6 @@ static struct volume_group *_build_vg(struct format_instance *fid,
struct dm_pool *mem = fid->fmt->cmd->mem;
struct volume_group *vg = dm_pool_alloc(mem, sizeof(*vg));
struct disk_list *dl;
int partial;
if (!vg)
goto_bad;
@@ -142,12 +132,12 @@ static struct volume_group *_build_vg(struct format_instance *fid,
list_init(&vg->lvs);
list_init(&vg->tags);
if (!_check_vgs(pvs, &partial))
if (!_check_vgs(pvs))
goto_bad;
dl = list_item(pvs->n, struct disk_list);
if (!import_vg(mem, vg, dl, partial))
if (!import_vg(mem, vg, dl))
goto_bad;
if (!import_pvs(fid->fmt, mem, vg, pvs, &vg->pvs, &vg->pv_count))

View File

@@ -95,6 +95,7 @@ int import_pv(const struct format_type *fmt, struct dm_pool *mem,
pv->pe_start = pvd->pe_start;
pv->pe_count = pvd->pe_total;
pv->pe_alloc_count = 0;
pv->pe_align = 0;
/* Fix up pv size if missing or impossibly large */
if (!pv->size || pv->size > (1ULL << 62)) {
@@ -213,7 +214,7 @@ int export_pv(struct cmd_context *cmd, struct dm_pool *mem __attribute((unused))
}
int import_vg(struct dm_pool *mem,
struct volume_group *vg, struct disk_list *dl, int partial)
struct volume_group *vg, struct disk_list *dl)
{
struct vg_disk *vgd = &dl->vgd;
memcpy(vg->id.uuid, vgd->vg_uuid, ID_LEN);
@@ -235,10 +236,10 @@ int import_vg(struct dm_pool *mem,
if (vgd->vg_status & VG_EXTENDABLE)
vg->status |= RESIZEABLE_VG;
if (partial || (vgd->vg_access & VG_READ))
if (vgd->vg_access & VG_READ)
vg->status |= LVM_READ;
if (!partial && (vgd->vg_access & VG_WRITE))
if (vgd->vg_access & VG_WRITE)
vg->status |= LVM_WRITE;
if (vgd->vg_access & VG_CLUSTERED)
@@ -254,9 +255,6 @@ int import_vg(struct dm_pool *mem,
vg->max_pv = vgd->pv_max;
vg->alloc = ALLOC_NORMAL;
if (partial)
vg->status |= PARTIAL_VG;
return 1;
}

View File

@@ -173,6 +173,7 @@ int import_pool_pv(const struct format_type *fmt, struct dm_pool *mem,
pv->pe_start = POOL_PE_START;
pv->pe_count = pv->size / POOL_PE_SIZE;
pv->pe_alloc_count = 0;
pv->pe_align = 0;
list_init(&pv->tags);
list_init(&pv->segments);

View File

@@ -134,10 +134,8 @@ int archive_display(struct cmd_context *cmd, const char *vg_name)
{
int r1, r2;
init_partial(1);
r1 = archive_list(cmd, cmd->archive_params->dir, vg_name);
r2 = backup_list(cmd, cmd->backup_params->dir, vg_name);
init_partial(0);
return r1 && r2;
}
@@ -146,9 +144,7 @@ int archive_display_file(struct cmd_context *cmd, const char *file)
{
int r;
init_partial(1);
r = archive_list_file(cmd, file);
init_partial(0);
return r;
}
@@ -393,7 +389,7 @@ void check_current_backup(struct volume_group *vg)
char path[PATH_MAX];
struct volume_group *vg_backup;
if ((vg->status & PARTIAL_VG) || (vg->status & EXPORTED_VG))
if (vg->status & EXPORTED_VG)
return;
if (dm_snprintf(path, sizeof(path), "%s/%s",

View File

@@ -31,12 +31,12 @@ struct flag {
static struct flag _vg_flags[] = {
{EXPORTED_VG, "EXPORTED", STATUS_FLAG},
{RESIZEABLE_VG, "RESIZEABLE", STATUS_FLAG},
{PARTIAL_VG, "PARTIAL", STATUS_FLAG},
{PVMOVE, "PVMOVE", STATUS_FLAG},
{LVM_READ, "READ", STATUS_FLAG},
{LVM_WRITE, "WRITE", STATUS_FLAG},
{CLUSTERED, "CLUSTERED", STATUS_FLAG},
{SHARED, "SHARED", STATUS_FLAG},
{PARTIAL_VG, NULL, 0},
{PRECOMMITTED, NULL, 0},
{0, NULL, 0}
};
@@ -44,6 +44,7 @@ static struct flag _vg_flags[] = {
static struct flag _pv_flags[] = {
{ALLOCATABLE_PV, "ALLOCATABLE", STATUS_FLAG},
{EXPORTED_VG, "EXPORTED", STATUS_FLAG},
{MISSING_PV, "MISSING", COMPATIBLE_FLAG},
{0, NULL, 0}
};
@@ -62,6 +63,8 @@ static struct flag _lv_flags[] = {
{SNAPSHOT, NULL, 0},
{ACTIVATE_EXCL, NULL, 0},
{CONVERTING, NULL, 0},
{PARTIAL_LV, NULL, 0},
{POSTORDER_FLAG, NULL, 0},
{0, NULL, 0}
};
@@ -155,7 +158,16 @@ int read_flags(uint32_t *status, int type, struct config_value *cv)
break;
}
if (!flags[f].description && (type & STATUS_FLAG)) {
if (type == VG_FLAGS && !strcmp(cv->v.str, "PARTIAL")) {
/*
* Exception: We no longer write this flag out, but it
* might be encountered in old backup files, so restore
* it in that case. It is never part of live metadata
* though, so only vgcfgrestore needs to be concerned
* by this case.
*/
s |= PARTIAL_VG;
} else if (!flags[f].description && (type & STATUS_FLAG)) {
log_err("Unknown status flag '%s'.", cv->v.str);
return 0;
}

View File

@@ -513,7 +513,7 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
struct mda_header *mdah;
struct pv_list *pvl;
int r = 0;
uint32_t new_wrap = 0, old_wrap = 0;
uint64_t new_wrap = 0, old_wrap = 0, new_end;
int found = 0;
int noprecommit = 0;
@@ -552,10 +552,11 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
if (rlocn && (rlocn->offset + rlocn->size > mdah->size))
old_wrap = (rlocn->offset + rlocn->size) - mdah->size;
new_end = new_wrap ? new_wrap + MDA_HEADER_SIZE :
mdac->rlocn.offset + mdac->rlocn.size;
if ((new_wrap && old_wrap) ||
(rlocn && ((new_wrap > rlocn->offset) ||
(old_wrap && (mdac->rlocn.offset + mdac->rlocn.size >
rlocn->offset)))) ||
(rlocn && (new_wrap || old_wrap) && (new_end > rlocn->offset)) ||
(mdac->rlocn.size >= mdah->size)) {
log_error("VG %s metadata too large for circular buffer",
vg->name);
@@ -573,7 +574,7 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
goto_out;
if (new_wrap) {
log_debug("Writing metadata to %s at %" PRIu64 " len %" PRIu32,
log_debug("Writing metadata to %s at %" PRIu64 " len %" PRIu64,
dev_name(mdac->area.dev), mdac->area.start +
MDA_HEADER_SIZE, new_wrap);
@@ -592,13 +593,20 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
mdac->rlocn.checksum = calc_crc(mdac->rlocn.checksum,
fidtc->raw_metadata_buf +
mdac->rlocn.size -
new_wrap, new_wrap);
new_wrap, (uint32_t) new_wrap);
r = 1;
out:
if (!r && !dev_close(mdac->area.dev))
stack;
if (!r) {
if (!dev_close(mdac->area.dev))
stack;
if (fidtc->raw_metadata_buf) {
dm_free(fidtc->raw_metadata_buf);
fidtc->raw_metadata_buf = NULL;
}
}
return r;
}
@@ -1166,7 +1174,7 @@ static int _mda_setup(const struct format_type *fmt,
if (!pvmetadatacopies)
return 1;
alignment = pe_align() << SECTOR_SHIFT;
alignment = pe_align(pv) << SECTOR_SHIFT;
disk_size = pv->size << SECTOR_SHIFT;
pe_start <<= SECTOR_SHIFT;
pe_end <<= SECTOR_SHIFT;
@@ -1333,7 +1341,7 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume
/* Set pe_start to first aligned sector after any metadata
* areas that begin before pe_start */
pv->pe_start = pe_align();
pv->pe_start = pe_align(pv);
list_iterate_items(mda, &info->mdas) {
mdac = (struct mda_context *) mda->metadata_locn;
if (pv->dev == mdac->area.dev &&
@@ -1342,9 +1350,9 @@ static int _text_pv_write(const struct format_type *fmt, struct physical_volume
(pv->pe_start << SECTOR_SHIFT))) {
pv->pe_start = (mdac->area.start + mdac->area.size)
>> SECTOR_SHIFT;
adjustment = pv->pe_start % pe_align();
adjustment = pv->pe_start % pe_align(pv);
if (adjustment)
pv->pe_start += (pe_align() - adjustment);
pv->pe_start += (pe_align(pv) - adjustment);
}
}
if (!add_da

View File

@@ -194,11 +194,6 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
else
log_error("Couldn't find device with uuid '%s'.",
buffer);
if (partial_mode())
vg->status |= PARTIAL_VG;
else
return 0;
}
if (!(pv->vg_name = dm_pool_strdup(mem, vg->name)))
@@ -211,6 +206,9 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
return 0;
}
if (!pv->dev)
pv->status |= MISSING_PV;
/* Late addition */
_read_int64(pvn, "dev_size", &pv->size);
@@ -243,6 +241,7 @@ static int _read_pv(struct format_instance *fid, struct dm_pool *mem,
pv->pe_size = vg->extent_size;
pv->pe_alloc_count = 0;
pv->pe_align = 0;
pv->fmt = fid->fmt;
/* Fix up pv size if missing or impossibly large */
@@ -799,11 +798,6 @@ static struct volume_group *_read_vg(struct format_instance *fid,
dm_hash_destroy(pv_hash);
if (vg->status & PARTIAL_VG) {
vg->status &= ~LVM_WRITE;
vg->status |= LVM_READ;
}
/*
* Finished.
*/

View File

@@ -315,9 +315,6 @@ static int _lock_for_cluster(unsigned char cmd, uint32_t flags, const char *name
args[0] = flags & 0x7F; /* Maskoff lock flags */
args[1] = flags & 0xC0; /* Bitmap flags */
if (partial_mode())
args[1] |= LCK_PARTIAL_MODE;
if (mirror_in_sync())
args[1] |= LCK_MIRROR_NOSYNC_MODE;

View File

@@ -83,7 +83,6 @@ int check_lvm1_vg_inactive(struct cmd_context *cmd, const char *vgname);
/*
* Additional lock bits for cluster communication
*/
#define LCK_PARTIAL_MODE 0x00000001U /* Running in partial mode */
#define LCK_MIRROR_NOSYNC_MODE 0x00000002U /* Mirrors don't require sync */
#define LCK_DMEVENTD_MONITOR_MODE 0x00000004U /* Register with dmeventd */

View File

@@ -29,7 +29,6 @@ static struct str_list _log_dev_alias;
static int _verbose_level = VERBOSE_BASE_LEVEL;
static int _test = 0;
static int _partial = 0;
static int _md_filtering = 0;
static int _pvmove = 0;
static int _full_scan_done = 0; /* Restrict to one full scan during each cmd */
@@ -154,11 +153,6 @@ void init_test(int level)
_test = level;
}
void init_partial(int level)
{
_partial = level;
}
void init_md_filtering(int level)
{
_md_filtering = level;
@@ -254,11 +248,6 @@ int test_mode()
return _test;
}
int partial_mode()
{
return _partial;
}
int md_filtering()
{
return _md_filtering;

View File

@@ -64,7 +64,6 @@ void fin_syslog(void);
void init_verbose(int level);
void init_test(int level);
void init_partial(int level);
void init_md_filtering(int level);
void init_pvmove(int level);
void init_full_scan_done(int level);
@@ -84,7 +83,6 @@ void init_error_message_produced(int error_message_produced);
void set_cmd_name(const char *cmd_name);
int test_mode(void);
int partial_mode(void);
int md_filtering(void);
int pvmove_mode(void);
int full_scan_done(void);

View File

@@ -1169,7 +1169,7 @@ static int _allocate(struct alloc_handle *ah,
stack;
areas_size = list_size(pvms);
if (areas_size < ah->area_count + ah->log_count) {
if (areas_size && areas_size < (ah->area_count + ah->log_count)) {
if (ah->alloc != ALLOC_ANYWHERE) {
log_error("Not enough PVs with free space available "
"for parallel allocation.");
@@ -2360,11 +2360,7 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
struct segment_type *segtype;
struct lv_segment *mapseg;
if (!(segtype = get_segtype_from_string(cmd, "striped")))
return_NULL;
/* create an empty layer LV */
len = strlen(lv_where->name) + 32;
if (!(name = alloca(len))) {
log_error("layer name allocation failed. "
@@ -2384,12 +2380,43 @@ struct logical_volume *insert_layer_for_lv(struct cmd_context *cmd,
return NULL;
}
if (strstr(name, "_mimagetmp")) {
log_very_verbose("Creating transient 'zero' LV"
" for Mirror -> mirror up-convert.");
segtype = get_segtype_from_string(cmd, "zero");
if (!lv_add_virtual_segment(layer_lv, 0, lv_where->le_count, segtype)) {
log_error("Creation of intermediate layer LV failed.");
return NULL;
}
if (!vg_write(lv_where->vg)) {
log_error("Failed to write intermediate VG metadata");
return NULL;
}
if (!vg_commit(lv_where->vg)) {
log_error("Failed to commit intermediate VG metadata");
vg_revert(lv_where->vg);
return NULL;
}
if (!activate_lv(cmd, layer_lv)) {
log_error("Failed to resume intermediate 'zero' LV, %s", name);
return NULL;
}
}
log_very_verbose("Inserting layer %s for %s",
layer_lv->name, lv_where->name);
if (!_move_lv_segments(layer_lv, lv_where, 0, 0))
return_NULL;
if (!(segtype = get_segtype_from_string(cmd, "striped")))
return_NULL;
/* allocate a new linear segment */
if (!(mapseg = alloc_lv_segment(cmd->mem, segtype,
lv_where, 0, layer_lv->le_count,

View File

@@ -71,6 +71,13 @@ struct pv_segment;
//#define PRECOMMITTED 0x00200000U /* VG - internal use only */
#define CONVERTING 0x00400000U /* LV */
#define MISSING_PV 0x00800000U /* PV */
#define PARTIAL_LV 0x01000000U /* LV - derived flag, not
written out in metadata*/
//#define POSTORDER_FLAG 0x02000000U /* Not real flags, reserved for
//#define POSTORDER_OPEN_FLAG 0x04000000U temporary use inside vg_read. */
#define LVM_READ 0x00000100U /* LV VG */
#define LVM_WRITE 0x00000200U /* LV VG */
#define CLUSTERED 0x00000400U /* VG */
@@ -168,6 +175,7 @@ struct physical_volume {
uint64_t pe_start;
uint32_t pe_count;
uint32_t pe_alloc_count;
unsigned long pe_align;
struct list segments; /* Ordered pv_segments covering complete PV */
struct list tags;
@@ -563,6 +571,7 @@ uint64_t pv_pe_start(const pv_t *pv);
uint32_t pv_pe_count(const pv_t *pv);
uint32_t pv_pe_alloc_count(const pv_t *pv);
int vg_missing_pv_count(const vg_t *vg);
uint32_t vg_status(const vg_t *vg);
#define vg_is_clustered(vg) (vg_status((vg)) & CLUSTERED)

View File

@@ -27,6 +27,7 @@
#include "display.h"
#include "locking.h"
#include "archiver.h"
#include "defaults.h"
#include <sys/param.h>
@@ -64,9 +65,30 @@ static struct pv_list *_find_pv_in_vg(const struct volume_group *vg,
static struct physical_volume *_find_pv_in_vg_by_uuid(const struct volume_group *vg,
const struct id *id);
unsigned long pe_align(void)
unsigned long pe_align(struct physical_volume *pv)
{
return MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT;
if (pv->pe_align)
goto out;
pv->pe_align = MAX(65536UL, lvm_getpagesize()) >> SECTOR_SHIFT;
/*
* Align to chunk size of underlying md device if present
*/
if (!pv->dev)
goto out;
if (find_config_tree_bool(pv->fmt->cmd, "devices/md_chunk_alignment",
DEFAULT_MD_CHUNK_ALIGNMENT))
pv->pe_align = MAX(pv->pe_align,
dev_md_chunk_size(pv->fmt->cmd->sysfs_dir,
pv->dev));
log_very_verbose("%s: Setting PE alignment to %lu sectors.",
dev_name(pv->dev), pv->pe_align);
out:
return pv->pe_align;
}
/**
@@ -126,8 +148,8 @@ int add_pv_to_vg(struct volume_group *vg, const char *pv_name,
/* FIXME Do proper rounding-up alignment? */
/* Reserved space for label; this holds 0 for PVs created by LVM1 */
if (pv->pe_start < pe_align())
pv->pe_start = pe_align();
if (pv->pe_start < pe_align(pv))
pv->pe_start = pe_align(pv);
/*
* pe_count must always be calculated by pv_setup
@@ -317,9 +339,9 @@ int vg_remove_single(struct cmd_context *cmd, const char *vg_name,
struct pv_list *pvl;
int ret = 1;
if (!vg || !consistent || (vg_status(vg) & PARTIAL_VG)) {
log_error("Volume group \"%s\" not found or inconsistent.",
vg_name);
if (!vg || !consistent || vg_missing_pv_count(vg)) {
log_error("Volume group \"%s\" not found, is inconsistent "
"or has PVs missing.", vg_name);
log_error("Consider vgreduce --removemissing if metadata "
"is inconsistent.");
return 0;
@@ -471,19 +493,15 @@ struct volume_group *vg_create(struct cmd_context *cmd, const char *vg_name,
struct volume_group *vg;
struct dm_pool *mem = cmd->mem;
int consistent = 0;
int old_partial;
if (!(vg = dm_pool_zalloc(mem, sizeof(*vg))))
return_NULL;
/* is this vg name already in use ? */
old_partial = partial_mode();
init_partial(1);
if (vg_read(cmd, vg_name, NULL, &consistent)) {
log_err("A volume group called '%s' already exists.", vg_name);
goto bad;
}
init_partial(old_partial);
if (!id_create(&vg->id)) {
log_err("Couldn't create uuid for volume group '%s'.", vg_name);
@@ -771,7 +789,7 @@ static void _free_pv(struct dm_pool *mem, struct physical_volume *pv)
dm_pool_free(mem, pv);
}
static struct physical_volume *_alloc_pv(struct dm_pool *mem)
static struct physical_volume *_alloc_pv(struct dm_pool *mem, struct device *dev)
{
struct physical_volume *pv = dm_pool_zalloc(mem, sizeof(*pv));
@@ -787,7 +805,9 @@ static struct physical_volume *_alloc_pv(struct dm_pool *mem)
pv->pe_start = 0;
pv->pe_count = 0;
pv->pe_alloc_count = 0;
pv->pe_align = 0;
pv->fmt = NULL;
pv->dev = dev;
pv->status = ALLOCATABLE_PV;
@@ -808,7 +828,7 @@ static struct physical_volume *_pv_create(const struct format_type *fmt,
uint64_t pvmetadatasize, struct list *mdas)
{
struct dm_pool *mem = fmt->cmd->mem;
struct physical_volume *pv = _alloc_pv(mem);
struct physical_volume *pv = _alloc_pv(mem, dev);
if (!pv)
return NULL;
@@ -821,8 +841,6 @@ static struct physical_volume *_pv_create(const struct format_type *fmt,
goto bad;
}
pv->dev = dev;
if (!dev_get_size(pv->dev, &pv->size)) {
log_error("%s: Couldn't get size.", pv_dev_name(pv));
goto bad;
@@ -1174,6 +1192,161 @@ int vgs_are_compatible(struct cmd_context *cmd __attribute((unused)),
return 1;
}
struct _lv_postorder_baton {
int (*fn)(struct logical_volume *lv, void *data);
void *data;
};
static int _lv_postorder_visit(struct logical_volume *,
int (*fn)(struct logical_volume *lv, void *data),
void *data);
static int _lv_postorder_level(struct logical_volume *lv, void *data)
{
struct _lv_postorder_baton *baton = data;
if (lv->status & POSTORDER_OPEN_FLAG)
return 1; // a data structure loop has closed...
lv->status |= POSTORDER_OPEN_FLAG;
int r =_lv_postorder_visit(lv, baton->fn, baton->data);
lv->status &= ~POSTORDER_OPEN_FLAG;
lv->status |= POSTORDER_FLAG;
return r;
};
static int _lv_each_dependency(struct logical_volume *lv,
int (*fn)(struct logical_volume *lv, void *data),
void *data)
{
int i, s;
struct lv_segment *lvseg;
struct logical_volume *deps[] = {
lv->snapshot ? lv->snapshot->origin : 0,
lv->snapshot ? lv->snapshot->cow : 0 };
for (i = 0; i < sizeof(deps) / sizeof(*deps); ++i) {
if (deps[i] && !fn(deps[i], data))
return_0;
}
list_iterate_items(lvseg, &lv->segments) {
if (lvseg->log_lv && !fn(lvseg->log_lv, data))
return_0;
for (s = 0; s < lvseg->area_count; ++s) {
if (seg_type(lvseg, s) == AREA_LV && !fn(seg_lv(lvseg,s), data))
return_0;
}
}
return 1;
}
static int _lv_postorder_cleanup(struct logical_volume *lv, void *data)
{
if (!(lv->status & POSTORDER_FLAG))
return 1;
lv->status &= ~POSTORDER_FLAG;
if (!_lv_each_dependency(lv, _lv_postorder_cleanup, data))
return_0;
return 1;
}
static int _lv_postorder_visit(struct logical_volume *lv,
int (*fn)(struct logical_volume *lv, void *data),
void *data)
{
struct _lv_postorder_baton baton;
int r;
if (lv->status & POSTORDER_FLAG)
return 1;
baton.fn = fn;
baton.data = data;
r = _lv_each_dependency(lv, _lv_postorder_level, &baton);
if (r) {
r = fn(lv, data);
log_verbose("visited %s", lv->name);
}
return r;
}
/*
* This will walk the LV dependency graph in depth-first order and in the
* postorder, call a callback function "fn". The void *data is passed along all
* the calls. The callback may return zero to indicate an error and terminate
* the depth-first walk. The error is propagated to return value of
* _lv_postorder.
*/
static int _lv_postorder(struct logical_volume *lv,
int (*fn)(struct logical_volume *lv, void *data),
void *data)
{
int r;
r = _lv_postorder_visit(lv, fn, data);
_lv_postorder_cleanup(lv, 0);
return r;
}
struct _lv_mark_if_partial_baton {
int partial;
};
static int _lv_mark_if_partial_collect(struct logical_volume *lv, void *data)
{
struct _lv_mark_if_partial_baton *baton = data;
if (lv->status & PARTIAL_LV)
baton->partial = 1;
return 1;
}
static int _lv_mark_if_partial_single(struct logical_volume *lv, void *data)
{
int s;
struct _lv_mark_if_partial_baton baton;
struct lv_segment *lvseg;
list_iterate_items(lvseg, &lv->segments) {
for (s = 0; s < lvseg->area_count; ++s) {
if (seg_type(lvseg, s) == AREA_PV) {
if (seg_pv(lvseg, s)->status & MISSING_PV)
lv->status |= PARTIAL_LV;
}
}
}
baton.partial = 0;
_lv_each_dependency(lv, _lv_mark_if_partial_collect, &baton);
if (baton.partial)
lv->status |= PARTIAL_LV;
return 1;
}
static int _lv_mark_if_partial(struct logical_volume *lv)
{
return _lv_postorder(lv, _lv_mark_if_partial_single, NULL);
}
/*
* Mark LVs with missing PVs using PARTIAL_LV status flag. The flag is
* propagated transitively, so LVs referencing other LVs are marked
* partial as well, if any of their referenced LVs are marked partial.
*/
static int _vg_mark_partial_lvs(struct volume_group *vg)
{
struct logical_volume *lv;
struct lv_list *lvl;
list_iterate_items(lvl, &vg->lvs) {
lv = lvl->lv;
if (!_lv_mark_if_partial(lv))
return_0;
}
return 1;
}
int vg_validate(struct volume_group *vg)
{
struct pv_list *pvl, *pvl2;
@@ -1278,8 +1451,13 @@ int vg_write(struct volume_group *vg)
return_0;
if (vg->status & PARTIAL_VG) {
log_error("Cannot change metadata for partial volume group %s",
vg->name);
log_error("Cannot update partial volume group %s.", vg->name);
return 0;
}
if (vg_missing_pv_count(vg) && !vg->cmd->handles_missing_pvs) {
log_error("Cannot update volume group %s while physical "
"volumes are missing.", vg->name);
return 0;
}
@@ -1478,9 +1656,20 @@ static int _update_pv_list(struct list *all_pvs, struct volume_group *vg)
return 1;
}
int vg_missing_pv_count(const vg_t *vg)
{
int ret = 0;
struct pv_list *pvl;
list_iterate_items(pvl, &vg->pvs) {
if (pvl->pv->status & MISSING_PV)
++ ret;
}
return ret;
}
/* Caller sets consistent to 1 if it's safe for vg_read to correct
* inconsistent metadata on disk (i.e. the VG write lock is held).
* This guarantees only consistent metadata is returned unless PARTIAL_VG.
* This guarantees only consistent metadata is returned.
* If consistent is 0, caller must check whether consistent == 1 on return
* and take appropriate action if it isn't (e.g. abort; get write lock
* and call vg_read again).
@@ -1519,6 +1708,11 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
}
if ((correct_vg = lvmcache_get_vg(vgid, precommitted))) {
if (vg_missing_pv_count(correct_vg)) {
log_verbose("There are %d physical volumes missing.",
vg_missing_pv_count(correct_vg));
_vg_mark_partial_lvs(correct_vg);
}
*consistent = 1;
return correct_vg;
}
@@ -1614,7 +1808,8 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
}
}
if (list_size(&correct_vg->pvs) != list_size(pvids)) {
if (list_size(&correct_vg->pvs) != list_size(pvids)
+ vg_missing_pv_count(correct_vg)) {
log_debug("Cached VG %s had incorrect PV list",
vgname);
@@ -1623,6 +1818,8 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
else
correct_vg = NULL;
} else list_iterate_items(pvl, &correct_vg->pvs) {
if (pvl->pv->status & MISSING_PV)
continue;
if (!str_list_match_item(pvids, pvl->pv->dev->pvid)) {
log_debug("Cached VG %s had incorrect PV list",
vgname);
@@ -1679,11 +1876,10 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
/* FIXME Also ensure contents same - checksums same? */
if (correct_vg->seqno != vg->seqno) {
inconsistent = 1;
if (vg->seqno > correct_vg->seqno) {
if (!_update_pv_list(&all_pvs, vg))
return_NULL;
if (!_update_pv_list(&all_pvs, vg))
return_NULL;
if (vg->seqno > correct_vg->seqno)
correct_vg = vg;
}
}
}
@@ -1705,15 +1901,6 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
if (!*consistent)
return correct_vg;
/* Don't touch partial volume group metadata */
/* Should be fixed manually with vgcfgbackup/restore etc. */
if ((correct_vg->status & PARTIAL_VG)) {
log_error("Inconsistent metadata copies found for "
"partial volume group %s", vgname);
*consistent = 0;
return correct_vg;
}
/* Don't touch if vgids didn't match */
if (inconsistent_vgid) {
log_error("Inconsistent metadata UUIDs found for "
@@ -1752,6 +1939,12 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
}
}
if (vg_missing_pv_count(correct_vg)) {
log_verbose("There are %d physical volumes missing.",
vg_missing_pv_count(correct_vg));
_vg_mark_partial_lvs(correct_vg);
}
if ((correct_vg->status & PVMOVE) && !pvmove_mode()) {
log_error("WARNING: Interrupted pvmove detected in "
"volume group %s", correct_vg->name);
@@ -1811,11 +2004,10 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
if ((vg = _vg_read(cmd, NULL, vgid,
&consistent, precommitted)) &&
!strncmp((char *)vg->id.uuid, vgid, ID_LEN)) {
if (!consistent) {
log_error("Volume group %s metadata is "
"inconsistent", vg->name);
if (!partial_mode())
return NULL;
}
return vg;
}
@@ -1843,6 +2035,7 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
if ((vg = _vg_read(cmd, vgname, vgid, &consistent,
precommitted)) &&
!strncmp((char *)vg->id.uuid, vgid, ID_LEN)) {
if (!consistent) {
log_error("Volume group %s metadata is "
"inconsistent", vgname);
@@ -1976,7 +2169,6 @@ static int _get_pvs(struct cmd_context *cmd, struct list **pvslist)
struct list *vgids;
struct volume_group *vg;
int consistent = 0;
int old_partial;
int old_pvmove;
lvmcache_label_scan(cmd, 0);
@@ -1998,9 +2190,7 @@ static int _get_pvs(struct cmd_context *cmd, struct list **pvslist)
/* Read every VG to ensure cache consistency */
/* Orphan VG is last on list */
old_partial = partial_mode();
old_pvmove = pvmove_mode();
init_partial(1);
init_pvmove(1);
list_iterate_items(strl, vgids) {
vgid = strl->str;
@@ -2025,7 +2215,6 @@ static int _get_pvs(struct cmd_context *cmd, struct list **pvslist)
list_add(results, pvh);
}
init_pvmove(old_pvmove);
init_partial(old_partial);
if (pvslist)
*pvslist = results;
@@ -2085,6 +2274,7 @@ int pv_write_orphan(struct cmd_context *cmd, struct physical_volume *pv)
pv->vg_name = cmd->fmt->orphan_vg_name;
pv->status = ALLOCATABLE_PV;
pv->pe_alloc_count = 0;
if (!dev_get_size(pv->dev, &pv->size)) {
log_error("%s: Couldn't get size.", pv_dev_name(pv));

View File

@@ -61,6 +61,14 @@
//#define MIRROR_NOTSYNCED 0x00080000U /* LV */
#define ACTIVATE_EXCL 0x00100000U /* LV - internal use only */
#define PRECOMMITTED 0x00200000U /* VG - internal use only */
//#define CONVERTING 0x00400000U /* LV */
//#define MISSING_PV 0x00800000U /* PV */
//#define PARTIAL_LV 0x01000000U /* LV - derived flag, not
// written out in metadata*/
#define POSTORDER_FLAG 0x02000000U /* Not real flags, reserved for */
#define POSTORDER_OPEN_FLAG 0x04000000U /* temporary use inside vg_read. */
//#define LVM_READ 0x00000100U /* LV VG */
//#define LVM_WRITE 0x00000200U /* LV VG */
@@ -239,7 +247,7 @@ struct format_handler {
/*
* Utility functions
*/
unsigned long pe_align(void);
unsigned long pe_align(struct physical_volume *pv);
int vg_validate(struct volume_group *vg);
int pv_write_orphan(struct cmd_context *cmd, struct physical_volume *pv);

View File

@@ -179,7 +179,7 @@ int shift_mirror_images(struct lv_segment *mirrored_seg, unsigned mimage)
/* Place this one at the end */
mirrored_seg->areas[i-1] = area;
return 0;
return 1;
}
/*
@@ -491,7 +491,6 @@ static int _remove_mirror_images(struct logical_volume *lv,
struct logical_volume *detached_log_lv = NULL;
struct logical_volume *lv1 = NULL;
struct lv_segment *mirrored_seg = first_seg(lv);
struct lv_segment_area area;
uint32_t old_area_count = mirrored_seg->area_count;
uint32_t new_area_count = mirrored_seg->area_count;
struct lv_list *lvl;
@@ -599,13 +598,13 @@ static int _remove_mirror_images(struct logical_volume *lv,
log_very_verbose("Updating \"%s\" in kernel", mirrored_seg->lv->name);
/*
* Avoid having same mirror target loaded twice simultaneouly by first
* activating the removed LV which now contains an error segment.
* As it's now detached from mirrored_seg->lv we must activate it
* Avoid having same mirror target loaded twice simultaneously by first
* resuming the removed LV which now contains an error segment.
* As it's now detached from mirrored_seg->lv we must resume it
* explicitly.
*/
if (lv1 && !activate_lv(lv1->vg->cmd, lv1)) {
log_error("Problem reactivating removed %s", lv1->name);
if (lv1 && !resume_lv(lv1->vg->cmd, lv1)) {
log_error("Problem resuming temporary LV, %s", lv1->name);
return 0;
}

View File

@@ -155,7 +155,7 @@
/* Define to 1 to include support for realtime clock. */
#undef HAVE_REALTIME
/* Define to 1 if rl_completion_matches() is available. */
/* Define to 1 if you have the `rl_completion_matches' function. */
#undef HAVE_RL_COMPLETION_MATCHES
/* Define to 1 if you have the `rmdir' function. */

View File

@@ -439,7 +439,7 @@ static int _vgstatus_disp(struct dm_report *rh __attribute((unused)), struct dm_
else
repstr[2] = '-';
if (vg->status & PARTIAL_VG)
if (vg_missing_pv_count(vg))
repstr[3] = 'p';
else
repstr[3] = '-';

View File

@@ -26,6 +26,8 @@ MSGFMT = @MSGFMT@
LCOV = @LCOV@
GENHTML = @GENHTML@
LN_S = @LN_S@
SED = @SED@
LIBS = @LIBS@
DEFS += @DEFS@
CFLAGS += @CFLAGS@
@@ -41,7 +43,9 @@ bindir = $(DESTDIR)@bindir@
confdir = $(DESTDIR)@CONFDIR@/lvm
includedir = $(DESTDIR)@includedir@
libdir = $(DESTDIR)@libdir@
usrlibdir = $(DESTDIR)@usrlibdir@
sbindir = $(DESTDIR)@sbindir@
usrsbindir = $(DESTDIR)@usrsbindir@
infodir = $(DESTDIR)@infodir@
mandir = $(DESTDIR)@mandir@
localedir = $(DESTDIR)@LOCALEDIR@
@@ -94,6 +98,8 @@ LDFLAGS += -L$(top_srcdir)/lib -L$(libdir)
STRIP=
#STRIP = -s
LVM_VERSION := $(shell cat $(top_srcdir)/VERSION)
LIB_VERSION := $(shell cat $(top_srcdir)/VERSION | \
awk -F '.' '{printf "%s.%s",$$1,$$2}')

View File

@@ -35,12 +35,25 @@ MAN8CLUSTER=clvmd.8
MAN5DIR=${mandir}/man5
MAN8DIR=${mandir}/man8
CLEAN_TARGETS=$(MAN5) $(MAN8) $(MAN8CLUSTER) $(FSADMMAN)
include $(top_srcdir)/make.tmpl
ifneq ("@CLVMD@", "none")
install: install_cluster
endif
all: man
.PHONY: man
man: $(MAN5) $(MAN8) $(MAN8CLUSTER)
$(MAN5) $(MAN8) $(MAN8CLUSTER): Makefile
%: %.in
$(SED) -e "s/#VERSION#/$(LVM_VERSION)/" $< > $@
install:
@echo "Installing $(MAN8) in $(MAN8DIR)"
@for f in $(MAN8); \

View File

@@ -1,4 +1,4 @@
.TH CLVMD 8 "LVM TOOLS" "Red Hat Inc" \" -*- nroff -*-
.TH CLVMD 8 "LVM TOOLS #VERSION#" "Red Hat Inc" \" -*- nroff -*-
.SH NAME
clvmd \- cluster LVM daemon
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH "FSADM" "8" "LVM TOOLS" "Red Hat, Inc" "\""
.TH "FSADM" "8" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\""
.SH "NAME"
fsadm \- utility to resize or check filesystem on a device
.SH "SYNOPSIS"

View File

@@ -1,4 +1,4 @@
.TH LVCHANGE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVCHANGE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvchange \- change attributes of a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVCONVERT 8 "LVM TOOLS" "Red Hat, Inc" \" -*- nroff -*-
.TH LVCONVERT 8 "LVM TOOLS #VERSION#" "Red Hat, Inc" \" -*- nroff -*-
.SH NAME
lvconvert \- convert a logical volume from linear to mirror or snapshot
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVCREATE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvcreate \- create a logical volume in an existing volume group
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVDISPLAY 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVDISPLAY 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvdisplay \- display attributes of a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVEXTEND 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVEXTEND 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvextend \- extend the size of a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVM 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVM 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvm \- LVM2 tools
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVM.CONF 5 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVM.CONF 5 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvm.conf \- Configuration file for LVM2
.SH SYNOPSIS
@@ -300,12 +300,16 @@ in \fBlvm\fP (8).
.TP
\fBactivation\fP \(em Settings affecting device-mapper activation
.IP
\fBmissing_stripe_filler\fP \(em When activating an incomplete
logical volume in partial mode, this missing data is replaced
with this device. It could perhaps be a block device that always
returns an error when it is accessed, or one that always
returns zeros. See \fBlvcreate\fP (8) for how to create
such devices.
\fBmissing_stripe_filler\fP \(em When activating an incomplete logical
volume in partial mode, this option dictates how the missing data is
replaced. A value of "error" will cause activation to create error
mappings for the missing data, meaning that read access to missing
portions of the volume will result in I/O errors. You can instead also
use a device path, and in that case this device will be used in place of
missing stripes. However, note that using anything other than
"error" with mirrored or snapshotted volumes is likely to result in data
corruption. For instructions on how to create a device that always
returns zeros, see \fBlvcreate\fP (8).
.IP
\fBmirror_region_size\fP \(em Unit size in KB for copy operations
when mirroring.

View File

@@ -1,4 +1,4 @@
.TH LVMCHANGE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVMCHANGE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvmchange \- change attributes of the logical volume manager
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVMDISKSCAN 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVMDISKSCAN 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvmdiskscan \- scan for all devices visible to LVM2
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVMDUMP "8" "" "Red Hat, Inc."
.TH LVMDUMP 8 "LVM TOOLS #VERSION#" "Red Hat, Inc."
.SH NAME
lvmdump - create lvm2 information dumps for diagnostic purposes
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVREDUCE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVREDUCE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvreduce \- reduce the size of a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVREMOVE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVREMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvremove \- remove a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVRENAME 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVRENAME 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvrename \- rename a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVRESIZE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVRESIZE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvresize \- resize a logical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVS 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVS 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvs \- report information about logical volumes
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH LVSCAN 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH LVSCAN 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
lvscan \- scan (all disks) for logical volumes
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVCHANGE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVCHANGE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvchange \- change attributes of a physical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVCK 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVCK 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvck \- check physical volume metadata
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVCREATE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvcreate \- initialize a disk or partition for use by LVM
.SH SYNOPSIS
@@ -125,6 +125,13 @@ SCSI disk for later use by LVM:
.B pvcreate /dev/sdc4 /dev/sde
.sp
.SH SEE ALSO
.BR lvm "(8), " vgcreate "(8), " vgextend "(8), " lvcreate "(8), "
.BR cfdisk "(8), " fdisk "(8), " losetup "(8), " mdadm "(8), "
.BR vgcfgrestore "(8), " vgconvert "(8)"
.BR lvm (8),
.BR vgcreate (8),
.BR vgextend (8),
.BR lvcreate (8),
.BR cfdisk (8),
.BR fdisk (8),
.BR losetup (8),
.BR mdadm (8),
.BR vgcfgrestore (8),
.BR vgconvert (8)

View File

@@ -1,4 +1,4 @@
.TH PVDISPLAY 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVDISPLAY 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvdisplay \- display attributes of a physical volume
.SH SYNOPSIS
@@ -44,7 +44,7 @@ Only display the size of the given physical volumes.
Display the mapping of physical extents to logical volumes and
logical extents.
.SH SEE ALSO
.BR lvm (8),
.BR pvcreate (8),
.BR lvcreate (8),
.BR lvm (8),
.BR pvcreate (8),
.BR lvcreate (8),
.BR vgcreate (8)

View File

@@ -1,4 +1,4 @@
.TH PVMOVE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvmove \- move physical extents
.SH SYNOPSIS
@@ -93,6 +93,7 @@ to free physical extents elsewhere in the volume group, giving verbose
runtime information, use:
.sp
\ pvmove -v /dev/hda4
.sp
.SH SEE ALSO
.BR lvm (8), vgconvert (8)
.BR lvm (8),
.BR vgconvert (8)

View File

@@ -1,4 +1,4 @@
.TH PVREMOVE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVREMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvremove \- remove a physical volume
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVRESIZE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVRESIZE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvresize \- resize a disk or partition in use by LVM2
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVS 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVS 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvs \- report information about physical volumes
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH PVSCAN 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH PVSCAN 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
pvscan \- scan all disks for physical volumes
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH VGCFGBACKUP 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGCFGBACKUP 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgcfgbackup \- backup volume group descriptor area
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH VGCFGRESTORE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGCFGRESTORE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgcfgrestore \- restore volume group descriptor area
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH VGCHANGE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGCHANGE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgchange \- change attributes of a volume group
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH VGCK 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGCK 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgck \- check volume group metadata
.SH SYNOPSIS
@@ -9,7 +9,7 @@ vgck checks LVM metadata for each named volume group for consistency.
.SH OPTIONS
See \fBlvm\fP for common options.
.SH SEE ALSO
.BR lvm (8),
.BR vgcreate (8),
.BR vgchange (8),
.BR lvm (8),
.BR vgcreate (8),
.BR vgchange (8),
.BR vgscan (8)

View File

@@ -1,4 +1,4 @@
.TH VGCONVERT 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGCONVERT 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgconvert \- convert volume group metadata format
.SH SYNOPSIS
@@ -34,5 +34,6 @@ such PV to reformat it as it was, using the archive file that
Finally run \fBvgcfgrestore\fP(8) with that archive file to restore
the original metadata.
.SH SEE ALSO
.BR lvm "(8), " pvcreate "(8),"
.BR vgcfgrestore "(8)"
.BR lvm (8),
.BR pvcreate (8),
.BR vgcfgrestore (8)

View File

@@ -1,4 +1,4 @@
.TH VGCREATE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGCREATE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgcreate \- create a volume group
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH VGDISPLAY 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGDISPLAY 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgdisplay \- display attributes of volume groups
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH VGEXPORT 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGEXPORT 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgexport \- make volume groups unknown to the system
.SH SYNOPSIS
@@ -21,7 +21,7 @@ See \fBlvm\fP for common options.
.I \-a, \-\-all
Export all inactive Volume Groups.
.SH SEE ALSO
.BR lvm (8),
.BR lvm (8),
.BR pvscan (8),
.BR vgimport (8),
.BR vgimport (8),
.BR vgscan (8)

View File

@@ -1,4 +1,4 @@
.TH VGEXTEND 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGEXTEND 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgextend \- add physical volumes to a volume group
.SH SYNOPSIS
@@ -19,7 +19,7 @@ group "vg00" by the new physical volumes (see
.B pvcreate(8)
) "/dev/sdn1" and /dev/sda4".
.SH SEE ALSO
.BR lvm (8),
.BR vgcreate (8),
.BR vgreduce (8),
.BR lvm (8),
.BR vgcreate (8),
.BR vgreduce (8),
.BR pvcreate (8)

View File

@@ -1,4 +1,4 @@
.TH VGIMPORT 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGIMPORT 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgimport \- make exported volume groups known to the system
.SH SYNOPSIS
@@ -19,7 +19,7 @@ See \fBlvm\fP for common options.
.I \-a, \-\-all
Import all exported Volume Groups.
.SH SEE ALSO
.BR lvm (8),
.BR lvm (8),
.BR pvscan (8),
.BR vgexport (8),
.BR vgexport (8),
.BR vgscan (8)

View File

@@ -1,4 +1,4 @@
.TH VGMERGE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGMERGE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgmerge \- merge two volume groups
.SH SYNOPSIS
@@ -23,7 +23,7 @@ Do a test run WITHOUT making any real changes.
into the active or inactive volume group named "databases" giving verbose
runtime information.
.SH SEE ALSO
.BR lvm (8),
.BR vgcreate (8),
.BR vgextend (8),
.BR lvm (8),
.BR vgcreate (8),
.BR vgextend (8),
.BR vgreduce (8)

View File

@@ -1,4 +1,4 @@
.TH VGMKNODES 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGMKNODES 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgmknodes \- recreate volume group directory and logical volume special files
.SH SYNOPSIS
@@ -12,6 +12,6 @@ logical volumes and creates any missing ones and removes unused ones.
.SH OPTIONS
See \fBlvm\fP for common options.
.SH SEE ALSO
.BR lvm (8),
.BR lvm (8),
.BR vgscan (8),
.BR dmsetup (8)

View File

@@ -1,4 +1,4 @@
.TH VGREDUCE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGREDUCE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgreduce \- reduce a volume group
.SH SYNOPSIS
@@ -18,11 +18,13 @@ See \fBlvm\fP for common options.
Removes all empty physical volumes if none are given on command line.
.TP
.I \-\-removemissing
Removes all missing physical volumes from the volume group and makes
the volume group consistent again.
Removes all missing physical volumes from the volume group, if there are no
logical volumes allocated on those. This resumes normal operation of the volume
group (new logical volumes may again be created, changed and so on).
It's a good idea to run this option with --test first to find out what it
would remove before running it for real.
If this is not possible (there are logical volumes referencing the missing
physical volumes) and you cannot or do not want to remove them manually, you
can run this option with --force to have vgreduce remove any partial LVs.
Any logical volumes and dependent snapshots that were partly on the
missing disks get removed completely. This includes those parts
@@ -33,5 +35,5 @@ lost, you might want to try to salvage data first by activating your
logical volumes with --partial as described in \fBlvm (8)\fP.
.SH SEE ALSO
.BR lvm (8),
.BR lvm (8),
.BR vgextend (8)

View File

@@ -1,4 +1,4 @@
.TH VGREMOVE 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGREMOVE 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgremove \- remove a volume group
.SH SYNOPSIS
@@ -22,7 +22,7 @@ See \fBlvm\fP for common options.
Force the removal of any logical volumes on the volume group
without confirmation.
.SH SEE ALSO
.BR lvm (8),
.BR lvremove (8),
.BR vgcreate (8),
.BR lvm (8),
.BR lvremove (8),
.BR vgcreate (8),
.BR vgreduce (8)

View File

@@ -1,4 +1,4 @@
.TH VGRENAME 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGRENAME 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgrename \- rename a volume group
.SH SYNOPSIS
@@ -43,7 +43,7 @@ one of the conflicting Volume Groups with
\fBvgrename\fP.
.TP
.SH SEE ALSO
.BR lvm (8),
.BR vgchange (8),
.BR vgcreate (8),
.BR lvm (8),
.BR vgchange (8),
.BR vgcreate (8),
.BR lvrename (8)

View File

@@ -1,4 +1,4 @@
.TH VGS 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGS 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgs \- report information about volume groups
.SH SYNOPSIS

View File

@@ -1,4 +1,4 @@
.TH VGSCAN 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGSCAN 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgscan \- scan all disks for volume groups and rebuild caches
.SH SYNOPSIS
@@ -23,6 +23,6 @@ See \fBlvm\fP for common options.
Also checks the LVM special files in /dev that are needed for active
logical volumes and creates any missing ones and removes unused ones.
.SH SEE ALSO
.BR lvm (8),
.BR vgcreate (8),
.BR lvm (8),
.BR vgcreate (8),
.BR vgchange (8)

View File

@@ -1,4 +1,4 @@
.TH VGSPLIT 8 "LVM TOOLS" "Sistina Software UK" \" -*- nroff -*-
.TH VGSPLIT 8 "LVM TOOLS #VERSION#" "Sistina Software UK" \" -*- nroff -*-
.SH NAME
vgsplit \- split a volume group into two
.SH SYNOPSIS
@@ -59,8 +59,8 @@ logical volume being split across volume groups.
.SH OPTIONS
See \fBlvm\fP for common options.
.SH SEE ALSO
.BR lvm (8),
.BR vgcreate (8),
.BR vgextend (8),
.BR lvm (8),
.BR vgcreate (8),
.BR vgextend (8),
.BR vgreduce (8),
.BR vgmerge (8)

View File

@@ -26,6 +26,8 @@ abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
all: init.sh
sh harness.sh
init.sh: Makefile.in .bin-dir-stamp
rm -f $@-t $@
echo 'top_srcdir=$(top_srcdir)' >> $@-t
@@ -47,8 +49,7 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
$(T): init.sh
@echo "*** $@ ***"; '$(SHELL_PATH_SQ)' \
$(TESTS_ENVIRONMENT) $@ $(LVM_TEST_OPTS)
sh harness.sh $@
.bin-dir-stamp: lvm-wrapper
rm -rf bin
@@ -76,6 +77,5 @@ clean:
distclean: clean
all: $(T)
.PHONY: $(T) clean distclean
.NOTPARALLEL:

35
test/harness.sh Normal file
View File

@@ -0,0 +1,35 @@
#!/bin/sh
tests="$@"
test -z "$tests" && tests=`echo t-*.sh`
for t in $tests; do
printf "Running %-40s" "$t ..."
out=`bash ./$t 2>&1`
ret=$?
if test $ret = 0; then
echo " passed."
elif test $ret = 200; then
echo " skipped."
else
echo " FAILED!"
len=`echo $t | wc -c`
# fancy formatting...
printf -- "--- Output: $t -"
for i in `seq $(($len + 14)) 78`; do echo -n "-"; done; echo
printf "%s\n" "$out"
printf -- "--- End: $t ----"
for i in `seq $(($len + 14)) 78`; do echo -n "-"; done; echo
failed="$failed $t"
fi
done
if test -n "$failed"; then
echo "TESTS FAILED:"
for t in $failed; do
printf "\t%s\n" $t
done
exit 1
else
echo "All tests passed."
fi

View File

@@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
@@ -9,32 +8,18 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
test_description='Basics: see if tools are built, etc.'
. ./test-utils.sh
. ./test-lib.sh
lvm version >/dev/null 2>&1
if test $? != 0; then
echo >&2 'You do not seem to have built lvm yet.'
exit 1
fi
lvm version
v=$abs_top_srcdir/tools/version.h
test_expect_success \
"get version string from $v" \
'sed -n "/#define LVM_VERSION ./s///p" '"$v"'|sed "s/ .*//" > expected'
sed -n "/#define LVM_VERSION ./s///p" "$v" | sed "s/ .*//" > expected
test_expect_success \
'get version of a just-built binary, ensuring PATH is set properly' \
'lvm pvmove --version|sed -n "1s/.*: *\([0-9][^ ]*\) .*/\1/p" > actual'
lvm pvmove --version|sed -n "1s/.*: *\([0-9][^ ]*\) .*/\1/p" > actual
test_expect_success \
'ensure they are the same' \
'diff -u actual expected'
# ensure they are the same
diff -u actual expected
# Need mdadm for some pvcreate tests
test_expect_success \
'verify mdadm is installed and in path (needed for pvcreate tests)' \
'which mdadm'
test_done
# verify mdadm is installed and in path (needed for pvcreate tests) ... is it?
which mdadm

View File

@@ -1,5 +1,4 @@
#!/bin/sh
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
# Copyright (C) 2008 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
@@ -13,21 +12,7 @@
# tests basic functionality of read-ahead and ra regressions
#
test_description='Test coverage'
privileges_required_=1
. ./test-lib.sh
cleanup_()
{
vgremove -f "$vg" 2>/dev/null || true
test -n "$d1" && losetup -d "$d1"
test -n "$d2" && losetup -d "$d2"
test -n "$d3" && losetup -d "$d3"
test -n "$d4" && losetup -d "$d4"
test -n "$d5" && losetup -d "$d5"
rm -f "$f1" "$f2" "$f3" "$f4" "$f5"
}
. ./test-utils.sh
get_lvs_()
{
@@ -37,63 +22,56 @@ get_lvs_()
esac
}
test_expect_success "set up temp files, loopback devices" \
'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") &&
f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") &&
f3=$(pwd)/3 && d3=$(loop_setup_ "$f3") &&
f4=$(pwd)/4 && d4=$(loop_setup_ "$f4") &&
f5=$(pwd)/5 && d5=$(loop_setup_ "$f5") &&
vg=$(this_test_)-test-vg-$$ &&
lv=$(this_test_)-test-lv-$$
pvcreate "$d1" &&
pvcreate --metadatacopies 0 "$d2" &&
pvcreate --metadatacopies 0 "$d3" &&
pvcreate "$d4" &&
pvcreate --metadatacopies 0 "$d5" &&
vgcreate -c n "$vg" "$d1" "$d2" "$d3" "$d4" "$d5" &&
lvcreate -n "$lv" -l 1%FREE -i5 -I256 "$vg"'
aux prepare_devs 5
test_expect_success "test *scan and *display tools" \
'pvscan &&
vgscan &&
lvscan &&
lvmdiskscan &&
vgdisplay --units k &&
lvdisplay --units g &&
for i in b k m g t p e H B K M G T P E ; do \
pvdisplay --units "$i" "$d1" || return $? ; done'
pvcreate $dev1
pvcreate --metadatacopies 0 $dev2
pvcreate --metadatacopies 0 $dev3
pvcreate $dev4
pvcreate --metadatacopies 0 $dev5
vgcreate -c n $vg $devs
lvcreate -n $lv -l 5 -i5 -I256 $vg
test_expect_success "test vgexport vgimport tools" \
'vgchange -an "$vg" &&
vgexport "$vg" &&
vgimport "$vg" &&
vgchange -ay "$vg"'
# test *scan and *display tools
pvscan
vgscan
lvscan
lvmdiskscan
vgdisplay --units k
lvdisplay --units g
for i in b k m g t p e H B K M G T P E ; do
pvdisplay --units "$i" "$dev1"
done
# test vgexport vgimport tools
vgchange -an $vg
vgexport $vg
vgimport $vg
vgchange -ay $vg
# "-persistent y --major 254 --minor 20"
# "-persistent n"
test_expect_success "test various lvm utils" \
'for i in dumpconfig formats segtypes
do lvm "$i" || return $? ; done &&
for i in pr "p rw" an ay "-monitor y" "-monitor n" \
-resync -refresh "-addtag MYTAG" "-deltag MYETAG"
do lvchange -$i "$vg"/"$lv" || return $? ; done &&
pvck "$d1" &&
vgck "$vg" &&
lvrename "$vg" "$lv" "$lv-rename" &&
vgcfgbackup -f "$(pwd)/backup.$$" "$vg" &&
vgchange -an "$vg" &&
vgcfgrestore -f "$(pwd)/backup.$$" "$vg" &&
vgremove -f "$vg" &&
pvresize --setphysicalvolumesize 10M "$d1"'
# test various lvm utils
for i in dumpconfig formats segtypes; do
lvm "$i"
done
test_expect_failure "test various errors and obsoleted tools" \
'lvmchange ||
lvrename "$vg" ||
lvrename "$vg-xxx" ||
lvrename "$vg" "$vg"/"$lv-rename" "$vg"/"$lv"'
for i in pr "p rw" an ay "-monitor y" "-monitor n" \
-resync -refresh "-addtag MYTAG" "-deltag MYETAG"; do
lvchange -$i "$vg"/"$lv"
done
test_done
pvck "$d1"
vgck "$vg"
lvrename "$vg" "$lv" "$lv-rename"
vgcfgbackup -f "$(pwd)/backup.$$" "$vg"
vgchange -an "$vg"
vgcfgrestore -f "$(pwd)/backup.$$" "$vg"
vgremove -f "$vg"
pvresize --setphysicalvolumesize 10M "$dev1"
# Local Variables:
# indent-tabs-mode: nil
# End:
# test various errors and obsoleted tools
not lvmchange
not lvrename "$vg"
not lvrename "$vg-xxx"
not lvrename "$vg" "$vg"/"$lv-rename" "$vg"/"$lv"

View File

@@ -1,5 +1,4 @@
#!/bin/sh
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
# Copyright (C) 2008 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
@@ -9,81 +8,33 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
test_description="ensure that lvcreate's select-by-tag code works"
privileges_required_=1
. ./test-utils.sh
. ./test-lib.sh
aux prepare_pvs 3
dmsetup_has_dm_devdir_support_ ||
{
say "Your version of dmsetup lacks support for changing DM_DEVDIR."
say "Skipping this test"
exit 0
}
vgcreate $vg $devs
pvchange --addtag fast $devs
cleanup_()
{
test -n "$vg" && {
lvremove -ff $vg
vgremove $vg
} > /dev/null
test -n "$pvs" && {
pvremove $pvs > /dev/null
for d in $pvs; do
dmsetup remove $(basename $d)
done
}
losetup -d $lodev
rm -f $lofile
}
# 3 stripes with 3 PVs (selected by tag, @fast) is fine
lvcreate -l3 -i3 $vg @fast
nr_pvs=3
pvsize=$((200 * 1024 * 2))
# too many stripes(4) for 3 PVs
not lvcreate -l4 -i4 $vg @fast
test_expect_success \
'set up temp file and loopback device' \
'lofile=$(pwd)/lofile && lodev=$(loop_setup_ "$lofile")'
# 2 stripes is too many with just one PV
not lvcreate -l2 -i2 $vg $G_dev_/mapper/pv1
offset=0
pvs=
for n in $(seq 1 $nr_pvs); do
test_expect_success \
"create pv$n" \
'echo "0 $pvsize linear $lodev $offset" > in &&
dmsetup create pv$n < in'
offset=$(($offset + $pvsize))
done
# lvcreate mirror
lvcreate -l1 -m1 $vg @fast
for n in $(seq 1 $nr_pvs); do
pvs="$pvs $G_dev_/mapper/pv$n"
done
# lvcreate mirror w/corelog
lvcreate -l1 -m2 --corelog $vg @fast
test_expect_success \
"Run this: pvcreate $pvs" \
'pvcreate $pvs'
# lvcreate mirror w/no free PVs
not lvcreate -l1 -m2 $vg @fast
vg=lvcreate-pvtags-vg-$$
test_expect_success \
'set up a VG with tagged PVs' \
'vgcreate $vg $pvs &&
pvchange --addtag fast $pvs'
# lvcreate mirror (corelog, w/no free PVs)
not lvcreate -l1 -m3 --corelog $vg @fast
test_expect_success '3 stripes with 3 PVs (selected by tag, @fast) is fine' \
'lvcreate -l3 -i3 $vg @fast'
test_expect_failure 'too many stripes(4) for 3 PVs' \
'lvcreate -l4 -i4 $vg @fast'
test_expect_failure '2 stripes is too many with just one PV' \
'lvcreate -l2 -i2 $vg $G_dev_/mapper/pv1'
test_expect_success 'lvcreate mirror' \
'lvcreate -l1 -m1 $vg @fast'
test_expect_success 'lvcreate mirror w/corelog' \
'lvcreate -l1 -m2 --corelog $vg @fast'
test_expect_failure 'lvcreate mirror w/no free PVs' \
'lvcreate -l1 -m2 $vg @fast'
test_expect_failure 'lvcreate mirror (corelog, w/no free PVs)' \
'lvcreate -l1 -m3 --corelog $vg @fast'
test_expect_failure 'lvcreate mirror with a single PV arg' \
'lvcreate -l1 -m1 --corelog $vg $G_dev_/mapper/pv1'
test_done
# lvcreate mirror with a single PV arg
not lvcreate -l1 -m1 --corelog $vg $dev1

View File

@@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
# Copyright (C) 2008 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
@@ -9,82 +9,46 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
test_description='Exercise some lvcreate diagnostics'
privileges_required_=1
# 'Exercise some lvcreate diagnostics'
. ./test-lib.sh
. ./test-utils.sh
cleanup_()
{
test -n "$vg" && {
vgchange -an "$vg"
lvremove -ff "$vg"
vgremove "$vg"
} > "$test_dir_/cleanup.log"
test -n "$d1" && losetup -d "$d1"
test -n "$d2" && losetup -d "$d2"
rm -f "$f1" "$f2"
}
aux prepare_vg 2
test_expect_success \
'set up temp files, loopback devices, PVs, and a VG' \
'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") &&
f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") &&
pvcreate $d1 $d2 &&
vg=$(this_test_)-test-vg-$$ &&
vgcreate $vg $d1 $d2'
# "lvcreate rejects repeated invocation (run 2 times)"
lvcreate -n $lv -l 4 $vg
not lvcreate -n $lv -l 4 $vg
lvremove -ff $vg/$lv
lv=lvcreate-usage-$$
# "lvcreate rejects a negative stripe_size"
not lvcreate -L 64M -n $lv -i2 --stripesize -4 $vg 2>err;
grep "^ Negative stripesize is invalid\$" err
test_expect_success \
"lvcreate rejects repeated invocation (run 2 times)" '
lvcreate -n $lv -l 4 $vg &&
{ lvcreate -n $lv -l 4 $vg;
status=$?; echo status=$status; test $status = 5 &&
lvremove -ff $vg/$lv
}
'
# 'lvcreate rejects a too-large stripesize'
not lvcreate -L 64M -n $lv -i2 --stripesize 4294967291 $vg 2>err
grep "^ Stripe size cannot be larger than 512.00 GB\$" err
test_expect_success \
'lvcreate rejects a negative stripe_size' \
'lvcreate -L 64M -n $lv -i2 --stripesize -4 $vg 2>err;
status=$?; echo status=$status; test $status = 3 &&
grep "^ Negative stripesize is invalid\$" err'
# 'lvcreate w/single stripe succeeds with diagnostics to stdout'
lvcreate -L 64M -n $lv -i1 --stripesize 4 $vg >out 2>err
grep "^ Redundant stripes argument: default is 1\$" out
grep "^ Ignoring stripesize argument with single stripe\$" out
lvdisplay $vg
lvremove -ff $vg
test_expect_success \
'lvcreate rejects a too-large stripesize' \
'lvcreate -L 64M -n $lv -i2 --stripesize 4294967291 $vg 2>err; test $? = 3 &&
grep "^ Stripe size cannot be larger than 512.00 GB\$" err'
# 'lvcreate w/default (64KB) stripe size succeeds with diagnostics to stdout'
lvcreate -L 64M -n $lv -i2 $vg > out
grep "^ Using default stripesize" out
lvdisplay $vg
check_lv_field_ $vg/$lv stripesize "64.00K"
lvremove -ff $vg
test_expect_success \
'lvcreate w/single stripe succeeds with diagnostics to stdout' \
'lvcreate -L 64M -n $lv -i1 --stripesize 4 $vg >out 2>err &&
grep "^ Redundant stripes argument: default is 1\$" out &&
grep "^ Ignoring stripesize argument with single stripe\$" out &&
lvdisplay $vg &&
lvremove -ff $vg'
test_expect_success \
'lvcreate w/default (64KB) stripe size succeeds with diagnostics to stdout' \
'lvcreate -L 64M -n $lv -i2 $vg > out &&
grep "^ Using default stripesize" out &&
lvdisplay $vg &&
check_lv_field_ $vg/$lv stripesize "64.00K" &&
lvremove -ff $vg'
test_expect_success \
'lvcreate rejects an invalid number of stripes' \
'lvcreate -L 64M -n $lv -i129 $vg 2>err; test $? = 3 &&
grep "^ Number of stripes (129) must be between 1 and 128\$" err'
# 'lvcreate rejects an invalid number of stripes'
not lvcreate -L 64M -n $lv -i129 $vg 2>err
grep "^ Number of stripes (129) must be between 1 and 128\$" err
# The case on lvdisplay output is to verify that the LV was not created.
test_expect_success \
'lvcreate rejects an invalid stripe size' \
'lvcreate -L 64M -n $lv -i2 --stripesize 3 $vg 2>err; test $? = 3 &&
grep "^ Invalid stripe size 3\.00 KB\$" err &&
case $(lvdisplay $vg) in "") true ;; *) false ;; esac'
# 'lvcreate rejects an invalid stripe size'
not lvcreate -L 64M -n $lv -i2 --stripesize 3 $vg 2>err
grep "^ Invalid stripe size 3\.00 KB\$" err
case $(lvdisplay $vg) in "") true ;; *) false ;; esac
test_done
# Local Variables:
# indent-tabs-mode: nil
# End:

View File

@@ -1,5 +1,5 @@
#!/bin/sh
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
# Copyright (C) 2008 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
@@ -9,60 +9,36 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
test_description='Check extents percentage arguments'
privileges_required_=1
# 'Check extents percentage arguments'
. ./test-lib.sh
. ./test-utils.sh
cleanup_()
{
test -n "$vg" && {
vgchange -an "$vg"
lvremove -ff "$vg"
vgremove -f "$vg"
} > "$test_dir_/cleanup.log"
test -n "$d1" && losetup -d "$d1"
test -n "$d2" && losetup -d "$d2"
rm -f "$f1" "$f2"
}
aux prepare_vg 2 128
test_expect_success \
'set up temp files, loopback devices, PVs, and a VG' \
'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") &&
f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") &&
pvcreate $d1 $d2 &&
vg=$(this_test_)-test-vg-$$ &&
vgcreate $vg $d1 $d2 &&
lv=$(this_test_)-test-lv-$$ &&
lvcreate -L 64M -n $lv $vg'
lvcreate -L 64M -n $lv $vg
test_expect_success \
'lvextend rejects both size and extents without PVs' \
'lvextend -l 10 -L 64M $vg/$lv 2>err; test $? = 3 &&
grep "^ Please specify either size or extents but not both.\$" err'
# 'lvextend rejects both size and extents without PVs'
not lvextend -l 10 -L 64M $vg/$lv 2>err
grep "^ Please specify either size or extents but not both.\$" err
test_expect_success \
'lvextend rejects both size and extents with PVs' \
'lvextend -l 10 -L 64M $vg/$lv $d1 2>err; test $? = 3 &&
grep "^ Please specify either size or extents but not both.\$" err'
# 'lvextend rejects both size and extents with PVs'
not lvextend -l 10 -L 64M $vg/$lv $dev1 2>err
grep "^ Please specify either size or extents but not both.\$" err
test_expect_success \
'lvextend accepts no size or extents but one PV - bz154691' \
'lvextend $vg/$lv $d1 >out; test $? = 0 &&
grep "^ Logical volume $lv successfully resized\$" out &&
check_pv_field_ $d1 pv_free "0"'
# 'lvextend accepts no size or extents but one PV - bz154691'
lvextend $vg/$lv $dev1 >out
grep "^ Logical volume $lv successfully resized\$" out
check_pv_field_ $dev1 pv_free "0"
test_expect_success \
'Reset LV to original size' \
'lvremove -f $vg/$lv; test $? = 0 &&
lvcreate -L 64M -n $lv $vg; test $? = 0'
# 'Reset LV to original size'
lvremove -f $vg/$lv
lvcreate -L 64M -n $lv $vg
test_expect_success \
'lvextend accepts no size but extents 100%PVS and two PVs - bz154691' \
'lvextend -l +100%PVS $vg/$lv $d1 $d2 >out; test $? = 0 &&
grep "^ Logical volume $lv successfully resized\$" out &&
check_pv_field_ $d1 pv_free "0" &&
check_pv_field_ $d2 pv_free "0"'
# 'lvextend accepts no size but extents 100%PVS and two PVs - bz154691'
lvextend -l +100%PVS $vg/$lv $dev1 $dev2 >out
grep "^ Logical volume $lv successfully resized\$" out
check_pv_field_ $dev1 pv_free "0"
check_pv_field_ $dev2 pv_free "0"
# Exercise the range overlap code. Allocate every 2 extents.
#
@@ -84,22 +60,15 @@ test_expect_success \
# Total number of extents should be 12 + overlap = 12 + 6 = 18.
# Thus, total size for the LV should be 18 * 4M = 72M
#
test_expect_success \
'Reset LV to 12 extents, allocate every other 2 extents' \
'create_pvs=`for i in $(seq 0 4 20); do echo -n "\$d1:$i-$(($i + 1)) "; done` &&
lvremove -f $vg/$lv; test $? = 0 &&
lvcreate -l 12 -n $lv $vg $create_pvs; test $? = 0 &&
check_lv_field_ $vg/$lv lv_size "48.00M"'
# 'Reset LV to 12 extents, allocate every other 2 extents'
create_pvs=`for i in $(seq 0 4 20); do echo -n "\$dev1:$i-$(($i + 1)) "; done`
lvremove -f $vg/$lv
lvcreate -l 12 -n $lv $vg $create_pvs
check_lv_field_ $vg/$lv lv_size "48.00M"
test_expect_success \
'lvextend with partially allocated PVs and extents 100%PVS with PE ranges' \
'extend_pvs=`for i in $(seq 0 6 18); do echo -n "\$d1:$i-$(($i + 2)) "; done` &&
lvextend -l +100%PVS $vg/$lv $extend_pvs >out; test $? = 0 &&
grep "^ Logical volume $lv successfully resized\$" out &&
check_lv_field_ $vg/$lv lv_size "72.00M"'
# 'lvextend with partially allocated PVs and extents 100%PVS with PE ranges'
extend_pvs=`for i in $(seq 0 6 18); do echo -n "\$dev1:$i-$(($i + 2)) "; done`
lvextend -l +100%PVS $vg/$lv $extend_pvs >out
grep "^ Logical volume $lv successfully resized\$" out
check_lv_field_ $vg/$lv lv_size "72.00M"
test_done
# Local Variables:
# indent-tabs-mode: nil
# End:

View File

@@ -1,5 +1,4 @@
#!/bin/sh
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
# Copyright (C) 2008 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
@@ -9,53 +8,16 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
test_description='Test lvmcache operation'
privileges_required_=1
. ./test-utils.sh
. ./test-lib.sh
aux prepare_pvs 5
cleanup_()
{
test -n "$d1" && losetup -d "$d1"
test -n "$d2" && losetup -d "$d2"
test -n "$d3" && losetup -d "$d3"
test -n "$d4" && losetup -d "$d4"
test -n "$d5" && losetup -d "$d5"
rm -f "$f1" "$f2" "$f3" "$f4" "$f5"
}
vgcreate $vg1 $dev1
vgcreate $vg2 $dev3
# FIXME: paramaterize lvm1 vs lvm2 metadata; most of these tests should run
# fine with lvm1 metadata as well; for now, just add disks 5 and 6 as lvm1
# metadata
test_expect_success \
'set up temp files, loopback devices, PVs, vgnames' \
'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") &&
f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") &&
f3=$(pwd)/3 && d3=$(loop_setup_ "$f3") &&
f4=$(pwd)/4 && d4=$(loop_setup_ "$f4") &&
f5=$(pwd)/5 && d5=$(loop_setup_ "$f5") &&
vg1=$(this_test_)-test-vg1-$$ &&
vg2=$(this_test_)-test-vg2-$$ &&
lv1=$(this_test_)-test-lv1-$$ &&
lv2=$(this_test_)-test-lv2-$$ &&
lv3=$(this_test_)-test-lv3-$$ &&
pvcreate $d1 $d2 $d3 $d4 $d5'
#
# Duplicate vg name should cause warnings (but not segfault!)
#
test_expect_success \
"Duplicate vg name might cause warnings but should succeed" \
'vgcreate $vg1 $d1 &&
vgcreate $vg2 $d3 &&
losetup -d $d1 &&
vgcreate $vg1 $d2 &&
losetup $d1 $f1 &&
pvs &&
pvs'
test_done
# Local Variables:
# indent-tabs-mode: nil
# End:
disable_dev $dev1
pvscan
vgcreate $vg1 $dev2
enable_dev $dev1
pvs
pvs

View File

@@ -1,4 +1,3 @@
#!/bin/sh
# Copyright (C) 2007-2008 Red Hat, Inc. All rights reserved.
#
# This copyrighted material is made available to anyone wishing to use,
@@ -9,47 +8,13 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
test_description='Test lvresize command options for validity'
privileges_required_=1
. ./test-utils.sh
. ./test-lib.sh
aux prepare_vg 2
cleanup_()
{
test -n "$vg" && {
vgchange -an "$vg"
lvremove -ff "$vg"
vgremove "$vg"
} > "$test_dir_/cleanup.log"
test -n "$d1" && losetup -d "$d1"
test -n "$d2" && losetup -d "$d2"
rm -f "$f1" "$f2"
}
lvcreate -L 10M -n lv -i2 $vg
lvresize -l +4 $vg/lv
lvremove -ff $vg
test_expect_success \
'set up temp files, loopback devices, PVs, and a VG' \
'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") &&
f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") &&
pvcreate $d1 $d2 &&
vg=$(this_test_)-test-vg-$$ &&
vgcreate $vg $d1 $d2'
lv=lvresize-usage-$$
test_expect_success \
'lvresize normal operation succeeds' \
'lvcreate -L 64M -n $lv -i2 $vg &&
lvresize -l +4 $vg/$lv &&
lvremove -ff $vg'
test_expect_success \
'lvresize rejects an invalid vgname' \
'lvcreate -L 64M -n $lv -i2 $vg &&
lvresize -v -l +4 xxx/$lv &&
echo status=$?; test $? = 5 &&
lvremove -ff $vg'
test_done
# Local Variables:
# indent-tabs-mode: nil
# End:
lvcreate -L 64M -n $lv -i2 $vg
not lvresize -v -l +4 xxx/$lv

View File

@@ -9,43 +9,25 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
test_description='Test for proper escaping of strings in metadata (bz431474)'
privileges_required_=1
# 'Test for proper escaping of strings in metadata (bz431474)'
. ./test-lib.sh
. ./test-utils.sh
cleanup_()
{
test -n "$vg" && {
vgchange -an "$vg"
vgremove "$vg"
} > "$test_dir_/cleanup.log"
test -n "$d1" && losetup -d "$d1"
rm -f "$f1"
}
aux prepare_devs 1
pv_suffix="__\"!@#\$%^&*()'\\\"__"
test_expect_success \
'set up temp files, loopback devices' \
'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") &&
mv "$d1" "$d1$pv_suffix" &&
d1=$d1$pv_suffix'
# 'set up temp files, loopback devices'
name=$(basename "$dev1")
dmsetup rename "$name" "$name$pv_suffix"
dev1=$(dirname "$dev1")/$name$pv_suffix
test_expect_success \
'pvcreate, vgcreate on filename with backslashed chars' \
'pvcreate "$d1" &&
vg=$(this_test_)-test-vg-$$ &&
vgcreate $vg $d1'
test_expect_success \
'no parse errors and VG really exists' \
'vgs 2>err &&
grep "Parse error" err;
status=$?; echo status=$status; test $status -ne 0 &&
vgs $vg'
# 'pvcreate, vgcreate on filename with backslashed chars'
pvcreate "$dev1"
vgcreate $vg "$dev1"
# 'no parse errors and VG really exists'
vgs 2>err
not grep "Parse error" err;
vgs $vg
test_done
# Local Variables:
# indent-tabs-mode: nil
# End:

View File

@@ -1,5 +1,4 @@
#!/bin/sh
# Copyright (C) 2007 Red Hat, Inc. All rights reserved.
# Copyright (C) 2008 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
@@ -9,60 +8,28 @@
# along with this program; if not, write to the Free Software Foundation,
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# tests basic functionality of read-ahead and ra regressions
#
. ./test-utils.sh
test_description='Test --metadatatype 1'
privileges_required_=1
aux prepare_devs 5
. ./test-lib.sh
pvcreate $dev1
pvcreate --metadatacopies 0 $dev2
pvcreate --metadatacopies 0 $dev3
pvcreate $dev4
pvcreate --metadatacopies 0 $dev5
cleanup_()
{
vgremove -f "$vg"
test -n "$d1" && losetup -d "$d1"
test -n "$d2" && losetup -d "$d2"
test -n "$d3" && losetup -d "$d3"
test -n "$d4" && losetup -d "$d4"
test -n "$d5" && losetup -d "$d5"
rm -f "$f1" "$f2" "$f3" "$f4" "$f5"
}
vgcreate -c n "$vg" $devs
lvcreate -n $lv -l 1 -i5 -I256 $vg
test_expect_success "set up temp files, loopback devices" \
'f1=$(pwd)/1 && d1=$(loop_setup_ "$f1") &&
f2=$(pwd)/2 && d2=$(loop_setup_ "$f2") &&
f3=$(pwd)/3 && d3=$(loop_setup_ "$f3") &&
f4=$(pwd)/4 && d4=$(loop_setup_ "$f4") &&
f5=$(pwd)/5 && d5=$(loop_setup_ "$f5") &&
vg=$(this_test_)-test-vg-$$ &&
lv=$(this_test_)-test-lv-$$
pvcreate "$d1" &&
pvcreate --metadatacopies 0 "$d2" &&
pvcreate --metadatacopies 0 "$d3" &&
pvcreate "$d4" &&
pvcreate --metadatacopies 0 "$d5" &&
vgcreate -c n "$vg" "$d1" "$d2" "$d3" "$d4" "$d5" &&
lvcreate -n "$lv" -l 1%FREE -i5 -I256 "$vg"'
pvchange -x n $dev1
pvchange -x y $dev1
vgchange -a n $vg
pvchange --uuid $dev1
pvchange --uuid $dev2
vgremove -f $vg
test_expect_success "test medatasize 0" \
'pvchange -x n "$d1" &&
pvchange -x y "$d1" &&
vgchange -a n "$vg" &&
pvchange --uuid "$d1" &&
pvchange --uuid "$d2" &&
vgremove -f "$vg"'
test_expect_success "test metadatatype 1" \
'pvcreate -M1 "$d1" &&
pvcreate -M1 "$d2" &&
pvcreate -M1 "$d3" &&
vgcreate -M1 "$vg" "$d1" "$d2" "$d3" &&
pvchange --uuid "$d1"'
test_done
# Local Variables:
# indent-tabs-mode: nil
# End:
pvcreate -M1 $dev1
pvcreate -M1 $dev2
pvcreate -M1 $dev3
vgcreate -M1 $vg $dev1 $dev2 $dev3
pvchange --uuid $dev1

Some files were not shown because too many files have changed in this diff Show More