master - snapshot: wrap min_chunk test into a lib function
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3a82490ee1cf7a...
Commit: 3a82490ee1cf7aec5b2d6648f9bc74d9791eca8e
Parent: f3b9ee37e9b9672929737dedcd52b46f57d93d23
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Mar 17 13:04:14 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:43 2014 +0100
snapshot: wrap min_chunk test into a lib function
Create a separate function to validation snapshot min chunk value
and relocate code into snapshot_manip file.
This function will be shared with lvconvert then.
---
lib/metadata/lv_manip.c | 13 ++-----------
lib/metadata/metadata-exported.h | 1 +
lib/metadata/snapshot_manip.c | 16 ++++++++++++++++
3 files changed, 19 insertions(+), 11 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 9246920..6e4ba71 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -49,8 +49,6 @@ typedef enum {
#define A_CAN_SPLIT 0x10
#define A_AREA_COUNT_MATCHES 0x20 /* Existing lvseg has same number of areas as new segment */
-#define SNAPSHOT_MIN_CHUNKS 3 /* Minimum number of chunks in snapshot */
-
/*
* Constant parameters during a single allocation attempt.
*/
@@ -6054,15 +6052,8 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
}
if (lp->snapshot && !seg_is_thin(lp) &&
- (((uint64_t)lp->extents * vg->extent_size) <
- (SNAPSHOT_MIN_CHUNKS * lp->chunk_size))) {
- log_error("Unable to create a snapshot smaller than "
- DM_TO_STRING(SNAPSHOT_MIN_CHUNKS) " chunks (%u extents, %s).",
- (unsigned) (((uint64_t) SNAPSHOT_MIN_CHUNKS * lp->chunk_size +
- vg->extent_size - 1) / vg->extent_size),
- display_size(cmd, (uint64_t) SNAPSHOT_MIN_CHUNKS * lp->chunk_size));
- return NULL;
- }
+ !cow_has_min_chunks(vg, lp->extents, lp->chunk_size))
+ return NULL;
if (!seg_is_virtual(lp) &&
vg->free_count < lp->extents && !lp->approx_alloc) {
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 87e6046..347e080 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -903,6 +903,7 @@ int lv_is_cow(const struct logical_volume *lv);
int lv_is_merging_origin(const struct logical_volume *origin);
int lv_is_merging_cow(const struct logical_volume *snapshot);
uint32_t cow_max_extents(const struct logical_volume *origin, uint32_t chunk_size);
+int cow_has_min_chunks(const struct volume_group *vg, uint32_t cow_extents, uint32_t chunk_size);
int lv_is_cow_covering_origin(const struct logical_volume *lv);
/* Test if given LV is visible from user's perspective */
diff --git a/lib/metadata/snapshot_manip.c b/lib/metadata/snapshot_manip.c
index 8fcab0c..a0a3e3c 100644
--- a/lib/metadata/snapshot_manip.c
+++ b/lib/metadata/snapshot_manip.c
@@ -21,6 +21,8 @@
#include "lv_alloc.h"
#include "activate.h"
+#define SNAPSHOT_MIN_CHUNKS 3 /* Minimum number of chunks in snapshot */
+
int lv_is_origin(const struct logical_volume *lv)
{
return lv->origin_count ? 1 : 0;
@@ -88,6 +90,20 @@ uint32_t cow_max_extents(const struct logical_volume *origin, uint32_t chunk_siz
return (uint32_t) (size / extent_size);
}
+int cow_has_min_chunks(const struct volume_group *vg, uint32_t cow_extents, uint32_t chunk_size)
+{
+ if (((uint64_t)vg->extent_size * cow_extents) >= (SNAPSHOT_MIN_CHUNKS * chunk_size))
+ return 1;
+
+ log_error("Snapshot volume cannot be smaller than " DM_TO_STRING(SNAPSHOT_MIN_CHUNKS)
+ " chunks (%u extents, %s).", (unsigned)
+ (((uint64_t) SNAPSHOT_MIN_CHUNKS * chunk_size +
+ vg->extent_size - 1) / vg->extent_size),
+ display_size(vg->cmd, (uint64_t) SNAPSHOT_MIN_CHUNKS * chunk_size));
+
+ return 0;
+}
+
int lv_is_cow_covering_origin(const struct logical_volume *lv)
{
return lv_is_cow(lv) &&
10 years, 2 months
master - lvconvert: disallow usage of origin for snapshot
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f3b9ee37e9b967...
Commit: f3b9ee37e9b9672929737dedcd52b46f57d93d23
Parent: 455f23586f0125fb2763c0f2f48e79bc08d9e2c0
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Mar 17 09:41:36 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Mar 17 14:31:42 2014 +0100
lvconvert: disallow usage of origin for snapshot
Usage of origin as a snapshot 'COW' volume is unsupported.
Without this test lvm2 is able to generate this ugly internal error message.
To test this:
lvcreate -L1 -n lv1 vg
lvcreate -L1 -n lv2 -s vg/lv1
lvcreate -L1 -n lv3 vg
lvconvert -s vg/lv3 vg/lv1
Internal error: LVs (5) != visible LVs (1) + snapshots (1) + internal LVs (0) in VG vg
---
WHATS_NEW | 1 +
tools/lvconvert.c | 6 ++++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2d91981..c3c8aff 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Disallow lvconvert of origin to snapshot COW volume.
Make report settings profilable.
Add existing report settings to lvm.conf.
Use VG read lock during 'pvscan --cache -aay' autoactivation.
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index c8cc506..1b9d9f7 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -2038,6 +2038,12 @@ static int _lvconvert_snapshot(struct cmd_context *cmd,
{
struct logical_volume *org;
+ if (lv_is_origin(lv)) {
+ /* Unsupported stack */
+ log_error("Unable to convert origin \"%s\" into a snapshot.", lv->name);
+ return 0;
+ }
+
if (!(org = find_lv(lv->vg, lp->origin))) {
log_error("Couldn't find origin volume '%s'.", lp->origin);
return 0;
10 years, 2 months
master - config: make report settings profilable
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=455f23586f0125...
Commit: 455f23586f0125fb2763c0f2f48e79bc08d9e2c0
Parent: f9070c196beb32560a4f966c607b08bb6020b1ab
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 17 14:27:49 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Mar 17 14:27:49 2014 +0100
config: make report settings profilable
Users can create several profiles for how the tools report
the output very easily and then just use
<lvm reporting command> --profile <report_profile_name>
---
WHATS_NEW | 1 +
conf/default.profile.in | 28 ++++++++++++++++++++++
lib/config/config_settings.h | 52 +++++++++++++++++++++---------------------
3 files changed, 55 insertions(+), 26 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8a072dc..2d91981 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Make report settings profilable.
Add existing report settings to lvm.conf.
Use VG read lock during 'pvscan --cache -aay' autoactivation.
Issue a VG refresh before autoactivation only if the PV has changed/is new.
diff --git a/conf/default.profile.in b/conf/default.profile.in
index 29049ef..0499aef 100644
--- a/conf/default.profile.in
+++ b/conf/default.profile.in
@@ -19,3 +19,31 @@ activation {
thin_pool_autoextend_threshold = 100
thin_pool_autoextend_percent = 20
}
+
+report {
+ aligned=1
+ buffered=1
+ headings=1
+ separator=" "
+ prefixes=0
+ quoted=1
+ colums_as_rows=0
+ devtypes_sort="devtype_name"
+ devtypes_cols="devtype_name,devtype_max_partitions,devtype_description"
+ devtypes_cols_verbose="devtype_name,devtype_max_partitions,devtype_description"
+ lvs_sort="vg_name,lv_name"
+ lvs_cols="lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,move_pv,mirror_log,copy_percent,convert_lv"
+ lvs_cols_verbose="lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,pool_lv,origin,data_percent,metadata_percent,move_pv,copy_percent,mirror_log,convert_lv,lv_uuid,lv_profile"
+ vgs_sort="vg_name"
+ vgs_cols="vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free"
+ vgs_cols_verbose="vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid,vg_profile"
+ pvs_sort="pv_name"
+ pvs_cols="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free"
+ pvs_cols_verbose="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,dev_size,pv_uuid"
+ segs_sort="vg_name,lv_name,seg_start"
+ segs_cols="lv_name,vg_name,lv_attr,stripes,segtype,seg_size"
+ segs_cols_verbose="lv_name,vg_name,lv_attr,seg_start,seg_size,stripes,segtype,stripesize,chunksize"
+ pvsegs_sort="pv_name,pvseg_start"
+ pvsegs_cols="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size"
+ pvsegs_cols_verbose="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"
+}
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index f033660..de6ca1b 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -77,7 +77,7 @@ cfg_section(shell_CFG_SECTION, "shell", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
cfg_section(global_CFG_SECTION, "global", root_CFG_SECTION, 0, vsn(1, 0, 0), NULL)
cfg_section(activation_CFG_SECTION, "activation", root_CFG_SECTION, CFG_PROFILABLE, vsn(1, 0, 0), NULL)
cfg_section(metadata_CFG_SECTION, "metadata", root_CFG_SECTION, CFG_ADVANCED, vsn(1, 0, 0), NULL)
-cfg_section(report_CFG_SECTION, "report", root_CFG_SECTION, CFG_ADVANCED, vsn(1, 0, 0), NULL)
+cfg_section(report_CFG_SECTION, "report", root_CFG_SECTION, CFG_ADVANCED | CFG_PROFILABLE, vsn(1, 0, 0), NULL)
cfg_section(dmeventd_CFG_SECTION, "dmeventd", root_CFG_SECTION, 0, vsn(1, 2, 3), NULL)
cfg_section(tags_CFG_SECTION, "tags", root_CFG_SECTION, 0, vsn(1, 0, 18), NULL)
@@ -224,31 +224,31 @@ cfg(disk_area_start_sector_CFG, "start_sector", disk_area_CFG_SUBSECTION, CFG_AD
cfg(disk_area_size_CFG, "size", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_INT, 0, vsn(1, 0, 0), NULL)
cfg(disk_area_id_CFG, "id", disk_area_CFG_SUBSECTION, CFG_ADVANCED | CFG_UNSUPPORTED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 0), NULL)
-cfg(report_aligned_CFG, "aligned", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_ALIGNED, vsn(1, 0, 0), NULL)
-cfg(report_buffered_CFG, "buffered", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_BUFFERED, vsn(1, 0, 0), NULL)
-cfg(report_headings_CFG, "headings", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_HEADINGS, vsn(1, 0, 0), NULL)
-cfg(report_separator_CFG, "separator", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_REP_SEPARATOR, vsn(1, 0, 0), NULL)
-cfg(report_prefixes_CFG, "prefixes", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_PREFIXES, vsn(2, 2, 36), NULL)
-cfg(report_quoted_CFG, "quoted", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_QUOTED, vsn(2, 2, 39), NULL)
-cfg(report_colums_as_rows_CFG, "colums_as_rows", report_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_REP_COLUMNS_AS_ROWS, vsn(1, 0, 0), NULL)
-cfg(report_devtypes_sort_CFG, "devtypes_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEVTYPES_SORT, vsn(2, 2, 101), NULL)
-cfg(report_devtypes_cols_CFG, "devtypes_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEVTYPES_COLS, vsn(2, 2, 101), NULL)
-cfg(report_devtypes_cols_verbose_CFG, "devtypes_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DEVTYPES_COLS_VERB, vsn(2, 2, 101), NULL)
-cfg(report_lvs_sort_CFG, "lvs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_SORT, vsn(1, 0, 0), NULL)
-cfg(report_lvs_cols_CFG, "lvs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_COLS, vsn(1, 0, 0), NULL)
-cfg(report_lvs_cols_verbose_CFG, "lvs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_LVS_COLS_VERB, vsn(1, 0, 0), NULL)
-cfg(report_vgs_sort_CFG, "vgs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_VGS_SORT, vsn(1, 0, 0), NULL)
-cfg(report_vgs_cols_CFG, "vgs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_VGS_COLS, vsn(1, 0, 0), NULL)
-cfg(report_vgs_cols_verbose_CFG, "vgs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_VGS_COLS_VERB, vsn(1, 0, 0), NULL)
-cfg(report_pvs_sort_CFG, "pvs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVS_SORT, vsn(1, 0, 0), NULL)
-cfg(report_pvs_cols_CFG, "pvs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVS_COLS, vsn(1, 0, 0), NULL)
-cfg(report_pvs_cols_verbose_CFG, "pvs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVS_COLS_VERB, vsn(1, 0, 0), NULL)
-cfg(report_segs_sort_CFG, "segs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_SEGS_SORT, vsn(1, 0, 0), NULL)
-cfg(report_segs_cols_CFG, "segs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_SEGS_COLS, vsn(1, 0, 0), NULL)
-cfg(report_segs_cols_verbose_CFG, "segs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_SEGS_COLS_VERB, vsn(1, 0, 0), NULL)
-cfg(report_pvsegs_sort_CFG, "pvsegs_sort", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVSEGS_SORT, vsn(1, 1, 3), NULL)
-cfg(report_pvsegs_cols_CFG, "pvsegs_cols", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVSEGS_COLS, vsn(1, 1, 3), NULL)
-cfg(report_pvsegs_cols_verbose_CFG, "pvsegs_cols_verbose", report_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_PVSEGS_COLS_VERB, vsn(1, 1, 3), NULL)
+cfg(report_aligned_CFG, "aligned", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_ALIGNED, vsn(1, 0, 0), NULL)
+cfg(report_buffered_CFG, "buffered", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_BUFFERED, vsn(1, 0, 0), NULL)
+cfg(report_headings_CFG, "headings", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_HEADINGS, vsn(1, 0, 0), NULL)
+cfg(report_separator_CFG, "separator", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_REP_SEPARATOR, vsn(1, 0, 0), NULL)
+cfg(report_prefixes_CFG, "prefixes", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_PREFIXES, vsn(2, 2, 36), NULL)
+cfg(report_quoted_CFG, "quoted", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_QUOTED, vsn(2, 2, 39), NULL)
+cfg(report_colums_as_rows_CFG, "colums_as_rows", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_BOOL, DEFAULT_REP_COLUMNS_AS_ROWS, vsn(1, 0, 0), NULL)
+cfg(report_devtypes_sort_CFG, "devtypes_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_DEVTYPES_SORT, vsn(2, 2, 101), NULL)
+cfg(report_devtypes_cols_CFG, "devtypes_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_DEVTYPES_COLS, vsn(2, 2, 101), NULL)
+cfg(report_devtypes_cols_verbose_CFG, "devtypes_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_DEVTYPES_COLS_VERB, vsn(2, 2, 101), NULL)
+cfg(report_lvs_sort_CFG, "lvs_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_LVS_SORT, vsn(1, 0, 0), NULL)
+cfg(report_lvs_cols_CFG, "lvs_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_LVS_COLS, vsn(1, 0, 0), NULL)
+cfg(report_lvs_cols_verbose_CFG, "lvs_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_LVS_COLS_VERB, vsn(1, 0, 0), NULL)
+cfg(report_vgs_sort_CFG, "vgs_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_VGS_SORT, vsn(1, 0, 0), NULL)
+cfg(report_vgs_cols_CFG, "vgs_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_VGS_COLS, vsn(1, 0, 0), NULL)
+cfg(report_vgs_cols_verbose_CFG, "vgs_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_VGS_COLS_VERB, vsn(1, 0, 0), NULL)
+cfg(report_pvs_sort_CFG, "pvs_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVS_SORT, vsn(1, 0, 0), NULL)
+cfg(report_pvs_cols_CFG, "pvs_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVS_COLS, vsn(1, 0, 0), NULL)
+cfg(report_pvs_cols_verbose_CFG, "pvs_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVS_COLS_VERB, vsn(1, 0, 0), NULL)
+cfg(report_segs_sort_CFG, "segs_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_SEGS_SORT, vsn(1, 0, 0), NULL)
+cfg(report_segs_cols_CFG, "segs_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_SEGS_COLS, vsn(1, 0, 0), NULL)
+cfg(report_segs_cols_verbose_CFG, "segs_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_SEGS_COLS_VERB, vsn(1, 0, 0), NULL)
+cfg(report_pvsegs_sort_CFG, "pvsegs_sort", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVSEGS_SORT, vsn(1, 1, 3), NULL)
+cfg(report_pvsegs_cols_CFG, "pvsegs_cols", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVSEGS_COLS, vsn(1, 1, 3), NULL)
+cfg(report_pvsegs_cols_verbose_CFG, "pvsegs_cols_verbose", report_CFG_SECTION, CFG_PROFILABLE, CFG_TYPE_STRING, DEFAULT_PVSEGS_COLS_VERB, vsn(1, 1, 3), NULL)
cfg(dmeventd_mirror_library_CFG, "mirror_library", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_MIRROR_LIB, vsn(1, 2, 3), NULL)
cfg(dmeventd_raid_library_CFG, "raid_library", dmeventd_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_DMEVENTD_RAID_LIB, vsn(2, 2, 87), NULL)
10 years, 2 months
master - conf: add existing report settings to lvm.conf
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=f9070c196beb32...
Commit: f9070c196beb32560a4f966c607b08bb6020b1ab
Parent: 12eb284eecc631096e31384537289a3376617580
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 17 14:24:21 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Mar 17 14:24:21 2014 +0100
conf: add existing report settings to lvm.conf
These settings exist for ages but they were not exposed in lvm.conf
and so majority of users didn't event know about them.
---
WHATS_NEW | 1 +
conf/example.conf.in | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 101 insertions(+), 0 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8571723..8a072dc 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Add existing report settings to lvm.conf.
Use VG read lock during 'pvscan --cache -aay' autoactivation.
Issue a VG refresh before autoactivation only if the PV has changed/is new.
Add flag to lvmetad protocol to indicate the PV scanned has changed/is new.
diff --git a/conf/example.conf.in b/conf/example.conf.in
index 1572750..46ae461 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -978,6 +978,106 @@ activation {
polling_interval = 15
}
+# Reporting settings.
+#
+# report {
+ # Align columns on report output.
+ # aligned=1
+
+ # When buffered reporting is used, the report's content is appended
+ # incrementally for each object being reported until the report is
+ # flushed to output which normally happens at the end of command
+ # execution. Otherwise, if buffering is not used, each object is
+ # reported as soon as its processing is finished.
+ # buffered=1
+
+ # Show headings for columns on report.
+ # headings=1
+
+ # A separator to use on report after each field.
+ # separator=" "
+
+ # Use a field name prefix for each field reported.
+ # prefixes=0
+
+ # Quote field values when using field name prefixes.
+ # quoted=1
+
+ # Output each column as a row. If set, this also implies report/prefixes=1.
+ # colums_as_rows=0
+
+ # Comma separated list of columns to sort by when reporting 'lvm devtypes' command.
+ # See 'lvm devtypes -o help' for the list of possible fields.
+ # devtypes_sort="devtype_name"
+
+ # Comma separated list of columns to report for 'lvm devtypes' command.
+ # See 'lvm devtypes -o help' for the list of possible fields.
+ # devtypes_cols="devtype_name,devtype_max_partitions,devtype_description"
+
+ # Comma separated list of columns to report for 'lvm devtypes' command in verbose mode.
+ # See 'lvm devtypes -o help' for the list of possible fields.
+ # devtypes_cols_verbose="devtype_name,devtype_max_partitions,devtype_description"
+
+ # Comma separated list of columns to sort by when reporting 'lvs' command.
+ # See 'lvs -o help' for the list of possible fields.
+ # lvs_sort="vg_name,lv_name"
+
+ # Comma separated list of columns to report for 'lvs' command.
+ # See 'lvs -o help' for the list of possible fields.
+ # lvs_cols="lv_name,vg_name,lv_attr,lv_size,pool_lv,origin,data_percent,move_pv,mirror_log,copy_percent,convert_lv"
+
+ # Comma separated list of columns to report for 'lvs' command in verbose mode.
+ # See 'lvs -o help' for the list of possible fields.
+ # lvs_cols_verbose="lv_name,vg_name,seg_count,lv_attr,lv_size,lv_major,lv_minor,lv_kernel_major,lv_kernel_minor,pool_lv,origin,data_percent,metadata_percent,move_pv,copy_percent,mirror_log,convert
+
+ # Comma separated list of columns to sort by when reporting 'vgs' command.
+ # See 'vgs -o help' for the list of possible fields.
+ # vgs_sort="vg_name"
+
+ # Comma separated list of columns to report for 'vgs' command.
+ # See 'vgs -o help' for the list of possible fields.
+ # vgs_cols="vg_name,pv_count,lv_count,snap_count,vg_attr,vg_size,vg_free"
+
+ # Comma separated list of columns to report for 'vgs' command in verbose mode.
+ # See 'vgs -o help' for the list of possible fields.
+ # vgs_cols_verbose="vg_name,vg_attr,vg_extent_size,pv_count,lv_count,snap_count,vg_size,vg_free,vg_uuid,vg_profile"
+
+ # Comma separated list of columns to sort by when reporting 'pvs' command.
+ # See 'pvs -o help' for the list of possible fields.
+ # pvs_sort="pv_name"
+
+ # Comma separated list of columns to report for 'pvs' command.
+ # See 'pvs -o help' for the list of possible fields.
+ # pvs_cols="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free"
+
+ # Comma separated list of columns to report for 'pvs' command in verbose mode.
+ # See 'pvs -o help' for the list of possible fields.
+ # pvs_cols_verbose="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,dev_size,pv_uuid"
+
+ # Comma separated list of columns to sort by when reporting 'lvs --segments' command.
+ # See 'lvs --segments -o help' for the list of possible fields.
+ # segs_sort="vg_name,lv_name,seg_start"
+
+ # Comma separated list of columns to report for 'lvs --segments' command.
+ # See 'lvs --segments -o help' for the list of possible fields.
+ # segs_cols="lv_name,vg_name,lv_attr,stripes,segtype,seg_size"
+
+ # Comma separated list of columns to report for 'lvs --segments' command in verbose mode.
+ # See 'lvs --segments -o help' for the list of possible fields.
+ # segs_cols_verbose="lv_name,vg_name,lv_attr,seg_start,seg_size,stripes,segtype,stripesize,chunksize"
+
+ # Comma separated list of columns to sort by when reporting 'pvs --segments' command.
+ # See 'pvs --segments -o help' for the list of possible fields.
+ # pvsegs_sort="pv_name,pvseg_start"
+
+ # Comma separated list of columns to sort by when reporting 'pvs --segments' command.
+ # See 'pvs --segments -o help' for the list of possible fields.
+ # pvsegs_cols="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size"
+
+ # Comma separated list of columns to sort by when reporting 'pvs --segments' command in verbose mode.
+ # See 'pvs --segments -o help' for the list of possible fields.
+ # pvsegs_cols_verbose="pv_name,vg_name,pv_fmt,pv_attr,pv_size,pv_free,pvseg_start,pvseg_size,lv_name,seg_start_pe,segtype,seg_pe_ranges"
+#}
####################
# Advanced section #
10 years, 2 months
master - tests: fix name-mangling test
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=12eb284eecc631...
Commit: 12eb284eecc631096e31384537289a3376617580
Parent: b16235de96a18c9e9e619bebe506d41f80fff834
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Mon Mar 17 11:51:30 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Mon Mar 17 11:51:30 2014 +0100
tests: fix name-mangling test
We need to use "--verifyudev" for dmsetup mangle command used in
the name-mangling test since without the --verifyudev, we'd end up
with the failed rename.
Also, add direct check for the dev nodes - node with old name must
be gone and node with new name must be present. Before, we checked
just the output of the command.
One bug popped up here when renaming with udev and libdevmapper
fallback checking the udev when target mangle mode is "none"
(fixme added in the libdevmapper's node rename code).
---
libdm/libdm-common.c | 18 ++++++++++++++++++
test/shell/name-mangling.sh | 29 ++++++++++++++++++++++++++---
2 files changed, 44 insertions(+), 3 deletions(-)
diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c
index 2ec66e7..72fa508 100644
--- a/libdm/libdm-common.c
+++ b/libdm/libdm-common.c
@@ -1073,6 +1073,24 @@ static int _rename_dev_node(const char *old_name, const char *new_name,
oldpath, newpath);
/* udev may already have renamed the node. Ignore ENOENT. */
+ /* FIXME: when renaming to target mangling mode "none" with udev
+ * while there are some blacklisted characters in the node name,
+ * udev will remove the old_node, but fails to properly rename
+ * to new_node. The libdevmapper code tries to call
+ * rename(old_node,new_node), but that won't do anything
+ * since the old node is already removed by udev.
+ * For example renaming 'a\x20b' to 'a b':
+ * - udev removes 'a\x20b'
+ * - udev creates 'a' and 'b' (since it considers the ' ' as a delimiter
+ * - libdevmapper checks udev has done the rename properly
+ * - libdevmapper calls stat(new_node) and it does not see it
+ * - libdevmapper calls rename(old_node,new_node)
+ * - the rename is a NOP since the old_node does not exist anymore
+ *
+ * However, this situation is very rare - why would anyone need
+ * to rename to an unsupported mode??? So a fix for this would be
+ * just for completeness.
+ */
if (rename(oldpath, newpath) < 0 && errno != ENOENT) {
log_error("Unable to rename device node from '%s' to '%s'",
old_name, new_name);
diff --git a/test/shell/name-mangling.sh b/test/shell/name-mangling.sh
index 2f07523..cf218fe 100644
--- a/test/shell/name-mangling.sh
+++ b/test/shell/name-mangling.sh
@@ -129,7 +129,7 @@ function check_mangle_cmd()
create_dm_dev none "$dm_name"
- dmsetup mangle --manglename $mode "${PREFIX}$dm_name" 1>out 2>err || true;
+ dmsetup mangle --manglename $mode --verifyudev "${PREFIX}$dm_name" 1>out 2>err || true;
if [ "$expected" = "OK" ]; then
grep "$CORRECT_FORM_STR" out || r=1
@@ -139,7 +139,30 @@ function check_mangle_cmd()
grep "$FAIL_MULTI_STR" err || r=1
else
rename_expected=1
- grep -F "$RENAMING_STR ${PREFIX}$expected" out || r=1
+ if grep -F "$RENAMING_STR ${PREFIX}$expected" out; then
+ # Check the old node is really renamed.
+ test -b "$DM_DEV_DIR/mapper/${PREFIX}$dm_name" && r=1
+ # FIXME: when renaming to mode=none with udev, udev will
+ # remove the old_node, but fails to properly rename
+ # to new_node. The libdevmapper code tries to call
+ # rename(old_node,new_node), but that won't do anything
+ # since the old node is already removed by udev.
+ # For example renaming 'a\x20b' to 'a b':
+ # - udev removes 'a\x20b'
+ # - udev creates 'a' and 'b' (since it considers the ' ' as a delimiter)
+ # - libdevmapper checks udev has done the rename properly
+ # - libdevmapper calls stat(new_node) and it does not see it
+ # - libdevmapper calls rename(old_node,new_node)
+ # - the rename is a NOP since the old_node does not exist anymore
+ #
+ # Remove this condition once the problem is fixed in libdevmapper.
+ #
+ if [ "$mode" != "none" ]; then
+ test -b "$DM_DEV_DIR/mapper/${PREFIX}$expected" || r=1
+ fi
+ else
+ r=1
+ fi
fi
if [ $r = 0 -a $rename_expected = 1 ]; then
@@ -149,7 +172,7 @@ function check_mangle_cmd()
# failed to rename to expected or renamed when it should not - find the new name
new_name=$(sed -e "s/.*: $RENAMING_STR //g" out)
# try to remove any of the form - falling back to less probable error scenario
- aux dmsetup remove --verifyudev --manglename none "$new_name" || \
+ remove_dm_dev none "$new_name" || \
remove_dm_dev none "$dm_name" || remove_dm_dev none "$expected"
else
# successfuly done nothing
10 years, 2 months
master - cleanup: use 'define' for systemd runtime unit file directory
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b16235de96a18c...
Commit: b16235de96a18c9e9e619bebe506d41f80fff834
Parent: ada47c164ae56b586fae7500be2d6aa66f5323b1
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 14 15:57:28 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 14 15:57:44 2014 +0100
cleanup: use 'define' for systemd runtime unit file directory
---
daemons/dmeventd/dmeventd.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
index 6206058..f4f09b8 100644
--- a/daemons/dmeventd/dmeventd.c
+++ b/daemons/dmeventd/dmeventd.c
@@ -55,6 +55,7 @@
# define OOM_SCORE_ADJ_MIN (-1000)
/* Systemd on-demand activation support */
+# define SD_RUNTIME_UNIT_FILE_DIR DEFAULT_DM_RUN_DIR "/systemd/system/"
# define SD_ACTIVATION_ENV_VAR_NAME "SD_ACTIVATION"
# define SD_LISTEN_PID_ENV_VAR_NAME "LISTEN_PID"
# define SD_LISTEN_FDS_ENV_VAR_NAME "LISTEN_FDS"
@@ -1997,7 +1998,7 @@ static void restart(void)
if (version < 2) {
/* This check is copied from sd-daemon.c. */
struct stat st;
- if (!lstat("/run/systemd/system/", &st) && !!S_ISDIR(st.st_mode))
+ if (!lstat(SD_RUNTIME_UNIT_FILE_DIR, &st) && !!S_ISDIR(st.st_mode))
_systemd_activation = 1;
}
#endif
10 years, 2 months
master - autoactivation: use VG read lock
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ada47c164ae56b...
Commit: ada47c164ae56b586fae7500be2d6aa66f5323b1
Parent: 58e812a13ff725d9ca8958fe04b92fef320bce31
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 14 12:07:41 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 14 12:10:52 2014 +0100
autoactivation: use VG read lock
The activation (including the refresh) should take the VG read lock
like the usual activation/refresh.
---
WHATS_NEW | 1 +
lib/cache/lvmetad.c | 7 ++++---
lib/cache/lvmetad.h | 2 +-
tools/pvscan.c | 13 ++++++++-----
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6d70a0b..8571723 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.106 -
====================================
+ Use VG read lock during 'pvscan --cache -aay' autoactivation.
Issue a VG refresh before autoactivation only if the PV has changed/is new.
Add flag to lvmetad protocol to indicate the PV scanned has changed/is new.
Add man page for lvm2-activation-generator.
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index a9c3100..cc51258 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -749,7 +749,7 @@ int lvmetad_pv_found(const struct id *pvid, struct device *dev, const struct for
daemon_reply reply;
struct lvmcache_info *info;
struct dm_config_tree *pvmeta, *vgmeta;
- const char *status, *vgid;
+ const char *status, *vgname, *vgid;
int64_t changed;
int result;
@@ -819,12 +819,13 @@ int lvmetad_pv_found(const struct id *pvid, struct device *dev, const struct for
if (result && handler) {
status = daemon_reply_str(reply, "status", "<missing>");
+ vgname = daemon_reply_str(reply, "vgname", "<missing>");
vgid = daemon_reply_str(reply, "vgid", "<missing>");
changed = daemon_reply_int(reply, "changed", 0);
if (!strcmp(status, "partial"))
- handler(_lvmetad_cmd, vgid, 1, changed, CHANGE_AAY);
+ handler(_lvmetad_cmd, vgname, vgid, 1, changed, CHANGE_AAY);
else if (!strcmp(status, "complete"))
- handler(_lvmetad_cmd, vgid, 0, changed, CHANGE_AAY);
+ handler(_lvmetad_cmd, vgname, vgid, 0, changed, CHANGE_AAY);
else if (!strcmp(status, "orphan"))
;
else
diff --git a/lib/cache/lvmetad.h b/lib/cache/lvmetad.h
index fcc4b7d..d9aa77f 100644
--- a/lib/cache/lvmetad.h
+++ b/lib/cache/lvmetad.h
@@ -23,7 +23,7 @@ struct dm_config_tree;
enum activation_change;
typedef int (*activation_handler) (struct cmd_context *cmd,
- const char *vgid,
+ const char *vgname, const char *vgid,
int partial, int changed,
enum activation_change activate);
diff --git a/tools/pvscan.c b/tools/pvscan.c
index b6b3067..5db627a 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -95,14 +95,13 @@ static void _pvscan_display_single(struct cmd_context *cmd,
#define REFRESH_BEFORE_AUTOACTIVATION_RETRY_USLEEP_DELAY 100000
static int _auto_activation_handler(struct cmd_context *cmd,
- const char *vgid,
+ const char *vgname, const char *vgid,
int partial, int changed,
activation_change_t activate)
{
unsigned int refresh_retries = REFRESH_BEFORE_AUTOACTIVATION_RETRIES;
int refresh_done = 0;
struct volume_group *vg;
- int consistent = 0;
struct id vgid_raw;
int r = 0;
@@ -114,8 +113,12 @@ static int _auto_activation_handler(struct cmd_context *cmd,
return_0;
/* NB. This is safe because we know lvmetad is running and we won't hit disk. */
- if (!(vg = vg_read_internal(cmd, NULL, (const char *) &vgid_raw, 0, &consistent)))
- return 1;
+ vg = vg_read(cmd, vgname, (const char *)&vgid_raw, 0);
+ if (vg_read_error(vg)) {
+ log_error("Failed to read Volume Group \"%s\" (%s) during autoactivation.", vgname, vgid);
+ release_vg(vg);
+ return 0;
+ }
if (vg_is_clustered(vg)) {
r = 1; goto out;
@@ -161,7 +164,7 @@ static int _auto_activation_handler(struct cmd_context *cmd,
r = 1;
out:
- release_vg(vg);
+ unlock_and_release_vg(cmd, vg, vgname);
return r;
}
10 years, 2 months
master - tests: use DMEVENTD_PIDFILE
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=58e812a13ff725...
Commit: 58e812a13ff725d9ca8958fe04b92fef320bce31
Parent: ca880a4f130a0d6111613e23f926c344217581a2
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 14 11:12:46 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 14 11:16:24 2014 +0100
tests: use DMEVENTD_PIDFILE
Test for compiled-in pidfile location
(so we are not based on assumption /var/run or /run link exists)
---
test/Makefile.in | 1 +
test/lib/aux.sh | 6 +++++-
2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index bf1913a..9335abd 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -136,6 +136,7 @@ lib/paths: $(srcdir)/Makefile.in .lib-dir-stamp
echo 'export DM_UDEV_SYNCHRONISATION=$(dm_udev_synchronisation)' >> $@-t
echo 'export THIN=@THIN@' >> $@-t
echo 'export LVMETAD_PIDFILE=@LVMETAD_PIDFILE@' >> $@-t
+ echo 'export DMEVENTD_PIDFILE=@DMEVENTD_PIDFILE@' >> $@-t
mv $@-t $@
LIB = lib/not lib/should lib/harness \
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index 7d13e8d..bd292bb 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -68,7 +68,11 @@ prepare_dmeventd() {
echo $! > LOCAL_DMEVENTD
# FIXME wait for pipe in /var/run instead
- while ! test -e "/run/dmeventd.pid"; do echo -n .; sleep .2; done # wait for the socket
+ for i in $(seq 1 100) ; do
+ test $i -eq 100 && die "Startup of dmeventd is too slow."
+ test -e "${DMEVENTD_PIDFILE}" && break
+ sleep .2
+ done
echo ok
}
10 years, 2 months
master - autoactivation: issue a VG refresh before autoactivation only if 'change' lvmetad flag is set
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ca880a4f130a0d...
Commit: ca880a4f130a0d6111613e23f926c344217581a2
Parent: 900cb6717b9d06e2b40049e4da2b25e8b98375a7
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Mar 14 10:44:14 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Mar 14 10:48:56 2014 +0100
autoactivation: issue a VG refresh before autoactivation only if 'change' lvmetad flag is set
This prevents numerous VG refreshes on each "pvscan --cache -aay" call
if the VG is found complete. We need to issue the refresh only if the PV:
- is new
- was gone before and now it reappears (device "unplug/plug back" scenario)
- the metadata has changed
---
WHATS_NEW | 2 ++
lib/cache/lvmetad.c | 6 ++++--
lib/cache/lvmetad.h | 3 ++-
tools/pvscan.c | 21 ++++++++++++---------
4 files changed, 20 insertions(+), 12 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ed15f33..6d70a0b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,7 @@
Version 2.02.106 -
====================================
+ Issue a VG refresh before autoactivation only if the PV has changed/is new.
+ Add flag to lvmetad protocol to indicate the PV scanned has changed/is new.
Add man page for lvm2-activation-generator.
Don't print an error and accept empty value for global/thin_disabled_features.
Update API for internal function build_dm_uuid().
diff --git a/lib/cache/lvmetad.c b/lib/cache/lvmetad.c
index 600fc19..a9c3100 100644
--- a/lib/cache/lvmetad.c
+++ b/lib/cache/lvmetad.c
@@ -750,6 +750,7 @@ int lvmetad_pv_found(const struct id *pvid, struct device *dev, const struct for
struct lvmcache_info *info;
struct dm_config_tree *pvmeta, *vgmeta;
const char *status, *vgid;
+ int64_t changed;
int result;
if (!lvmetad_active() || test_mode())
@@ -819,10 +820,11 @@ int lvmetad_pv_found(const struct id *pvid, struct device *dev, const struct for
if (result && handler) {
status = daemon_reply_str(reply, "status", "<missing>");
vgid = daemon_reply_str(reply, "vgid", "<missing>");
+ changed = daemon_reply_int(reply, "changed", 0);
if (!strcmp(status, "partial"))
- handler(_lvmetad_cmd, vgid, 1, CHANGE_AAY);
+ handler(_lvmetad_cmd, vgid, 1, changed, CHANGE_AAY);
else if (!strcmp(status, "complete"))
- handler(_lvmetad_cmd, vgid, 0, CHANGE_AAY);
+ handler(_lvmetad_cmd, vgid, 0, changed, CHANGE_AAY);
else if (!strcmp(status, "orphan"))
;
else
diff --git a/lib/cache/lvmetad.h b/lib/cache/lvmetad.h
index 85b71c2..fcc4b7d 100644
--- a/lib/cache/lvmetad.h
+++ b/lib/cache/lvmetad.h
@@ -23,7 +23,8 @@ struct dm_config_tree;
enum activation_change;
typedef int (*activation_handler) (struct cmd_context *cmd,
- const char *vgid, int partial,
+ const char *vgid,
+ int partial, int changed,
enum activation_change activate);
#ifdef LVMETAD_SUPPORT
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 4f99f45..b6b3067 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -95,7 +95,8 @@ static void _pvscan_display_single(struct cmd_context *cmd,
#define REFRESH_BEFORE_AUTOACTIVATION_RETRY_USLEEP_DELAY 100000
static int _auto_activation_handler(struct cmd_context *cmd,
- const char *vgid, int partial,
+ const char *vgid,
+ int partial, int changed,
activation_change_t activate)
{
unsigned int refresh_retries = REFRESH_BEFORE_AUTOACTIVATION_RETRIES;
@@ -139,16 +140,18 @@ static int _auto_activation_handler(struct cmd_context *cmd,
*
* Remove this workaround with "refresh_retries" once we have proper locking in!
*/
- while (refresh_retries--) {
- if (vg_refresh_visible(vg->cmd, vg)) {
- refresh_done = 1;
- break;
+ if (changed) {
+ while (refresh_retries--) {
+ if (vg_refresh_visible(vg->cmd, vg)) {
+ refresh_done = 1;
+ break;
+ }
+ usleep(REFRESH_BEFORE_AUTOACTIVATION_RETRY_USLEEP_DELAY);
}
- usleep(REFRESH_BEFORE_AUTOACTIVATION_RETRY_USLEEP_DELAY);
- }
- if (!refresh_done)
- log_warn("%s: refresh before autoactivation failed.", vg->name);
+ if (!refresh_done)
+ log_warn("%s: refresh before autoactivation failed.", vg->name);
+ }
if (!vgchange_activate(vg->cmd, vg, activate)) {
log_error("%s: autoactivation failed.", vg->name);
10 years, 2 months
master - tests: quick update of location of pid file
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=900cb6717b9d06...
Commit: 900cb6717b9d06e2b40049e4da2b25e8b98375a7
Parent: 551b6b799867860fc6a437be5298bc74b814ab19
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Mar 14 10:40:48 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Mar 14 10:40:48 2014 +0100
tests: quick update of location of pid file
Until better fix is put in - replace with /run.
---
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 c3adb56..7d13e8d 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -68,7 +68,7 @@ prepare_dmeventd() {
echo $! > LOCAL_DMEVENTD
# FIXME wait for pipe in /var/run instead
- while ! test -e "/var/run/dmeventd.pid"; do echo -n .; sleep .2; done # wait for the socket
+ while ! test -e "/run/dmeventd.pid"; do echo -n .; sleep .2; done # wait for the socket
echo ok
}
10 years, 2 months