master - thin: detect supported features from thinp target
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=260e8f24768d7a...
Commit: 260e8f24768d7a6e7c6a8018b5c2b08e7a35e35c
Parent: c4db22bd4f3d4a7328b2e03c27a5c1edb167d47f
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri May 25 13:38:03 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 18 14:35:17 2012 +0200
thin: detect supported features from thinp target
Add shell variable to override reported min version for testing:
LVM_THIN_VERSION_MIN
---
WHATS_NEW | 1 +
lib/activate/activate.h | 9 +++++++++
lib/thin/thin.c | 37 ++++++++++++++++++++++++++++++++++++-
3 files changed, 46 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f20f4fb..54ae73b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.97 -
===============================
+ Detect features for new 1.1 thin pool target.
Count percentage of completeness upwards when merging a snapshot volume.
Skip activation when using vg/lvchange --sysinit -a ay and lvmetad is active.
Fix extending RAID 4/5/6 logical volumes
diff --git a/lib/activate/activate.h b/lib/activate/activate.h
index f473a11..6497eea 100644
--- a/lib/activate/activate.h
+++ b/lib/activate/activate.h
@@ -44,6 +44,15 @@ struct lv_activate_opts {
/* target attribute flags */
#define MIRROR_LOG_CLUSTERED 0x00000001U
+/* thin target attribute flags */
+enum {
+ /* bitfields - new features from 1.1 version */
+ THIN_FEATURE_DISCARD = (1 << 0),
+ THIN_FEATURE_EXTERNAL_ORIGIN = (1 << 1),
+ THIN_FEATURE_HELD_ROOT = (1 << 2),
+ THIN_FEATURE_BLOCK_SIZE = (1 << 3),
+};
+
void set_activation(int activation);
int activation(void);
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index 47fb0ec..974293c 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -487,16 +487,51 @@ static int _thin_target_percent(void **target_state __attribute__((unused)),
static int _thin_target_present(struct cmd_context *cmd,
const struct lv_segment *seg,
- unsigned *attributes __attribute__((unused)))
+ unsigned *attributes)
{
static int _checked = 0;
static int _present = 0;
+ static int _attrs = 0;
+ uint32_t maj, min, patchlevel;
if (!_checked) {
_present = target_present(cmd, THIN_MODULE, 1);
+
+ if (!target_version(THIN_MODULE, &maj, &min, &patchlevel)) {
+ log_error("Cannot read " THIN_MODULE " target version.");
+ return 0;
+ }
+ log_debug("Target " THIN_MODULE " has version %d:%d:%d.",
+ maj, min, patchlevel);
+
+ /* For testing allow to override via shell variable */
+ if (getenv("LVM_THIN_VERSION_MIN"))
+ min = atoi(getenv("LVM_THIN_VERSION_MIN"));
+
+ if (maj >=1 && min >= 1)
+ _attrs |= THIN_FEATURE_DISCARD;
+ else
+ log_verbose("Target " THIN_MODULE
+ " without discard support.");
+
+ if (maj >=1 && min >= 1)
+ _attrs |= THIN_FEATURE_EXTERNAL_ORIGIN;
+ else
+ log_verbose("Target " THIN_MODULE
+ " without external origin support.");
+#if 0
+ if (maj >=1 && min >= 1)
+ _attrs |= THIN_FEATURE_BLOCK_SIZE;
+ else
+ log_verbose("Target " THIN_MODULE
+ " without non power of 2 block size.");
+#endif
_checked = 1;
}
+ if (attributes)
+ *attributes = _attrs;
+
return _present;
}
#endif
11 years, 9 months
master - libdm: support reserve and release metadata snap msg
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c4db22bd4f3d4a...
Commit: c4db22bd4f3d4a7328b2e03c27a5c1edb167d47f
Parent: dcd4afc7163fa08b8bd43aeb4cabe3d8a792e20b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jul 4 11:28:53 2012 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 18 14:34:19 2012 +0200
libdm: support reserve and release metadata snap msg
Add support for new message types for thinp target 1.1
---
WHATS_NEW_DM | 1 +
libdm/libdevmapper.h | 2 ++
libdm/libdm-deptree.c | 6 ++++++
3 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index e11ebcb..416beca 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.76 -
===============================
+ Add support for thin pool message release/reserve_metadata_snap.
Add support for thin pool discard and external origin.
Add configure --enable-udev-rule-exec-detection to detect exec path in rules.
Use sbindir in udev rules by default and remove executable path detection.
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 6eeaf87..549a635 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -650,6 +650,8 @@ typedef enum {
DM_THIN_MESSAGE_CREATE_THIN, /* device_id */
DM_THIN_MESSAGE_DELETE, /* device_id */
DM_THIN_MESSAGE_SET_TRANSACTION_ID, /* current_id, new_id */
+ DM_THIN_MESSAGE_RESERVE_METADATA_SNAP, /* 1.1 */
+ DM_THIN_MESSAGE_RELEASE_METADATA_SNAP, /* 1.1 */
} dm_thin_message_t;
int dm_tree_node_add_thin_pool_message(struct dm_tree_node *node,
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index a43b6a2..acd82ca 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -1411,6 +1411,12 @@ static int _thin_pool_node_message(struct dm_tree_node *dnode, struct thin_messa
m->u.m_set_transaction_id.current_id,
m->u.m_set_transaction_id.new_id);
break;
+ case DM_THIN_MESSAGE_RESERVE_METADATA_SNAP: /* 1.1 */
+ r = dm_snprintf(buf, sizeof(buf), "reserve_metadata_snap");
+ break;
+ case DM_THIN_MESSAGE_RELEASE_METADATA_SNAP: /* 1.1 */
+ r = dm_snprintf(buf, sizeof(buf), "release_metadata_snap");
+ break;
default:
r = -1;
}
11 years, 9 months
master - libdm: add support for external origin and discard
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=dcd4afc7163fa0...
Commit: dcd4afc7163fa08b8bd43aeb4cabe3d8a792e20b
Parent: 00d9bf8107b47e51fc966dd5bd78789190c6e846
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Feb 4 13:49:40 2012 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jul 18 14:33:37 2012 +0200
libdm: add support for external origin and discard
---
WHATS_NEW_DM | 1 +
libdm/libdevmapper.h | 14 +++++
libdm/libdm-deptree.c | 140 +++++++++++++++++++++++++++++++++++++++++-------
3 files changed, 134 insertions(+), 21 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 711104b..e11ebcb 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.76 -
===============================
+ Add support for thin pool discard and external origin.
Add configure --enable-udev-rule-exec-detection to detect exec path in rules.
Use sbindir in udev rules by default and remove executable path detection.
Remove hard-coded paths for dmeventd fifos and use default-dm-run-dir.
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index a8bf885..6eeaf87 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -657,6 +657,17 @@ int dm_tree_node_add_thin_pool_message(struct dm_tree_node *node,
uint64_t id1, uint64_t id2);
/*
+ * Set thin pool discard features
+ * ignore - Disable discard support
+ * no_passdown - Don't pass discard down to underlaying data device,
+ * just remove the mapping
+ * Feature is available for 1.1
+ */
+int dm_tree_node_set_thin_pool_discard(struct dm_tree_node *node,
+ unsigned ignore,
+ unsigned no_passdown);
+
+/*
* FIXME: Defines bellow are based on kernel's dm-thin.c defines
* MAX_DEV_ID ((1 << 24) - 1)
*/
@@ -666,6 +677,9 @@ int dm_tree_node_add_thin_target(struct dm_tree_node *node,
const char *pool_uuid,
uint32_t device_id);
+int dm_tree_node_set_thin_external_origin(struct dm_tree_node *node,
+ const char *external_uuid);
+
void dm_tree_node_set_udev_flags(struct dm_tree_node *node, uint16_t udev_flags);
void dm_tree_node_set_presuspend_node(struct dm_tree_node *node,
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 91bafe5..a43b6a2 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -186,11 +186,14 @@ struct load_segment {
struct dm_tree_node *metadata; /* Thin_pool */
struct dm_tree_node *pool; /* Thin_pool, Thin */
+ struct dm_tree_node *external; /* Thin */
struct dm_list thin_messages; /* Thin_pool */
uint64_t transaction_id; /* Thin_pool */
uint64_t low_water_mark; /* Thin_pool */
uint32_t data_block_size; /* Thin_pool */
unsigned skip_block_zeroing; /* Thin_pool */
+ unsigned ignore_discard; /* Thin_pool 1.1 */
+ unsigned no_discard_passdown; /* Thin_pool 1.1 */
uint32_t device_id; /* Thin */
};
@@ -2145,6 +2148,57 @@ static int _raid_emit_segment_line(struct dm_task *dmt, uint32_t major,
return 1;
}
+static int _thin_pool_emit_segment_line(struct dm_task *dmt,
+ struct load_segment *seg,
+ char *params, size_t paramsize)
+{
+ int pos = 0;
+ char pool[DM_FORMAT_DEV_BUFSIZE], metadata[DM_FORMAT_DEV_BUFSIZE];
+ int features = (seg->skip_block_zeroing ? 1 : 0) +
+ (seg->ignore_discard ? 1 : 0) +
+ (seg->no_discard_passdown ? 1 : 0);
+
+ if (!_build_dev_string(metadata, sizeof(metadata), seg->metadata))
+ return_0;
+
+ if (!_build_dev_string(pool, sizeof(pool), seg->pool))
+ return_0;
+
+ EMIT_PARAMS(pos, "%s %s %d %" PRIu64 " %d%s%s%s", metadata, pool,
+ seg->data_block_size, seg->low_water_mark, features,
+ seg->skip_block_zeroing ? " skip_block_zeroing" : "",
+ seg->ignore_discard ? " ignore_discard" : "",
+ seg->no_discard_passdown ? " no_discard_passdown" : ""
+ );
+
+ return 1;
+}
+
+static int _thin_emit_segment_line(struct dm_task *dmt,
+ struct load_segment *seg,
+ char *params, size_t paramsize)
+{
+ int pos = 0;
+ char pool[DM_FORMAT_DEV_BUFSIZE];
+ char external[DM_FORMAT_DEV_BUFSIZE + 1];
+
+ if (!_build_dev_string(pool, sizeof(pool), seg->pool))
+ return_0;
+
+ if (!seg->external)
+ *external = 0;
+ else {
+ *external = ' ';
+ if (!_build_dev_string(external + 1, sizeof(external) - 1,
+ seg->external))
+ return_0;
+ }
+
+ EMIT_PARAMS(pos, "%s %d%s", pool, seg->device_id, external);
+
+ return 1;
+}
+
static int _emit_segment_line(struct dm_task *dmt, uint32_t major,
uint32_t minor, struct load_segment *seg,
uint64_t *seg_start, char *params,
@@ -2154,7 +2208,6 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major,
int r;
int target_type_is_raid = 0;
char originbuf[DM_FORMAT_DEV_BUFSIZE], cowbuf[DM_FORMAT_DEV_BUFSIZE];
- char pool[DM_FORMAT_DEV_BUFSIZE], metadata[DM_FORMAT_DEV_BUFSIZE];
switch(seg->type) {
case SEG_ERROR:
@@ -2223,18 +2276,12 @@ static int _emit_segment_line(struct dm_task *dmt, uint32_t major,
break;
case SEG_THIN_POOL:
- if (!_build_dev_string(metadata, sizeof(metadata), seg->metadata))
- return_0;
- if (!_build_dev_string(pool, sizeof(pool), seg->pool))
+ if (!_thin_pool_emit_segment_line(dmt, seg, params, paramsize))
return_0;
- EMIT_PARAMS(pos, "%s %s %d %" PRIu64 " %s", metadata, pool,
- seg->data_block_size, seg->low_water_mark,
- seg->skip_block_zeroing ? "1 skip_block_zeroing" : "0");
break;
case SEG_THIN:
- if (!_build_dev_string(pool, sizeof(pool), seg->pool))
+ if (!_thin_emit_segment_line(dmt, seg, params, paramsize))
return_0;
- EMIT_PARAMS(pos, "%s %d", pool, seg->device_id);
break;
}
@@ -2956,6 +3003,28 @@ int dm_tree_node_add_replicator_dev_target(struct dm_tree_node *node,
return 1;
}
+static struct load_segment *_get_single_load_segment(struct dm_tree_node *node,
+ unsigned type)
+{
+ struct load_segment *seg;
+
+ if (node->props.segment_count != 1) {
+ log_error("Node %s must have only one segment.",
+ dm_segtypes[type].target);
+ return NULL;
+ }
+
+ seg = dm_list_item(dm_list_last(&node->props.segs), struct load_segment);
+ if (seg->type != type) {
+ log_error("Node %s has segment type %s.",
+ dm_segtypes[type].target,
+ dm_segtypes[seg->type].target);
+ return NULL;
+ }
+
+ return seg;
+}
+
static int _thin_validate_device_id(uint32_t device_id)
{
if (device_id > DM_THIN_MAX_DEVICE_ID) {
@@ -3043,20 +3112,11 @@ int dm_tree_node_add_thin_pool_message(struct dm_tree_node *node,
dm_thin_message_t type,
uint64_t id1, uint64_t id2)
{
- struct load_segment *seg;
struct thin_message *tm;
+ struct load_segment *seg;
- if (node->props.segment_count != 1) {
- log_error("Thin pool node must have only one segment.");
- return 0;
- }
-
- seg = dm_list_item(dm_list_last(&node->props.segs), struct load_segment);
- if (seg->type != SEG_THIN_POOL) {
- log_error("Thin pool node has segment type %s.",
- dm_segtypes[seg->type].target);
- return 0;
- }
+ if (!(seg = _get_single_load_segment(node, SEG_THIN_POOL)))
+ return_0;
if (!(tm = dm_pool_zalloc(node->dtree->mem, sizeof (*tm)))) {
log_error("Failed to allocate thin message.");
@@ -3111,6 +3171,21 @@ int dm_tree_node_add_thin_pool_message(struct dm_tree_node *node,
return 1;
}
+int dm_tree_node_set_thin_pool_discard(struct dm_tree_node *node,
+ unsigned ignore,
+ unsigned no_passdown)
+{
+ struct load_segment *seg;
+
+ if (!(seg = _get_single_load_segment(node, SEG_THIN_POOL)))
+ return_0;
+
+ seg->ignore_discard = ignore;
+ seg->no_discard_passdown = no_passdown;
+
+ return 1;
+}
+
int dm_tree_node_add_thin_target(struct dm_tree_node *node,
uint64_t size,
const char *pool_uuid,
@@ -3139,6 +3214,29 @@ int dm_tree_node_add_thin_target(struct dm_tree_node *node,
return 1;
}
+int dm_tree_node_set_thin_external_origin(struct dm_tree_node *node,
+ const char *external_uuid)
+{
+ struct dm_tree_node *external;
+ struct load_segment *seg;
+
+ if (!(seg = _get_single_load_segment(node, SEG_THIN)))
+ return_0;
+
+ if (!(external = dm_tree_find_node_by_uuid(node->dtree,
+ external_uuid))) {
+ log_error("Missing thin external origin uuid %s.",
+ external_uuid);
+ return 0;
+ }
+
+ if (!_link_tree_nodes(node, external))
+ return_0;
+
+ seg->external = external;
+
+ return 1;
+}
int dm_get_status_thin_pool(struct dm_pool *mem, const char *params,
struct dm_status_thin_pool **status)
11 years, 9 months
master - TEST (lvresize-raid): Don't run test when RAID module doesn't exist
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=00d9bf8107b47e...
Commit: 00d9bf8107b47e51fc966dd5bd78789190c6e846
Parent: 3f5cdf20cd65173cc36f765ebe68134299c9cbc8
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Jul 17 10:50:21 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Jul 17 10:50:21 2012 -0500
TEST (lvresize-raid): Don't run test when RAID module doesn't exist
Check for RAID module and skip test if not there.
---
test/shell/lvresize-raid.sh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/test/shell/lvresize-raid.sh b/test/shell/lvresize-raid.sh
index c6c5dd1..ea5cc80 100644
--- a/test/shell/lvresize-raid.sh
+++ b/test/shell/lvresize-raid.sh
@@ -11,6 +11,8 @@
. lib/test
+aux target_at_least dm-raid 1 1 0 || skip
+
aux prepare_vg 5 80
# Extend a 2-way RAID1
11 years, 9 months
master - configure: default tmpfile dir in PREFIX/lib/tmpfiles.d
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3f5cdf20cd6517...
Commit: 3f5cdf20cd65173cc36f765ebe68134299c9cbc8
Parent: 35ebc5d343e2e01b719ce15c801d522a36e54ac4
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Jul 16 11:13:32 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jul 16 11:17:02 2012 +0200
configure: default tmpfile dir in PREFIX/lib/tmpfiles.d
SYSCONFDIR (the /etc) contains overrides to system-wide settings.
System-wide settings are in PREFIX/lib/tmpfiles.d by default
---
configure | 4 ++--
configure.in | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index e54efd3..ca71fdb 100755
--- a/configure
+++ b/configure
@@ -1613,7 +1613,7 @@ Optional Packages:
systemd service files in DIR
--with-tmpfilesdir=DIR install configuration files for management of
volatile files and directories in DIR
- [[SYSCONFDIR/tmpfiles.d]]
+ [[PREFIX/lib/tmpfiles.d]]
--with-dmeventd-pidfile=PATH
dmeventd pidfile [[PID_DIR/dmeventd.pid]]
--with-dmeventd-path=PATH
@@ -9925,7 +9925,7 @@ fi
if test "${with_tmpfilesdir+set}" = set; then :
withval=$with_tmpfilesdir; tmpfilesdir=$withval
else
- tmpfilesdir='${sysconfdir}/tmpfiles.d'
+ tmpfilesdir='${prefix}/lib/tmpfiles.d'
fi
################################################################################
diff --git a/configure.in b/configure.in
index 6c27324..8bf0c4e 100644
--- a/configure.in
+++ b/configure.in
@@ -1280,8 +1280,8 @@ fi
################################################################################
AC_ARG_WITH(tmpfilesdir,
AC_HELP_STRING([--with-tmpfilesdir=DIR],
- [install configuration files for management of volatile files and directories in DIR [[SYSCONFDIR/tmpfiles.d]]]),
- tmpfilesdir=$withval, tmpfilesdir='${sysconfdir}/tmpfiles.d')
+ [install configuration files for management of volatile files and directories in DIR [[PREFIX/lib/tmpfiles.d]]]),
+ tmpfilesdir=$withval, tmpfilesdir='${prefix}/lib/tmpfiles.d')
################################################################################
dnl -- Ensure additional headers required
if test x$READLINE = xyes; then
11 years, 9 months
master - conf: add a comment about obsolete .cache file
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=35ebc5d343e2e0...
Commit: 35ebc5d343e2e01b719ce15c801d522a36e54ac4
Parent: 07e4ac7b00f680ad88aa0ff4c835ea2b27eab44b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Jul 16 10:43:04 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Jul 16 10:43:04 2012 +0200
conf: add a comment about obsolete .cache file
---
doc/example.conf.in | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/doc/example.conf.in b/doc/example.conf.in
index fbb9271..a085014 100644
--- a/doc/example.conf.in
+++ b/doc/example.conf.in
@@ -86,6 +86,9 @@ devices {
# It is safe to delete the contents: the tools regenerate it.
# (The old setting 'cache' is still respected if neither of
# these new ones is present.)
+ # N.B. This type of caching is obsolete and existing .cache
+ # file is removed if the list of devices is obtained from
+ # udev by setting the obtain_device_list_from_udev to 1.
cache_dir = "@DEFAULT_SYS_DIR@/@DEFAULT_CACHE_SUBDIR@"
cache_file_prefix = ""
11 years, 9 months
master - lvconvert: count % upwards when merging a snapshot
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=07e4ac7b00f680...
Commit: 07e4ac7b00f680ad88aa0ff4c835ea2b27eab44b
Parent: cd8ea8b437de53f0019bd69d542a7d01f3d5b7d3
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jul 10 15:30:18 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 10 15:30:18 2012 +0200
lvconvert: count % upwards when merging a snapshot
Before:
# lvconvert --merge -i 1 vg/lvol1
Merging of volume lvol1 started.
lvol0: Merged: 36.7%
lvol0: Merged: 21.3%
lvol0: Merged: 5.8%
lvol0: Merged: 0.0%
Merge of snapshot into logical volume lvol0 has finished.
Logical volume "lvol1" successfully removed
After:
# lvconvert --merge -i 1 vg/lvol1
Merging of volume lvol1 started.
lvol0: Merged: 61.4%
lvol0: Merged: 73.0%
lvol0: Merged: 88.4%
lvol0: Merged: 100.0%
Merge of snapshot into logical volume lvol0 has finished.
Logical volume "lvol1" successfully removed
---
WHATS_NEW | 1 +
tools/lvconvert.c | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9d6f091..f20f4fb 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.97 -
===============================
+ Count percentage of completeness upwards when merging a snapshot volume.
Skip activation when using vg/lvchange --sysinit -a ay and lvmetad is active.
Fix extending RAID 4/5/6 logical volumes
Fix test for PV with unknown VG in process_each_pv to ignore ignored mdas.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index 074821d..76cc9b3 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -580,10 +580,10 @@ static progress_t _poll_merge_progress(struct cmd_context *cmd,
if (parms->progress_display)
log_print("%s: %s: %.1f%%", lv->name, parms->progress_title,
- percent_to_float(percent));
+ 100.0 - percent_to_float(percent));
else
log_verbose("%s: %s: %.1f%%", lv->name, parms->progress_title,
- percent_to_float(percent));
+ 100.0 - percent_to_float(percent));
if (percent == PERCENT_0)
return PROGRESS_FINISHED_ALL;
11 years, 9 months
master - activate: skip manual activation for --sysinit -aay
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=cd8ea8b437de53...
Commit: cd8ea8b437de53f0019bd69d542a7d01f3d5b7d3
Parent: 8767435ef847831455fadc1f7e8f4d2d94aef0d5
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Jul 10 13:49:46 2012 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Jul 10 14:01:33 2012 +0200
activate: skip manual activation for --sysinit -aay
When --sysinit -a ay is used with vg/lvchange and lvmetad is up and running,
we should skip manual activation as that would be a useless step - all volumes
are autoactivated once all the PVs for a VG are present.
If lvmetad is not active at the time of the vgchange --sysinit -a ay
call, the activation proceeds in standard 'manual' way.
This way, we can still have vg/lvchange --sysinit -a ay called
unconditionally in system initialization scripts no matter if lvmetad
is used or not.
---
WHATS_NEW | 1 +
man/lvchange.8.in | 5 +++++
man/vgchange.8.in | 5 +++++
tools/lvchange.c | 7 +++++++
tools/vgchange.c | 7 +++++++
5 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 02ac14a..9d6f091 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.97 -
===============================
+ Skip activation when using vg/lvchange --sysinit -a ay and lvmetad is active.
Fix extending RAID 4/5/6 logical volumes
Fix test for PV with unknown VG in process_each_pv to ignore ignored mdas.
Update man pages with --activate ay option and auto_activation_volume_list.
diff --git a/man/lvchange.8.in b/man/lvchange.8.in
index c7507d4..bf9ef48 100644
--- a/man/lvchange.8.in
+++ b/man/lvchange.8.in
@@ -105,6 +105,11 @@ this is equivalent to using \fB\-\-ignorelockingfailure\fP,
\fB\-\-ignoremonitoring\fP, \fB\-\-poll n\fP and setting
\fBLVM_SUPPRESS_LOCKING_FAILURE_MESSAGES\fP
environment variable.
+
+If \fB\-\-sysinit\fP is used in conjunction with lvmetad(8) enabled and running,
+autoactivation is preferred over manual activation via direct lvchange call.
+Logical volumes are autoactivated according to auto_activation_volume_list
+set in lvm.conf(5).
.TP
.B \-\-noudevsync
Disable udev synchronisation. The
diff --git a/man/vgchange.8.in b/man/vgchange.8.in
index 28e2623..0f5fc58 100644
--- a/man/vgchange.8.in
+++ b/man/vgchange.8.in
@@ -121,6 +121,11 @@ this is equivalent to using
.B \-\-poll n
and setting \fBLVM_SUPPRESS_LOCKING_FAILURE_MESSAGES\fP
environment variable.
+
+If \fB\-\-sysinit\fP is used in conjunction with lvmetad(8) enabled and running,
+autoactivation is preferred over manual activation via direct vgchange call.
+Logical volumes are autoactivated according to auto_activation_volume_list
+set in lvm.conf(5).
.TP
.BR \-\-noudevsync
Disable udev synchronisation. The
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 9876847..9054ac7 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -798,6 +798,13 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
+ if (arg_count(cmd, sysinit_ARG) && lvmetad_active() &&
+ arg_uint_value(cmd, activate_ARG, 0) == CHANGE_AAY) {
+ log_warn("lvmetad is active while using --sysinit -a ay, "
+ "skipping manual activation");
+ return ECMD_PROCESSED;
+ }
+
return process_each_lv(cmd, argc, argv,
update ? READ_FOR_UPDATE : 0, NULL,
&lvchange_single);
diff --git a/tools/vgchange.c b/tools/vgchange.c
index ebabb08..2013447 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -608,6 +608,13 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv)
return EINVALID_CMD_LINE;
}
+ if (arg_count(cmd, sysinit_ARG) && lvmetad_active() &&
+ arg_uint_value(cmd, activate_ARG, 0) == CHANGE_AAY) {
+ log_warn("lvmetad is active while using --sysinit -a ay, "
+ "skipping manual activation");
+ return ECMD_PROCESSED;
+ }
+
return process_each_vg(cmd, argc, argv, update ? READ_FOR_UPDATE : 0,
NULL, &vgchange_single);
}
11 years, 9 months
master - RAID: Fix extending size of RAID 4/5/6 logical volumes.
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8767435ef84783...
Commit: 8767435ef847831455fadc1f7e8f4d2d94aef0d5
Parent: bf81d5607a47eb0bf3963be54f4b765b2d24b895
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Jun 26 09:44:54 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Jun 26 09:44:54 2012 -0500
RAID: Fix extending size of RAID 4/5/6 logical volumes.
Reducing a RAID 4/5/6 LV or extending it with a different number of
stripes is still not implemented. This patch covers the "simple" case
where the LV is extended with the same number of stripes as the orginal.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 14 +++++++-
test/shell/lvresize-raid.sh | 78 +++++++++++++++++++++++++++++++++++++++++++
tools/lvresize.c | 10 ++++-
4 files changed, 100 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2e649b1..02ac14a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.97 -
===============================
+ Fix extending RAID 4/5/6 logical volumes
Fix test for PV with unknown VG in process_each_pv to ignore ignored mdas.
Update man pages with --activate ay option and auto_activation_volume_list.
Fix _alloc_parallel_area to avoid picking already-full areas for raid devices.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 21508fd..0d89b4a 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -697,6 +697,10 @@ static uint32_t _calc_area_multiple(const struct segment_type *segtype,
if (segtype_is_striped(segtype))
return area_count;
+ /* Parity RAID (e.g. RAID 4/5/6) */
+ if (segtype_is_raid(segtype) && segtype->parity_devs)
+ return area_count - segtype->parity_devs;
+
/* Mirrored stripes */
if (stripes)
return stripes;
@@ -829,7 +833,15 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
ah->parity_count = parity_count;
ah->region_size = region_size;
ah->alloc = alloc;
- ah->area_multiple = _calc_area_multiple(segtype, area_count, stripes);
+
+ /*
+ * For the purposes of allocation, area_count and parity_count are
+ * kept separately. However, the 'area_count' field in an
+ * lv_segment includes both; and this is what '_calc_area_multiple'
+ * is calculated from. So, we must pass in the total count to get
+ * a correct area_multiple.
+ */
+ ah->area_multiple = _calc_area_multiple(segtype, area_count + parity_count, stripes);
ah->mirror_logs_separate = find_config_tree_bool(cmd, "allocation/mirror_logs_require_separate_pvs",
DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS);
diff --git a/test/shell/lvresize-raid.sh b/test/shell/lvresize-raid.sh
new file mode 100644
index 0000000..c6c5dd1
--- /dev/null
+++ b/test/shell/lvresize-raid.sh
@@ -0,0 +1,78 @@
+#!/bin/sh
+# Copyright (C) 2012 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
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/test
+
+aux prepare_vg 5 80
+
+# Extend a 2-way RAID1
+for deactivate in true false; do
+ lvcreate --type raid1 -m 1 -l 2 -n $lv1 $vg
+
+ if $deactivate; then
+ lvchange -an $vg/$lv1
+ fi
+
+ lvresize -l +2 $vg/$lv1
+
+ #check raid_images_contiguous $vg $lv1
+
+ lvremove -ff $vg
+done
+
+# Reduce 2-way RAID1
+for deactivate in true false; do
+ lvcreate --type raid1 -m 1 -l 4 -n $lv1 $vg
+
+ if $deactivate; then
+ lvchange -an $vg/$lv1
+ fi
+
+ should lvresize -l -2 $vg/$lv1
+
+ #check raid_images_contiguous $vg $lv1
+
+ lvremove -ff $vg
+done
+
+# Extend 3-striped RAID 4/5/6
+for i in 4 5 6 ; do
+ for deactivate in true false; do
+ lvcreate --type raid$i -i 3 -l 3 -n $lv1 $vg
+
+ if $deactivate; then
+ lvchange -an $vg/$lv1
+ fi
+
+ lvresize -l +3 $vg/$lv1
+
+ #check raid_images_contiguous $vg $lv1
+
+ lvremove -ff $vg
+ done
+done
+
+# Reduce 3-striped RAID 4/5/6
+for i in 4 5 6 ; do
+ for deactivate in true false; do
+ lvcreate --type raid$i -i 3 -l 6 -n $lv1 $vg
+
+ if $deactivate; then
+ lvchange -an $vg/$lv1
+ fi
+
+ should lvresize -l -3 $vg/$lv1
+
+ #check raid_images_contiguous $vg $lv1
+
+ lvremove -ff $vg
+ done
+done
diff --git a/tools/lvresize.c b/tools/lvresize.c
index 55d1334..64474e0 100644
--- a/tools/lvresize.c
+++ b/tools/lvresize.c
@@ -598,11 +598,12 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
* and data LV could be any type (i.e. mirror)) */
dm_list_iterate_items(seg, seg_mirrors ? &seg_lv(mirr_seg, 0)->segments :
lv_is_thin_pool(lv) ? &seg_lv(first_seg(lv), 0)->segments : &lv->segments) {
- if (!seg_is_striped(seg))
+ if (!seg_is_striped(seg) &&
+ (!seg_is_raid(seg) || seg_is_mirrored(seg)))
continue;
sz = seg->stripe_size;
- str = seg->area_count;
+ str = seg->area_count - lp->segtype->parity_devs;
if ((seg_stripesize && seg_stripesize != sz &&
sz && !lp->stripe_size) ||
@@ -618,6 +619,11 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg,
if (!lp->stripes)
lp->stripes = seg_stripes;
+ else if (seg_is_raid(first_seg(lv)) &&
+ (lp->stripes != seg_stripes)) {
+ log_error("Unable to extend \"%s\" segment type with different number of stripes.", first_seg(lv)->segtype->name);
+ return ECMD_FAILED;
+ }
if (!lp->stripe_size && lp->stripes > 1) {
if (seg_stripesize) {
11 years, 9 months
master - TEST (lvconvert-raid): Turn on RAID conversion testing under snapshots
by Jonathan Brassow
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bf81d5607a47eb...
Commit: bf81d5607a47eb0bf3963be54f4b765b2d24b895
Parent: 7168880caa5f09da254e930313c2d59547643bb2
Author: Jonathan Brassow <jbrassow(a)redhat.com>
AuthorDate: Tue Jun 26 06:45:45 2012 -0500
Committer: Jonathan Brassow <jbrassow(a)redhat.com>
CommitterDate: Tue Jun 26 06:45:45 2012 -0500
TEST (lvconvert-raid): Turn on RAID conversion testing under snapshots
---
test/shell/lvconvert-raid.sh | 6 +-----
1 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/test/shell/lvconvert-raid.sh b/test/shell/lvconvert-raid.sh
index 6c289a8..a4ebac9 100644
--- a/test/shell/lvconvert-raid.sh
+++ b/test/shell/lvconvert-raid.sh
@@ -81,11 +81,7 @@ vgcreate -c n -s 256k $vg $(cat DEVICES)
###########################################
# RAID1 convert tests
###########################################
-#
-# FIXME: Snapshots of RAID is available, but there are kernel bugs that
-# still prevent its use.
-#for under_snap in false true; do
-for under_snap in false; do
+for under_snap in false true; do
for i in 1 2 3 4; do
for j in 1 2 3 4; do
if [ $i -eq 1 ]; then
11 years, 9 months