master - cleanup: use dm_list_iterate_items
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f39f5b86c3f94f...
Commit: f39f5b86c3f94fe83744054012d6d8b33bb7d7a0
Parent: c1eb17ab07f457d92bff58ea489c670be7bed9ed
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 25 11:46:17 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:24 2013 +0200
cleanup: use dm_list_iterate_items
---
lib/activate/activate.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index 670b85c..05cfb66 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -1410,7 +1410,7 @@ int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv,
#ifdef DMEVENTD
int i, pending = 0, monitored;
int r = 1;
- struct dm_list *tmp, *snh, *snht;
+ struct dm_list *snh, *snht;
struct lv_segment *seg;
struct lv_segment *log_seg;
int (*monitor_fn) (struct lv_segment *s, int e);
@@ -1473,9 +1473,7 @@ int monitor_dev_for_events(struct cmd_context *cmd, struct logical_volume *lv,
if (!monitor_dev_for_events(cmd, seg->log_lv, NULL, monitor))
r = 0;
- dm_list_iterate(tmp, &lv->segments) {
- seg = dm_list_item(tmp, struct lv_segment);
-
+ dm_list_iterate_items(seg, &lv->segments) {
/* Recurse for AREA_LV */
for (s = 0; s < seg->area_count; s++) {
if (seg_type(seg, s) != AREA_LV)
10 years, 7 months
master - lvchange: use vg mempool
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c1eb17ab07f457...
Commit: c1eb17ab07f457d92bff58ea489c670be7bed9ed
Parent: a5ad1ee8587daf1001e64775d3478f345e77e324
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 25 10:15:13 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:24 2013 +0200
lvchange: use vg mempool
Using vg mempool for vg related data. Since we have VG in write mode,
prefer to use this mempool instead of cmd mempool.
---
tools/lvchange.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 796e512..ed0a35a 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -233,7 +233,6 @@ static int detach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
{
uint32_t s;
uint32_t num_meta_lvs;
- struct cmd_context *cmd = seg->lv->vg->cmd;
struct lv_list *lvl;
num_meta_lvs = seg_is_raid(seg) ? seg->area_count : !!seg->log_lv;
@@ -241,7 +240,7 @@ static int detach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
if (!num_meta_lvs)
return_0;
- if (!(lvl = dm_pool_alloc(cmd->mem, sizeof(*lvl) * num_meta_lvs)))
+ if (!(lvl = dm_pool_alloc(seg->lv->vg->vgmem, sizeof(*lvl) * num_meta_lvs)))
return_0;
if (seg_is_raid(seg)) {
@@ -265,7 +264,6 @@ static int detach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
static int attach_metadata_devices(struct lv_segment *seg, struct dm_list *list)
{
- struct cmd_context *cmd = seg->lv->vg->cmd;
struct lv_list *lvl;
if (seg_is_raid(seg)) {
@@ -715,7 +713,7 @@ static int lvchange_writemostly(struct logical_volume *lv)
if (arg_count(cmd, writemostly_ARG)) {
/* writemostly can be specified more than once */
pv_count = arg_count(cmd, writemostly_ARG);
- pv_names = dm_pool_alloc(cmd->mem, sizeof(char *) * pv_count);
+ pv_names = dm_pool_alloc(lv->vg->vgmem, sizeof(char *) * pv_count);
if (!pv_names)
return_0;
@@ -739,7 +737,7 @@ static int lvchange_writemostly(struct logical_volume *lv)
* We allocate strlen + 3 to add our own ':{t|n|y}' if
* not present plus the trailing '\0'.
*/
- if (!(pv_names[i] = dm_pool_zalloc(cmd->mem,
+ if (!(pv_names[i] = dm_pool_zalloc(lv->vg->vgmem,
strlen(tmp_str) + 3)))
return_0;
10 years, 7 months
master - dmeventd: return error if device is not found
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a5ad1ee8587daf...
Commit: a5ad1ee8587daf1001e64775d3478f345e77e324
Parent: 8d004b51274b2d7638673c4985c0c298d253ef0d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 25 10:17:22 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:24 2013 +0200
dmeventd: return error if device is not found
Do not return 'ok' status if we have failed to found device.
(Since it looks like the device is monitored)
---
WHATS_NEW_DM | 1 +
daemons/dmeventd/libdevmapper-event.c | 9 ++++++---
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index afaf266..39ebcb2 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.78 -
===================================
+ Report error for nonexisting devices in dmeventd communication.
Prevent double free error after dmeventd call of _fill_device_data().
Update dmevent structure message_data to simplify/fix error path handling.
Validate passed params to dm_get_status_raid/thin/thin_pool().
diff --git a/daemons/dmeventd/libdevmapper-event.c b/daemons/dmeventd/libdevmapper-event.c
index f7b586e..c692a88 100644
--- a/daemons/dmeventd/libdevmapper-event.c
+++ b/daemons/dmeventd/libdevmapper-event.c
@@ -714,12 +714,15 @@ int dm_event_get_registered_device(struct dm_event_handler *dmevh, int next)
char *reply_dso = NULL, *reply_uuid = NULL;
enum dm_event_mask reply_mask = 0;
struct dm_task *dmt = NULL;
- struct dm_event_daemon_message msg = { 0, 0, NULL };
+ struct dm_event_daemon_message msg = { 0 };
struct dm_info info;
if (!(dmt = _get_device_info(dmevh))) {
- stack;
- return 0;
+ log_debug("Device does not exists (uuid=%s, name=%s, %d:%d).",
+ dmevh->uuid, dmevh->dev_name,
+ dmevh->major, dmevh->minor);
+ ret = -ENODEV;
+ goto fail;
}
uuid = dm_task_get_uuid(dmt);
10 years, 7 months
master - report: show active state of LV
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8d004b51274b2d...
Commit: 8d004b51274b2d7638673c4985c0c298d253ef0d
Parent: 8b18ab76d27f40094f281d5695a6bb82b65e1976
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 25 12:12:05 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:24 2013 +0200
report: show active state of LV
For non clustered VG - show "active"/""
For clustered VG its more complex:
"local exclusive"
"remote exclusive"
"locally"
"remotely"
---
WHATS_NEW | 1 +
lib/metadata/lv.c | 19 +++++++++++++++++++
lib/metadata/lv.h | 1 +
lib/report/columns.h | 1 +
lib/report/properties.c | 2 ++
lib/report/report.c | 14 ++++++++++++++
6 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index a625dba..bad183c 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Add "active" LV reporting field to show activation state.
Add "monitor" segment reporting field to show dmevent monitoring status.
Document lvextend --use-policies option in man.
Fix creation and removal of clustered snapshot.
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index e515e02..3dbdb38 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -703,3 +703,22 @@ char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv)
{
return dm_pool_strdup(mem, lv->hostname ? : "");
}
+
+char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv)
+{
+ const char *s;
+
+ if (!lv_is_active(lv))
+ s = ""; /* not active */
+ else if (!vg_is_clustered(lv->vg))
+ s = "active";
+ else if (lv_is_active_exclusive(lv))
+ /* exclusive cluster activation */
+ s = lv_is_active_exclusive_locally(lv) ?
+ "local exclusive" : "remote exclusive";
+ else /* locally active */
+ s = lv_is_active_but_not_locally(lv) ?
+ "remotely" : "locally";
+
+ return dm_pool_strdup(mem, s);
+}
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index 7652cd4..9450f8d 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -85,4 +85,5 @@ char *lv_host_dup(struct dm_pool *mem, const struct logical_volume *lv);
int lv_set_creation(struct logical_volume *lv,
const char *hostname, uint64_t timestamp);
const char *lv_layer(const struct logical_volume *lv);
+char *lv_active_dup(struct dm_pool *mem, const struct logical_volume *lv);
#endif /* _LVM_LV_H */
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 07c9b7b..e73d20d 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -82,6 +82,7 @@ FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, copy_percent, "For RAID, m
FIELD(LVS, lv, NUM, "Cpy%Sync", lvid, 8, copypercent, sync_percent, "For RAID, mirrors and pvmove, current percentage in-sync.", 0)
FIELD(LVS, lv, NUM, "Mismatches", lvid, 10, mismatch_count, mismatches, "For RAID, number of mismatches found or repaired.", 0)
FIELD(LVS, lv, STR, "SyncAction", lvid, 10, sync_action, syncaction, "For RAID, the current synchronization action being performed.", 0)
+FIELD(LVS, lv, STR, "Active", lvid, 6, lvactive, lv_active, "Active state of the LV.", 0)
FIELD(LVS, lv, NUM, "WBehind", lvid, 7, write_behind, writebehind, "For RAID1, the number of outstanding writes allowed to writemostly devices.", 0)
FIELD(LVS, lv, STR, "Move", lvid, 4, movepv, move_pv, "For pvmove, Source PV of temporary LV created by pvmove.", 0)
FIELD(LVS, lv, STR, "Convert", lvid, 7, convertlv, convert_lv, "For lvconvert, Name of temporary LV created by lvconvert.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 6f0d980..03ebc6f 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -247,6 +247,8 @@ GET_LV_STR_PROPERTY_FN(lv_time, lv_time_dup(lv->vg->vgmem, lv))
#define _lv_time_set _not_implemented_set
GET_LV_STR_PROPERTY_FN(lv_host, lv_host_dup(lv->vg->vgmem, lv))
#define _lv_host_set _not_implemented_set
+GET_LV_STR_PROPERTY_FN(lv_active, lv_active_dup(lv->vg->vgmem, lv))
+#define _lv_active_set _not_implemented_set
/* VG */
GET_VG_STR_PROPERTY_FN(vg_fmt, vg_fmt_dup(vg))
diff --git a/lib/report/report.c b/lib/report/report.c
index 9ef2687..27c9708 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -1151,6 +1151,20 @@ static int _lvhost_disp(struct dm_report *rh, struct dm_pool *mem,
return 1;
}
+static int _lvactive_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ char *repstr;
+
+ if (!(repstr = lv_active_dup(mem, (const struct logical_volume *) data)))
+ return_0;
+
+ dm_report_field_set_value(field, repstr, NULL);
+
+ return 1;
+}
+
/* Report object types */
/* necessary for displaying something for PVs not belonging to VG */
10 years, 7 months
master - report: show dmeventd monitoring status
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8b18ab76d27f40...
Commit: 8b18ab76d27f40094f281d5695a6bb82b65e1976
Parent: 3f7de58e96a2ba84bf2590465ee9f5f7929cb74d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Thu Apr 25 12:07:57 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:24 2013 +0200
report: show dmeventd monitoring status
Add new lvs segment field 'Monitor' showing 3 states:
"monitored" - LV is monitored by dmeventd.
"not monitored" - LV is currently not being monitored by dmeventd
"" (empty) - LV does not support monitoring, or dmeventd support
is not compiled in.
---
WHATS_NEW | 1 +
lib/metadata/lv.c | 34 ++++++++++++++++++++++++++++++++++
lib/metadata/lv.h | 1 +
lib/report/columns.h | 1 +
lib/report/properties.c | 2 ++
lib/report/report.c | 14 ++++++++++++++
6 files changed, 53 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 27ebcec..a625dba 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Add "monitor" segment reporting field to show dmevent monitoring status.
Document lvextend --use-policies option in man.
Fix creation and removal of clustered snapshot.
Fix clvmd caching of metadata when suspending inactive volumes.
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index 6afa468..e515e02 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -128,6 +128,40 @@ char *lvseg_discards_dup(struct dm_pool *mem, const struct lv_segment *seg)
return dm_pool_strdup(mem, get_pool_discards_name(seg->discards));
}
+#ifdef DMEVENTD
+# include "libdevmapper-event.h"
+#endif
+char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg)
+{
+ const char *s = "";
+
+#ifdef DMEVENTD
+ struct lvinfo info;
+ int pending = 0, monitored;
+ struct lv_segment *segm = (struct lv_segment *) seg;
+
+ if (lv_is_cow(seg->lv) && !lv_is_merging_cow(seg->lv))
+ segm = first_seg(seg->lv->snapshot->lv);
+ else if (seg->log_lv)
+ segm = first_seg(seg->log_lv);
+
+ // log_debug("Query LV:%s mon:%s segm:%s tgtm:%p segmon:%d statusm:%d", seg->lv->name, segm->lv->name, segm->segtype->name, segm->segtype->ops->target_monitored, seg_monitored(segm), (int)(segm->status & PVMOVE));
+ if (!segm->segtype->ops->target_monitored)
+ /* Nothing to do, monitoring not supported */;
+ else if (!seg_monitored(segm) || (segm->status & PVMOVE))
+ s = "not monitored";
+ else if (lv_info(seg->lv->vg->cmd, seg->lv, 1, &info, 0, 0) && info.exists) {
+ monitored = segm->segtype->ops->
+ target_monitored((struct lv_segment*)segm, &pending);
+ if (pending)
+ s = "pending";
+ else
+ s = (monitored) ? "monitored" : "not monitored";
+ } // else log_debug("Not active");
+#endif
+ return dm_pool_strdup(mem, s);
+}
+
uint64_t lvseg_chunksize(const struct lv_segment *seg)
{
uint64_t size;
diff --git a/lib/metadata/lv.h b/lib/metadata/lv.h
index 03255fb..7652cd4 100644
--- a/lib/metadata/lv.h
+++ b/lib/metadata/lv.h
@@ -76,6 +76,7 @@ uint64_t lvseg_size(const struct lv_segment *seg);
uint64_t lvseg_chunksize(const struct lv_segment *seg);
char *lvseg_segtype_dup(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_discards_dup(struct dm_pool *mem, const struct lv_segment *seg);
+char *lvseg_monitor_dup(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_tags_dup(const struct lv_segment *seg);
char *lvseg_devices(struct dm_pool *mem, const struct lv_segment *seg);
char *lvseg_seg_pe_ranges(struct dm_pool *mem, const struct lv_segment *seg);
diff --git a/lib/report/columns.h b/lib/report/columns.h
index 42858f1..07c9b7b 100644
--- a/lib/report/columns.h
+++ b/lib/report/columns.h
@@ -155,6 +155,7 @@ FIELD(SEGS, seg, NUM, "SSize", list, 5, segsize, seg_size, "Size of segment in c
FIELD(SEGS, seg, STR, "Seg Tags", tags, 8, tags, seg_tags, "Tags, if any.", 0)
FIELD(SEGS, seg, STR, "PE Ranges", list, 9, peranges, seg_pe_ranges, "Ranges of Physical Extents of underlying devices in command line format.", 0)
FIELD(SEGS, seg, STR, "Devices", list, 7, devices, devices, "Underlying devices used with starting extent numbers.", 0)
+FIELD(SEGS, seg, STR, "Monitor", list, 7, segmonitor, monitor, "Dmeventd monitoring status of the segment.", 0)
FIELD(PVSEGS, pvseg, NUM, "Start", pe, 5, uint32, pvseg_start, "Physical Extent number of start of segment.", 0)
FIELD(PVSEGS, pvseg, NUM, "SSize", len, 5, uint32, pvseg_size, "Number of extents in segment.", 0)
diff --git a/lib/report/properties.c b/lib/report/properties.c
index 71b3cb1..6f0d980 100644
--- a/lib/report/properties.c
+++ b/lib/report/properties.c
@@ -332,6 +332,8 @@ GET_LVSEG_STR_PROPERTY_FN(seg_pe_ranges,
#define _seg_pe_ranges_set _not_implemented_set
GET_LVSEG_STR_PROPERTY_FN(devices, lvseg_devices(lvseg->lv->vg->vgmem, lvseg))
#define _devices_set _not_implemented_set
+GET_LVSEG_STR_PROPERTY_FN(monitor, lvseg_monitor_dup(lvseg->lv->vg->vgmem, lvseg))
+#define _monitor_set _not_implemented_set
/* PVSEG */
diff --git a/lib/report/report.c b/lib/report/report.c
index 8578ff7..9ef2687 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -489,6 +489,20 @@ static int _vgsize_disp(struct dm_report *rh, struct dm_pool *mem,
return _size64_disp(rh, mem, field, &size, private);
}
+static int _segmonitor_disp(struct dm_report *rh, struct dm_pool *mem,
+ struct dm_report_field *field,
+ const void *data, void *private)
+{
+ char *str;
+
+ if (!(str = lvseg_monitor_dup(mem, (const struct lv_segment *)data)))
+ return_0;
+
+ dm_report_field_set_value(field, str, NULL);
+
+ return 1;
+}
+
static int _segstart_disp(struct dm_report *rh, struct dm_pool *mem,
struct dm_report_field *field,
const void *data, void *private)
10 years, 7 months
master - man: lvextend --use-policies
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3f7de58e96a2ba...
Commit: 3f7de58e96a2ba84bf2590465ee9f5f7929cb74d
Parent: f84f12a6a3edaac5220699dd9c6937139429d852
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Apr 24 23:41:05 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:24 2013 +0200
man: lvextend --use-policies
Add missing man info.
---
WHATS_NEW | 1 +
man/lvconvert.8.in | 2 +-
man/lvextend.8.in | 29 ++++++++++++++++++-----------
3 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 5c97eff..27ebcec 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Document lvextend --use-policies option in man.
Fix creation and removal of clustered snapshot.
Fix clvmd caching of metadata when suspending inactive volumes.
Find newest timestamp of merged config files.
diff --git a/man/lvconvert.8.in b/man/lvconvert.8.in
index d22994e..d7300d8 100644
--- a/man/lvconvert.8.in
+++ b/man/lvconvert.8.in
@@ -284,7 +284,7 @@ Repair a mirror after suffering a disk failure. The mirror will be brought back
into a consistent state. By default, the original number of mirrors will be
restored if possible. Specify \fB\-y\fP on the command line to skip
the prompts. Use \fB\-f\fP if you do not want any replacement.
-Additionally, you may use \fB\-\-use-policies\fP to use the device
+Additionally, you may use \fB\-\-use\-policies\fP to use the device
replacement policy specified in \fBlvm.conf\fP(5),
viz. activation/mirror_log_fault_policy or
activation/mirror_device_fault_policy.
diff --git a/man/lvextend.8.in b/man/lvextend.8.in
index ee62a2f..c51a9dc 100644
--- a/man/lvextend.8.in
+++ b/man/lvextend.8.in
@@ -9,7 +9,7 @@ lvextend \- extend the size of a logical volume
.RI { y | n }]
.RB [ \-d | \-\-debug ]
.RB [ \-h | \-? | \-\-help ]
-.RB [ \-\-noudevsync]
+.RB [ \-f | \-\-force ]
.RB [ \-i | \-\-stripes
.I Stripes
.RB [ \-I | \-\-stripesize
@@ -19,9 +19,10 @@ lvextend \- extend the size of a logical volume
|
.BR \-L | \-\-size
.RI [ + ] LogicalVolumeSize [ bBsSkKmMgGtTpPeE ]}
-.RB [ \-f | \-\-force ]
.RB [ \-n | \-\-nofsck ]
+.RB [ \-\-noudevsync]
.RB [ \-r | \-\-resizefs ]
+.RB [ \-\-use\-policies ]
.RB [ \-t | \-\-test ]
.RB [ \-v | \-\-verbose ]
.I LogicalVolumePath
@@ -37,12 +38,8 @@ volume use
.SH OPTIONS
See \fBlvm\fP(8) for common options.
.TP
-.B \-\-noudevsync
-Disable udev synchronisation. The
-process will not wait for notification from udev.
-It will continue irrespective of any possible udev processing
-in the background. You should only use this if udev is not running
-or has rules that ignore the devices LVM2 creates.
+.BR \-f ", " \-\-force
+Proceed with size extension without prompting.
.TP
.IR \fB\-l ", " \fB\-\-extents " [" + ] LogicalExtentsNumber [ % { VG | LV | PVS | FREE | ORIGIN }]
Extend or set the logical volume size in units of logical extents.
@@ -77,17 +74,26 @@ use a single value throughout.
.br
StripeSize must be 2^n (n = 2 to 9)
.TP
-.BR \-f ", " \-\-force
-Proceed with size extension without prompting.
-.TP
.BR \-n ", " \-\-nofsck
Do not perform fsck before extending filesystem when filesystem
requires it. You may need to use \fB\-\-force\fR to proceed with
this option.
.TP
+.B \-\-noudevsync
+Disable udev synchronisation. The
+process will not wait for notification from udev.
+It will continue irrespective of any possible udev processing
+in the background. You should only use this if udev is not running
+or has rules that ignore the devices LVM2 creates.
+.TP
.BR \-r ", " \-\-resizefs
Resize underlying filesystem together with the logical volume using
\fBfsadm\fR(8).
+.TP
+.B \-\-use\-policies
+Resizes the logical volume according to configured policy. See
+\fBlvm.conf\fR(5) for some details.
+
.SH Examples
Extends the size of the logical volume "vg01/lvol10" by 54MiB on physical
volume /dev/sdk3. This is only possible if /dev/sdk3 is a member of
@@ -109,6 +115,7 @@ Extends a logical volume "vg01/lvol01" by 16MiB using physical extents
.SH SEE ALSO
.BR fsadm (8),
.BR lvm (8),
+.BR lvm.conf (5),
.BR lvcreate (8),
.BR lvconvert (8),
.BR lvreduce (8),
10 years, 7 months
master - snapshot: rework cluster creation and removal
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f84f12a6a3edaa...
Commit: f84f12a6a3edaac5220699dd9c6937139429d852
Parent: d51b7e54044518ed8e20ce3ea617a28d2313730d
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 21 10:37:52 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:24 2013 +0200
snapshot: rework cluster creation and removal
Support for exclusive activation of snapshots revealed some problems.
When snapshot is created, COW LV is activated first (for clearing) and
then it's transformed into snapshot's COW LV, but it has left the lock
for such LV active in cluster and this lock could not have been removed
from dlm, unless snapshot has been removed within same dlm session.
If the user tried to remove snapshot after rebooting node, the lock was
missing, and COW LV could not have been detached.
Patch modifes the approach in this way:
Always deactivate COW LV for clustered vg after clearing (so it's
activated again via imlicit snapshot activation rule when snapshot is activated).
When snapshot is removed, activate COW LV as independend LV, so the lock
will exist for such LV, but only when the snapshot is active.
Also add test case for testing snapshot removal after cluster reboot.
---
WHATS_NEW | 1 +
lib/metadata/lv_manip.c | 24 ++++++++++++++----------
lib/metadata/snapshot_manip.c | 37 ++++++++++++++++++++++++++++---------
test/shell/clvmd-restart.sh | 12 +++++++++++-
4 files changed, 54 insertions(+), 20 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ceaed00..5c97eff 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix creation and removal of clustered snapshot.
Fix clvmd caching of metadata when suspending inactive volumes.
Find newest timestamp of merged config files.
Fix assignment order for vg fid for lvm1 and pool format.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 7580464..42e0fab 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -4393,7 +4393,6 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
struct logical_volume *lv, *org = NULL;
struct logical_volume *pool_lv;
struct lv_list *lvl;
- int origin_active = 0;
const char *thin_name = NULL;
if (new_lv_name && find_lv_in_vg(vg, new_lv_name)) {
@@ -4480,9 +4479,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
/* Must zero cow */
status |= LVM_WRITE;
- if (lp->voriginsize)
- origin_active = 1;
- else {
+ if (!lp->voriginsize) {
if (!(org = find_lv(vg, lp->origin))) {
log_error("Couldn't find origin volume '%s'.",
@@ -4526,8 +4523,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
log_warn("WARNING: See global/mirror_segtype_default in lvm.conf.");
}
- if ((origin_active = lv_is_active(org)) &&
- vg_is_clustered(vg) &&
+ if (vg_is_clustered(vg) && lv_is_active(org) &&
!lv_is_active_exclusive_locally(org)) {
log_error("%s must be active exclusively to"
" create snapshot", org->name);
@@ -4821,8 +4817,14 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
if (!(lp->permission & LVM_WRITE))
lv->status &= ~LVM_WRITE;
- /* COW area must be deactivated if origin is not active */
- if (!origin_active && !deactivate_lv(cmd, lv)) {
+ /*
+ * For clustered VG deactivate zeroed COW to not keep
+ * the LV lock. For non-clustered VG, deactivate
+ * if origin is real (not virtual) inactive device.
+ */
+ if ((vg_is_clustered(vg) ||
+ (!lp->voriginsize && !lv_is_active(org))) &&
+ !deactivate_lv(cmd, lv)) {
log_error("Aborting. Couldn't deactivate snapshot "
"COW area. Manual intervention required.");
return NULL;
@@ -4841,8 +4843,10 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
goto deactivate_and_revert_new_lv;
}
- /* cow LV remains active and becomes snapshot LV */
-
+ /*
+ * COW LV is activated via implicit activation of origin LV
+ * Only the snapshot origin holds the LV lock in cluster
+ */
if (!vg_add_snapshot(org, lv, NULL,
org->le_count, lp->chunk_size)) {
log_error("Couldn't create snapshot.");
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index 5766d0b..0c10104 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -176,6 +176,7 @@ int vg_remove_snapshot(struct logical_volume *cow)
{
int merging_snapshot = 0;
struct logical_volume *origin = origin_from_cow(cow);
+ int is_origin_active = lv_is_active(origin);
dm_list_del(&cow->snapshot->origin_list);
origin->origin_count--;
@@ -209,25 +210,43 @@ int vg_remove_snapshot(struct logical_volume *cow)
lv_set_visible(cow);
/* format1 must do the change in one step, with the commit last. */
- if (!(origin->vg->fid->fmt->features & FMT_MDAS))
+ if (!(origin->vg->fid->fmt->features & FMT_MDAS)) {
+ /* Get the lock for COW volume */
+ if (is_origin_active && !activate_lv(cow->vg->cmd, cow)) {
+ log_error("Unable to activate logical volume \"%s\"",
+ cow->name);
+ return 0;
+ }
return 1;
+ }
if (!vg_write(origin->vg))
return_0;
- if (!suspend_lv(origin->vg->cmd, origin)) {
+
+ /* Skip call suspend, if device is not active */
+ if (is_origin_active && !suspend_lv(origin->vg->cmd, origin)) {
log_error("Failed to refresh %s without snapshot.",
origin->name);
return 0;
}
if (!vg_commit(origin->vg))
return_0;
- if (!merging_snapshot && !resume_lv(origin->vg->cmd, cow)) {
- log_error("Failed to resume %s.", cow->name);
- return 0;
- }
- if (!resume_lv(origin->vg->cmd, origin)) {
- log_error("Failed to resume %s.", origin->name);
- return 0;
+
+ if (is_origin_active) {
+ /*
+ * If the snapshot was active and the COW LV is taken away
+ * the LV lock on cluster has to be grabbed, so use
+ * activate_lv() which resumes suspend cow device.
+ */
+ if (!merging_snapshot && !activate_lv(cow->vg->cmd, cow)) {
+ log_error("Failed to activate %s.", cow->name);
+ return 0;
+ }
+
+ if (!resume_lv(origin->vg->cmd, origin)) {
+ log_error("Failed to resume %s.", origin->name);
+ return 0;
+ }
}
return 1;
diff --git a/test/shell/clvmd-restart.sh b/test/shell/clvmd-restart.sh
index 2b341e5..e88e187 100644
--- a/test/shell/clvmd-restart.sh
+++ b/test/shell/clvmd-restart.sh
@@ -46,8 +46,18 @@ test "$LOCAL_CLVMD" -eq "$NEW_LOCAL_CLVMD"
# FIXME: Hmm - how could we test exclusivity is preserved in singlenode ?
lvchange -an $vg/$lv1
-lvchange -ay $vg/$lv1
+lvchange -aey $vg/$lv1
+lvcreate -s -l3 -n snap $vg/$lv1
"$LVM_CLVMD_BINARY" -R
+vgchange -an $vg
+
+# Test what happens after 'reboot'
+kill "$LOCAL_CLVMD"
+aux prepare_clvmd
+
+vgchange -ay $vg
+lvremove -f $vg/snap
+
vgremove -ff $vg
10 years, 7 months
master - clvmd: avoid pretesting of dev availability
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d51b7e54044518...
Commit: d51b7e54044518ed8e20ce3ea617a28d2313730d
Parent: 320d7f3596f78972d5fa843b9d56510ff299a958
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sun Apr 21 10:11:29 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Thu Apr 25 17:33:22 2013 +0200
clvmd: avoid pretesting of dev availability
Patch fixes hidden problem with lvm metadata caching.
When the pretest was made, only the commited data have been cached back
since the call lv_info_by_lvid() triggers mda read operation.
However call of lv_suspend_if_active() also reads precommited metadata.
The problem is visible in this sequence of calls:
vg_write(), suspend_lv(), vg_commit(), resume_lv()
which may end with leaving outdated mda in lvm cache, since vg_write()
drops cached metadata and vg_commit() only transforms precommited
to commited metadata, but in the case of pretesting we have
no precommited mda available so the cache will continue to use
old metadata. This happens, when suspend LV is inactive.
---
WHATS_NEW | 1 +
daemons/clvmd/lvm-functions.c | 9 ++-------
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 4139557..ceaed00 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
+ Fix clvmd caching of metadata when suspending inactive volumes.
Find newest timestamp of merged config files.
Fix assignment order for vg fid for lvm1 and pool format.
Fix memleak in dmeventd thin plugin in device list obtaining err path.
diff --git a/daemons/clvmd/lvm-functions.c b/daemons/clvmd/lvm-functions.c
index 6d78090..5e83454 100644
--- a/daemons/clvmd/lvm-functions.c
+++ b/daemons/clvmd/lvm-functions.c
@@ -437,7 +437,6 @@ static int do_resume_lv(char *resource, unsigned char command, unsigned char loc
static int do_suspend_lv(char *resource, unsigned char command, unsigned char lock_flags)
{
int oldmode;
- struct lvinfo lvi;
unsigned origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0;
unsigned exclusive;
@@ -450,12 +449,8 @@ static int do_suspend_lv(char *resource, unsigned char command, unsigned char lo
exclusive = (oldmode == LCK_EXCL) ? 1 : 0;
- /* Only suspend it if it exists */
- if (!lv_info_by_lvid(cmd, resource, origin_only, &lvi, 0, 0))
- return EIO;
-
- if (lvi.exists &&
- !lv_suspend_if_active(cmd, resource, origin_only, exclusive))
+ /* Always call lv_suspend to read commited and precommited data */
+ if (!lv_suspend_if_active(cmd, resource, origin_only, exclusive))
return EIO;
return 0;
10 years, 7 months
master - test: correct order
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=320d7f3596f789...
Commit: 320d7f3596f78972d5fa843b9d56510ff299a958
Parent: 23775c8fe8cdd82dee33cd397eeab5a84181380b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 23 17:05:19 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 23 17:05:19 2013 +0200
test: correct order
Call notify after resume (like in enable_dev()).
---
test/lib/aux.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index d500b37..4339ef4 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -413,8 +413,8 @@ error_dev() {
dmsetup create -u "TEST-$name" "$name" "$name.errtable"
fi
# using device name (since device path does not exists yet with udev)
- notify_lvmetad "$dev"
dmsetup resume "$name"
+ notify_lvmetad "$dev"
finish_udev_transaction
}
10 years, 7 months
master - test: do not break test if there is no .cache
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=23775c8fe8cdd8...
Commit: 23775c8fe8cdd82dee33cd397eeab5a84181380b
Parent: 67fc56f5ca1e05f78cedc5f729745e176447c6b2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Apr 23 14:36:27 2013 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Apr 23 14:36:27 2013 +0200
test: do not break test if there is no .cache
When running test on read /dev, we obtain devices from udev,
and there is no .cache file, so do not stop test if the file
is missing.
---
test/shell/vgimportclone.sh | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/test/shell/vgimportclone.sh b/test/shell/vgimportclone.sh
index 0a476ec..60c833a 100644
--- a/test/shell/vgimportclone.sh
+++ b/test/shell/vgimportclone.sh
@@ -31,7 +31,7 @@ vgimportclone --basevgname $vg2 "$dev2"
# concerned, can only live on a single device. With the last pvscan, we told it
# that PV from $dev1 now lives on $dev2, but in fact this is not true anymore,
# since we wrote a different PV over $dev2.
-rm $TESTDIR/etc/.cache
+rm -f $TESTDIR/etc/.cache
aux notify_lvmetad "$dev2"
aux notify_lvmetad "$dev1"
10 years, 7 months