master - report: fix selection on {vg, lv}_permissions fields to properly match selection criteria
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=9351dca86393f8...
Commit: 9351dca86393f862a6b2c270d5869407a4614d8a
Parent: 4b611bb816eef3e363e005b48b881e933c3de9e2
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Oct 23 15:03:04 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Oct 23 15:03:04 2014 +0200
report: fix selection on {vg,lv}_permissions fields to properly match selection criteria
There was a bug in value and their synonym definition for these two fields
causing selections on these fields to not work correctly - nothing matched
against vg/lv_permissions fields even if selection criteria should have
matched.
Scenario:
$ lvs -o name,lv_permissions vg
LV LPerms
lvol0 read-only
lvol1 writeable
Before this patch:
$ lvs -o name,lv_permissions vg -S 'permissions=read-only'
(blank)
$ lvs -o name,lv_permissions vg -S 'permissions=writeable
(blank)
With this patch applied:
$ lvs -o name,lv_permissions vg -S 'permissions=read-only'
LV LPerms
lvol0 read-only
$ lvs -o name,lv_permissions vg -S 'permissions=writeable'
LV LPerms
lvol1 writeable
Also synonyms match correctly now:
$ lvs -o name,lv_permissions vg -S 'permissions=rw'
LV LPerms
lvol1 writeable
---
WHATS_NEW | 1 +
lib/report/report.c | 10 +++++-----
lib/report/values.h | 14 +++++++-------
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2d644c5..38a4d1b 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Fix selection on {vg,lv}_permissions fields to properly match selection criteria.
Fix lv_permissions reporting to display read-only{-override} instead of blank.
Fix liblvm2cmd and lvm shell to respect quotes around args in cmd line string.
Permit extent sizes > 128KB that are not power of 2 with lvm2 format.
diff --git a/lib/report/report.c b/lib/report/report.c
index 3f63e1c..e85c349 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -92,11 +92,11 @@ static const int32_t _reserved_number_undef_32 = INT32_C(-1);
#define FIELD_RESERVED_VALUE(field_id, id, desc, value, ...) \
static const char *_reserved_ ## id ## _names[] = { __VA_ARGS__ , NULL}; \
- static const struct dm_report_field_reserved_value _reserved_ ## id = {field_ ## field_id, &value};
+ static const struct dm_report_field_reserved_value _reserved_ ## id = {field_ ## field_id, value};
#define FIELD_RESERVED_BINARY_VALUE(field_id, id, desc, ...) \
- FIELD_RESERVED_VALUE(field_id, id ## _y, desc, _one64, __VA_ARGS__, _str_yes) \
- FIELD_RESERVED_VALUE(field_id, id ## _n, desc, _zero64, __VA_ARGS__, _str_no)
+ FIELD_RESERVED_VALUE(field_id, id ## _y, desc, &_one64, __VA_ARGS__, _str_yes) \
+ FIELD_RESERVED_VALUE(field_id, id ## _n, desc, &_zero64, __VA_ARGS__, _str_no)
#include "values.h"
@@ -119,8 +119,8 @@ static const int32_t _reserved_number_undef_32 = INT32_C(-1);
#define FIELD_RESERVED_VALUE(field_id, id, desc, value, ...) {DM_REPORT_FIELD_TYPE_NONE, &_reserved_ ## id, _reserved_ ## id ## _names, desc},
#define FIELD_RESERVED_BINARY_VALUE(field_id, id, desc, ...) \
- FIELD_RESERVED_VALUE(field_id, id ## _y, desc, _one64, __VA_ARGS__) \
- FIELD_RESERVED_VALUE(field_id, id ## _n, desc, _zero64, __VA_ARGS__)
+ FIELD_RESERVED_VALUE(field_id, id ## _y, desc, &_one64, __VA_ARGS__) \
+ FIELD_RESERVED_VALUE(field_id, id ## _n, desc, &_zero64, __VA_ARGS__)
static const struct dm_report_reserved_value _report_reserved_values[] = {
#include "values.h"
diff --git a/lib/report/values.h b/lib/report/values.h
index fb368d4..f909ce9 100644
--- a/lib/report/values.h
+++ b/lib/report/values.h
@@ -54,9 +54,9 @@ FIELD_RESERVED_BINARY_VALUE(vg_extendable, vg_extendable, "", "extendable")
FIELD_RESERVED_BINARY_VALUE(vg_exported, vg_exported, "", "exported")
FIELD_RESERVED_BINARY_VALUE(vg_partial, vg_partial, "", "partial")
FIELD_RESERVED_BINARY_VALUE(vg_clustered, vg_clustered, "", "clustered")
-FIELD_RESERVED_VALUE(vg_permissions, vg_permissions_rw, "", FIRST_NAME(vg_permissions_rw), "writeable", "rw", "read-write")
-FIELD_RESERVED_VALUE(vg_permissions, vg_permissions_r, "", FIRST_NAME(vg_permissions_r), "read-only", "r", "ro")
-FIELD_RESERVED_VALUE(vg_mda_copies, vg_mda_copies, "", RESERVED(number_undef_64), "unmanaged")
+FIELD_RESERVED_VALUE(vg_permissions, vg_permissions_rw, "", "writeable", "writeable", "rw", "read-write")
+FIELD_RESERVED_VALUE(vg_permissions, vg_permissions_r, "", "read-only", "read-only", "r", "ro")
+FIELD_RESERVED_VALUE(vg_mda_copies, vg_mda_copies, "", &RESERVED(number_undef_64), "unmanaged")
/* Reserved values for LV fields */
FIELD_RESERVED_BINARY_VALUE(lv_initial_image_sync, lv_initial_image_sync, "", "initial image sync", "sync")
@@ -76,9 +76,9 @@ FIELD_RESERVED_BINARY_VALUE(lv_inactive_table, lv_inactive_table, "", "inactive
FIELD_RESERVED_BINARY_VALUE(lv_device_open, lv_device_open, "", "open")
FIELD_RESERVED_BINARY_VALUE(lv_skip_activation, lv_skip_activation, "", "skip activation", "skip")
FIELD_RESERVED_BINARY_VALUE(zero, zero, "", "zero")
-FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_rw, "", FIRST_NAME(lv_permissions_rw), "writeable", "rw", "read-write")
-FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r, "", FIRST_NAME(lv_permissions_r), "read-only", "r", "ro")
-FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r_override, "", FIRST_NAME(lv_permissions_r_override), "read-only-override", "ro-override", "r-override", "R")
-FIELD_RESERVED_VALUE(lv_read_ahead, lv_read_ahead, "", RESERVED(number_undef_64), "auto")
+FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_rw, "", "writeable", "writeable", "rw", "read-write")
+FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r, "", "read-only", "read-only", "r", "ro")
+FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r_override, "", "read-only-override", "read-only-override", "ro-override", "r-override", "R")
+FIELD_RESERVED_VALUE(lv_read_ahead, lv_read_ahead, "", &RESERVED(number_undef_64), "auto")
/* *INDENT-ON* */
8 years, 11 months
master - report: lv_permissions: display read-only/read-only-override instead of blank when LV is not writeable
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4b611bb816eef3...
Commit: 4b611bb816eef3e363e005b48b881e933c3de9e2
Parent: 2c8e7821c31245e3f7c1d56a67eb7f38d4b37001
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Oct 23 10:18:29 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Oct 23 10:18:29 2014 +0200
report: lv_permissions: display read-only/read-only-override instead of blank when LV is not writeable
Before this patch:
$ lvs -o name,lv_attr,lv_permissions
LV Attr LPerms
root -wi-ao---- writeable
swap -wi-ao---- writeable
lvol0 -Ri-a-----
lvol1 -ri-a-----
lvol2 -wi-a----- writeable
lvol3 -ri-------
With this patch applied:
$ lvs -o name,lv_attr,lv_permissions
LV Attr LPerms
root -wi-ao---- writeable
swap -wi-ao---- writeable
lvol0 -Ri-a----- read-only-override
lvol1 -ri-a----- read-only
lvol2 -wi-a----- writeable
lvol3 -ri------- read-only
("read-only-override" is displayed if the "writeable" permission
is overriden based on "activation/read_only_volume_list" lvm.conf
setting)
---
WHATS_NEW | 1 +
lib/report/values.h | 4 ++--
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 0d4487e..2d644c5 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Fix lv_permissions reporting to display read-only{-override} instead of blank.
Fix liblvm2cmd and lvm shell to respect quotes around args in cmd line string.
Permit extent sizes > 128KB that are not power of 2 with lvm2 format.
Remove workaround for lvm2-monitor.service hang on stop if lvmetad stopped.
diff --git a/lib/report/values.h b/lib/report/values.h
index 7425bc6..fb368d4 100644
--- a/lib/report/values.h
+++ b/lib/report/values.h
@@ -77,8 +77,8 @@ FIELD_RESERVED_BINARY_VALUE(lv_device_open, lv_device_open, "", "open")
FIELD_RESERVED_BINARY_VALUE(lv_skip_activation, lv_skip_activation, "", "skip activation", "skip")
FIELD_RESERVED_BINARY_VALUE(zero, zero, "", "zero")
FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_rw, "", FIRST_NAME(lv_permissions_rw), "writeable", "rw", "read-write")
-FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r, "", FIRST_NAME(lv_permissions_r), "", "read-only", "r", "ro")
-FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r_override, "", FIRST_NAME(lv_permissions_r_override), "", "read-only-override", "ro-override", "r-override", "R")
+FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r, "", FIRST_NAME(lv_permissions_r), "read-only", "r", "ro")
+FIELD_RESERVED_VALUE(lv_permissions, lv_permissions_r_override, "", FIRST_NAME(lv_permissions_r_override), "read-only-override", "ro-override", "r-override", "R")
FIELD_RESERVED_VALUE(lv_read_ahead, lv_read_ahead, "", RESERVED(number_undef_64), "auto")
/* *INDENT-ON* */
8 years, 11 months
master - NIX: Fix 32b builds (2G of RAM is 1M too much for 32b QEMU).
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2c8e7821c31245...
Commit: 2c8e7821c31245e3f7c1d56a67eb7f38d4b37001
Parent: 4988d799a26032bfde4888d55080f5d42f5d55c1
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Oct 22 09:02:17 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Oct 22 09:03:26 2014 +0200
NIX: Fix 32b builds (2G of RAM is 1M too much for 32b QEMU).
---
nix/default.nix | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index 6ef339b..abd3d01 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -13,7 +13,7 @@ let
fullName = "LVM2";
src = jobs.tarball;
diskImage = diskFun { extraPackages = extras; };
- memSize = 2048;
+ memSize = 2047;
# fc16 lcov is broken and el6 has none... be creative
prepareImagePhase = ''
8 years, 11 months
master - liblvm2cmd: recognize quotes properly when splitting cmd line string into argv array fields
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4988d799a26032...
Commit: 4988d799a26032bfde4888d55080f5d42f5d55c1
Parent: a6c294c5d0b989c3a881c8d084291aaf97fa3ac8
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Fri Oct 17 13:55:06 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Fri Oct 17 14:03:43 2014 +0200
liblvm2cmd: recognize quotes properly when splitting cmd line string into argv array fields
Fix lvm_split that is called when cmd line string is separated into
argv fields to recognize quote chars ('\'" and '"') properly and
when these quotes are used, consider the text within quotes as one
argument, do not separate it based on space characters inside.
The lvm_split is used during processing lvm shell command line or
when calling lvm commands through cmdlib (e.g. dmeventd plugins).
For example, the lvm shell scenario:
Before this patch:
$lvm
lvm> lvs --config 'global{ suffix=0 }'
Parse error at byte 9 (line 1): unexpected token
Failed to set overridden configuration entries.
With this patch applied:
$lvm
lvm> lvs --config 'global{ suffix=0 }'
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root fedora -wi-ao---- 9.00g
swap fedora -wi-ao---- 512.00m
(Exactly the same problem is hit when calling LVM commands with
quoted arguments via lvm2cmd lib in dmeventd plugins.)
---
WHATS_NEW | 1 +
tools/lvmcmdline.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index d7a00fe..0d4487e 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Fix liblvm2cmd and lvm shell to respect quotes around args in cmd line string.
Permit extent sizes > 128KB that are not power of 2 with lvm2 format.
Remove workaround for lvm2-monitor.service hang on stop if lvmetad stopped.
Change vgremove to use process_each_lv_in_vg.
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 4697b24..4c61332 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -1407,6 +1407,7 @@ int lvm_split(char *str, int *argc, char **argv, int max)
{
char *b = str, *e;
*argc = 0;
+ char quote = 0;
while (*b) {
while (*b && isspace(*b))
@@ -1415,14 +1416,20 @@ int lvm_split(char *str, int *argc, char **argv, int max)
if ((!*b) || (*b == '#'))
break;
+ if (*b == '\'' || *b == '"') {
+ quote = *b;
+ b++;
+ }
+
e = b;
- while (*e && !isspace(*e))
+ while (*e && (quote ? *e != quote : !isspace(*e)))
e++;
argv[(*argc)++] = b;
if (!*e)
break;
*e++ = '\0';
+ quote = 0;
b = e;
if (*argc == max)
break;
8 years, 11 months
master - toollib: remove unsed variable in process_each_segment_in_pv
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a6c294c5d0b989...
Commit: a6c294c5d0b989c3a881c8d084291aaf97fa3ac8
Parent: 23a38d242bcc1187aa6ef36383311d789d43c82d
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Oct 16 15:15:36 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Oct 16 15:16:52 2014 -0500
toollib: remove unsed variable in process_each_segment_in_pv
Was left unused from the last change to this function.
---
tools/toollib.c | 1 -
1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index eba9a37..f81acca 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -191,7 +191,6 @@ int process_each_segment_in_pv(struct cmd_context *cmd,
process_single_pvseg_fn_t process_single_pvseg)
{
struct pv_segment *pvseg;
- struct pv_list *pvl;
int ret_max = ECMD_PROCESSED;
int ret;
struct pv_segment _free_pv_segment = { .pv = pv };
8 years, 11 months
master - toollib: remove dead code
by David Teigland
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=23a38d242bcc11...
Commit: 23a38d242bcc1187aa6ef36383311d789d43c82d
Parent: 4461c624bc59ddca60f4bbf1eb447d64c8d4aeb2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Oct 15 15:45:38 2014 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Oct 15 15:47:45 2014 -0500
toollib: remove dead code
Because of the recent change to process_each_pv(), the vg is always
provided when the pv is in a vg. is_pv(pv) means the pv is in a vg,
which means that the vg arg will not be NULL, which means the removed
block of code is not needed.
---
tools/toollib.c | 34 ++--------------------------------
1 files changed, 2 insertions(+), 32 deletions(-)
diff --git a/tools/toollib.c b/tools/toollib.c
index 7f656c6..eba9a37 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -192,41 +192,15 @@ int process_each_segment_in_pv(struct cmd_context *cmd,
{
struct pv_segment *pvseg;
struct pv_list *pvl;
- const char *vg_name = NULL;
int ret_max = ECMD_PROCESSED;
int ret;
- struct volume_group *old_vg = vg;
struct pv_segment _free_pv_segment = { .pv = pv };
- if (is_pv(pv) && !vg && !is_orphan(pv)) {
- vg_name = pv_vg_name(pv);
-
- vg = vg_read(cmd, vg_name, NULL, 0);
- if (ignore_vg(vg, vg_name, 0, &ret_max)) {
- release_vg(vg);
- stack;
- return ret_max;
- }
-
- /*
- * Replace possibly incomplete PV structure with new one
- * allocated in vg_read_internal() path.
- */
- if (!(pvl = find_pv_in_vg(vg, pv_dev_name(pv)))) {
- log_error("Unable to find %s in volume group %s",
- pv_dev_name(pv), vg_name);
- unlock_and_release_vg(cmd, vg, vg_name);
- return ECMD_FAILED;
- }
-
- pv = pvl->pv;
- }
-
if (dm_list_empty(&pv->segments)) {
ret = process_single_pvseg(cmd, NULL, &_free_pv_segment, handle);
if (ret > ret_max)
ret_max = ret;
- } else
+ } else {
dm_list_iterate_items(pvseg, &pv->segments) {
if (sigint_caught()) {
ret_max = ECMD_FAILED;
@@ -237,11 +211,7 @@ int process_each_segment_in_pv(struct cmd_context *cmd,
if (ret > ret_max)
ret_max = ret;
}
-
- if (vg_name)
- unlock_vg(cmd, vg_name);
- if (!old_vg)
- release_vg(vg);
+ }
return ret_max;
}
8 years, 11 months
master - NIX: Give the VMs 2G of RAM (for tmpfs) until the new runner is merged.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4461c624bc59dd...
Commit: 4461c624bc59ddca60f4bbf1eb447d64c8d4aeb2
Parent: 5e6e2d6b1b984b83929dd23e75c0512e564d184f
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Tue Oct 14 19:06:26 2014 +0200
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Tue Oct 14 21:07:00 2014 +0200
NIX: Give the VMs 2G of RAM (for tmpfs) until the new runner is merged.
---
nix/default.nix | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/nix/default.nix b/nix/default.nix
index 228047f..6ef339b 100644
--- a/nix/default.nix
+++ b/nix/default.nix
@@ -13,7 +13,7 @@ let
fullName = "LVM2";
src = jobs.tarball;
diskImage = diskFun { extraPackages = extras; };
- memSize = 768;
+ memSize = 2048;
# fc16 lcov is broken and el6 has none... be creative
prepareImagePhase = ''
8 years, 11 months
master - vgcreate: Permit non-power-of-2 extent sizes.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5e6e2d6b1b984b...
Commit: 5e6e2d6b1b984b83929dd23e75c0512e564d184f
Parent: 02628413ca99648e70e38406384be69e20a2a6ce
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Oct 14 18:12:15 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Oct 14 18:12:15 2014 +0100
vgcreate: Permit non-power-of-2 extent sizes.
Relax validation to permit extent sizes > 128KB that are not powers of 2
with lvm2 format. Existing code was already capable of handling this.
---
WHATS_NEW | 1 +
lib/format1/disk-rep.h | 2 -
lib/format1/format1.c | 21 +------
lib/format_text/format-text.c | 14 +++--
lib/metadata/metadata-exported.h | 2 +
lib/metadata/metadata.h | 2 +
lib/metadata/vg.c | 124 ++++++++++++++++++++++++--------------
lib/metadata/vg.h | 1 +
man/vgchange.8.in | 9 ++-
man/vgcreate.8.in | 9 ++-
tools/vgconvert.c | 3 +
11 files changed, 107 insertions(+), 81 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 2a0adf4..d7a00fe 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Permit extent sizes > 128KB that are not power of 2 with lvm2 format.
Remove workaround for lvm2-monitor.service hang on stop if lvmetad stopped.
Change vgremove to use process_each_lv_in_vg.
Introduce WARN_ flags to control some metadata warning messages.
diff --git a/lib/format1/disk-rep.h b/lib/format1/disk-rep.h
index 43e2e57..729601e 100644
--- a/lib/format1/disk-rep.h
+++ b/lib/format1/disk-rep.h
@@ -26,8 +26,6 @@
#define LVM_BLK_MAJOR 58
#define MAX_PV_SIZE ((uint32_t) -1) /* 2TB in sectors - 1 */
-#define MIN_PE_SIZE (8192L >> SECTOR_SHIFT) /* 8 KB in sectors */
-#define MAX_PE_SIZE (16L * 1024L * (1024L >> SECTOR_SHIFT) * 1024L)
#define PE_SIZE_PV_SIZE_REL 5 /* PV size must be at least 5 times PE size */
#define MAX_LE_TOTAL 65534 /* 2^16 - 2 */
#define MAX_PE_TOTAL ((uint32_t) -2)
diff --git a/lib/format1/format1.c b/lib/format1/format1.c
index 8ee2f48..b0943b1 100644
--- a/lib/format1/format1.c
+++ b/lib/format1/format1.c
@@ -493,25 +493,8 @@ static int _format1_vg_setup(struct format_instance *fid, struct volume_group *v
if (!vg->max_pv || vg->max_pv >= MAX_PV)
vg->max_pv = MAX_PV - 1;
- if (vg->extent_size > MAX_PE_SIZE || vg->extent_size < MIN_PE_SIZE) {
- log_error("Extent size must be between %s and %s",
- display_size(fid->fmt->cmd, (uint64_t) MIN_PE_SIZE),
- display_size(fid->fmt->cmd, (uint64_t) MAX_PE_SIZE));
-
- return 0;
- }
-
- if (vg->extent_size % MIN_PE_SIZE) {
- log_error("Extent size must be multiple of %s",
- display_size(fid->fmt->cmd, (uint64_t) MIN_PE_SIZE));
- return 0;
- }
-
- /* Redundant? */
- if (vg->extent_size & (vg->extent_size - 1)) {
- log_error("Extent size must be power of 2");
- return 0;
- }
+ if (!vg_check_new_extent_size(vg->fid->fmt, vg->extent_size))
+ return_0;
return 1;
}
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c
index 9b894fa..c142e1b 100644
--- a/lib/format_text/format-text.c
+++ b/lib/format_text/format-text.c
@@ -72,13 +72,14 @@ void rlocn_set_ignored(struct raw_locn *rlocn, unsigned mda_ignored)
* NOTE: Currently there can be only one vg per text file.
*/
-static int _text_vg_setup(struct format_instance *fid __attribute__((unused)),
+/*
+ * Only used by vgcreate.
+ */
+static int _text_vg_setup(struct format_instance *fid,
struct volume_group *vg)
{
- if (vg->extent_size & (vg->extent_size - 1)) {
- log_error("Extent size must be power of 2");
- return 0;
- }
+ if (!vg_check_new_extent_size(vg->fid->fmt, vg->extent_size))
+ return_0;
return 1;
}
@@ -2440,7 +2441,8 @@ struct format_type *create_text_format(struct cmd_context *cmd)
fmt->orphan_vg_name = ORPHAN_VG_NAME(FMT_TEXT_NAME);
fmt->features = FMT_SEGMENTS | FMT_MDAS | FMT_TAGS | FMT_PRECOMMIT |
FMT_UNLIMITED_VOLS | FMT_RESIZE_PV |
- FMT_UNLIMITED_STRIPESIZE | FMT_BAS | FMT_CONFIG_PROFILE;
+ FMT_UNLIMITED_STRIPESIZE | FMT_BAS | FMT_CONFIG_PROFILE |
+ FMT_NON_POWER2_EXTENTS;
if (!(mda_lists = dm_malloc(sizeof(struct mda_lists)))) {
log_error("Failed to allocate dir_list");
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 0d8db7d..bf6f1c1 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -35,6 +35,7 @@
#define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1)
#define MAX_RESTRICTED_LVS 255 /* Used by FMT_RESTRICTED_LVIDS */
#define MAX_EXTENT_SIZE ((uint32_t) -1)
+#define MIN_NON_POWER2_EXTENT_SIZE (128U * 2U) /* 128KB in sectors */
/* Layer suffix */
#define MIRROR_SYNC_LAYER "_mimagetmp"
@@ -132,6 +133,7 @@
#define FMT_BAS 0x000000400U /* Supports bootloader areas? */
#define FMT_CONFIG_PROFILE 0x000000800U /* Supports configuration profiles? */
#define FMT_OBSOLETE 0x000001000U /* Obsolete format? */
+#define FMT_NON_POWER2_EXTENTS 0x000002000U /* Non-power-of-2 extent sizes? */
/* Mirror conversion type flags */
#define MIRROR_BY_SEG 0x00000001U /* segment-by-segment mirror */
diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h
index f847ddb..1dd8867 100644
--- a/lib/metadata/metadata.h
+++ b/lib/metadata/metadata.h
@@ -33,6 +33,8 @@
//#define STRIPE_SIZE_MAX ( 512L * 1024L >> SECTOR_SHIFT) /* 512 KB in sectors */
//#define STRIPE_SIZE_LIMIT ((UINT_MAX >> 2) + 1)
//#define MAX_RESTRICTED_LVS 255 /* Used by FMT_RESTRICTED_LVIDS */
+#define MIN_PE_SIZE (8192L >> SECTOR_SHIFT) /* 8 KB in sectors - format1 only */
+#define MAX_PE_SIZE (16L * 1024L * (1024L >> SECTOR_SHIFT) * 1024L) /* format1 only */
#define MIRROR_LOG_OFFSET 2 /* sectors */
#define VG_MEMPOOL_CHUNK 10240 /* in bytes, hint only */
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index 7b6cb85..71b894b 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -278,18 +278,18 @@ char *vg_profile_dup(const struct volume_group *vg)
}
static int _recalc_extents(uint32_t *extents, const char *desc1,
- const char *desc2, uint32_t old_size,
- uint32_t new_size)
+ const char *desc2, uint32_t old_extent_size,
+ uint32_t new_extent_size)
{
- uint64_t size = (uint64_t) old_size * (*extents);
+ uint64_t size = (uint64_t) old_extent_size * (*extents);
- if (size % new_size) {
+ if (size % new_extent_size) {
log_error("New size %" PRIu64 " for %s%s not an exact number "
"of new extents.", size, desc1, desc2);
return 0;
}
- size /= new_size;
+ size /= new_extent_size;
if (size > MAX_EXTENT_COUNT) {
log_error("New extent count %" PRIu64 " for %s%s exceeds "
@@ -302,9 +302,48 @@ static int _recalc_extents(uint32_t *extents, const char *desc1,
return 1;
}
-int vg_set_extent_size(struct volume_group *vg, uint32_t new_size)
+int vg_check_new_extent_size(const struct format_type *fmt, uint32_t new_extent_size)
{
- uint32_t old_size = vg->extent_size;
+ if (!new_extent_size) {
+ log_error("Physical extent size may not be zero");
+ return 0;
+ }
+
+ if ((fmt->features & FMT_NON_POWER2_EXTENTS)) {
+ if ((new_extent_size & (new_extent_size - 1)) &&
+ (new_extent_size % MIN_NON_POWER2_EXTENT_SIZE)) {
+ log_error("Physical Extent size must be a multiple of %s when not a power of 2.",
+ display_size(fmt->cmd, (uint64_t) MIN_NON_POWER2_EXTENT_SIZE));
+ return 0;
+ }
+ return 1;
+ }
+
+ /* Apply original format1 restrictions */
+ if ((new_extent_size & (new_extent_size - 1))) {
+ log_error("Metadata format only supports Physical Extent sizes that are powers of 2.");
+ return 0;
+ }
+
+ if (new_extent_size > MAX_PE_SIZE || new_extent_size < MIN_PE_SIZE) {
+ log_error("Extent size must be between %s and %s",
+ display_size(fmt->cmd, (uint64_t) MIN_PE_SIZE),
+ display_size(fmt->cmd, (uint64_t) MAX_PE_SIZE));
+ return 0;
+ }
+
+ if (new_extent_size % MIN_PE_SIZE) {
+ log_error("Extent size must be multiple of %s",
+ display_size(fmt->cmd, (uint64_t) MIN_PE_SIZE));
+ return 0;
+ }
+
+ return 1;
+}
+
+int vg_set_extent_size(struct volume_group *vg, uint32_t new_extent_size)
+{
+ uint32_t old_extent_size = vg->extent_size;
struct pv_list *pvl;
struct lv_list *lvl;
struct physical_volume *pv;
@@ -319,52 +358,45 @@ int vg_set_extent_size(struct volume_group *vg, uint32_t new_size)
return 0;
}
- if (!new_size) {
- log_error("Physical extent size may not be zero");
- return 0;
- }
-
- if (new_size == vg->extent_size)
+ if (new_extent_size == vg->extent_size)
return 1;
- if (new_size & (new_size - 1)) {
- log_error("Physical extent size must be a power of 2.");
- return 0;
- }
+ if (!vg_check_new_extent_size(vg->fid->fmt, new_extent_size))
+ return_0;
- if (new_size > vg->extent_size) {
- if ((uint64_t) vg_size(vg) % new_size) {
+ if (new_extent_size > vg->extent_size) {
+ if ((uint64_t) vg_size(vg) % new_extent_size) {
/* FIXME Adjust used PV sizes instead */
log_error("New extent size is not a perfect fit");
return 0;
}
}
- vg->extent_size = new_size;
+ vg->extent_size = new_extent_size;
if (vg->fid->fmt->ops->vg_setup &&
!vg->fid->fmt->ops->vg_setup(vg->fid, vg))
return_0;
- if (!_recalc_extents(&vg->extent_count, vg->name, "", old_size,
- new_size))
+ if (!_recalc_extents(&vg->extent_count, vg->name, "", old_extent_size,
+ new_extent_size))
return_0;
if (!_recalc_extents(&vg->free_count, vg->name, " free space",
- old_size, new_size))
+ old_extent_size, new_extent_size))
return_0;
/* foreach PV */
dm_list_iterate_items(pvl, &vg->pvs) {
pv = pvl->pv;
- pv->pe_size = new_size;
+ pv->pe_size = new_extent_size;
if (!_recalc_extents(&pv->pe_count, pv_dev_name(pv), "",
- old_size, new_size))
+ old_extent_size, new_extent_size))
return_0;
if (!_recalc_extents(&pv->pe_alloc_count, pv_dev_name(pv),
- " allocated space", old_size, new_size))
+ " allocated space", old_extent_size, new_extent_size))
return_0;
/* foreach free PV Segment */
@@ -373,12 +405,12 @@ int vg_set_extent_size(struct volume_group *vg, uint32_t new_size)
continue;
if (!_recalc_extents(&pvseg->pe, pv_dev_name(pv),
- " PV segment start", old_size,
- new_size))
+ " PV segment start", old_extent_size,
+ new_extent_size))
return_0;
if (!_recalc_extents(&pvseg->len, pv_dev_name(pv),
- " PV segment length", old_size,
- new_size))
+ " PV segment length", old_extent_size,
+ new_extent_size))
return_0;
}
}
@@ -387,29 +419,29 @@ int vg_set_extent_size(struct volume_group *vg, uint32_t new_size)
dm_list_iterate_items(lvl, &vg->lvs) {
lv = lvl->lv;
- if (!_recalc_extents(&lv->le_count, lv->name, "", old_size,
- new_size))
+ if (!_recalc_extents(&lv->le_count, lv->name, "", old_extent_size,
+ new_extent_size))
return_0;
dm_list_iterate_items(seg, &lv->segments) {
if (!_recalc_extents(&seg->le, lv->name,
- " segment start", old_size,
- new_size))
+ " segment start", old_extent_size,
+ new_extent_size))
return_0;
if (!_recalc_extents(&seg->len, lv->name,
- " segment length", old_size,
- new_size))
+ " segment length", old_extent_size,
+ new_extent_size))
return_0;
if (!_recalc_extents(&seg->area_len, lv->name,
- " area length", old_size,
- new_size))
+ " area length", old_extent_size,
+ new_extent_size))
return_0;
if (!_recalc_extents(&seg->extents_copied, lv->name,
- " extents moved", old_size,
- new_size))
+ " extents moved", old_extent_size,
+ new_extent_size))
return_0;
/* foreach area */
@@ -419,21 +451,21 @@ int vg_set_extent_size(struct volume_group *vg, uint32_t new_size)
if (!_recalc_extents
(&seg_pe(seg, s),
lv->name,
- " pvseg start", old_size,
- new_size))
+ " pvseg start", old_extent_size,
+ new_extent_size))
return_0;
if (!_recalc_extents
(&seg_pvseg(seg, s)->len,
lv->name,
- " pvseg length", old_size,
- new_size))
+ " pvseg length", old_extent_size,
+ new_extent_size))
return_0;
break;
case AREA_LV:
if (!_recalc_extents
(&seg_le(seg, s), lv->name,
- " area start", old_size,
- new_size))
+ " area start", old_extent_size,
+ new_extent_size))
return_0;
break;
case AREA_UNASSIGNED:
diff --git a/lib/metadata/vg.h b/lib/metadata/vg.h
index b3b7e93..fffe9a7 100644
--- a/lib/metadata/vg.h
+++ b/lib/metadata/vg.h
@@ -147,6 +147,7 @@ int vg_set_clustered(struct volume_group *vg, int clustered);
uint64_t vg_size(const struct volume_group *vg);
uint64_t vg_free(const struct volume_group *vg);
uint64_t vg_extent_size(const struct volume_group *vg);
+int vg_check_new_extent_size(const struct format_type *fmt, uint32_t new_extent_size);
int vg_set_extent_size(struct volume_group *vg, uint32_t new_extent_size);
uint64_t vg_extent_count(const struct volume_group *vg);
uint64_t vg_free_count(const struct volume_group *vg);
diff --git a/man/vgchange.8.in b/man/vgchange.8.in
index 150b77d..dcd1faf 100644
--- a/man/vgchange.8.in
+++ b/man/vgchange.8.in
@@ -220,10 +220,11 @@ minimize metadata read and write overhead.
.BR \-s ", " \-\-physicalextentsize " " \fIPhysicalExtentSize [ \fIBbBsSkKmMgGtTpPeE ]
Changes the physical extent size on physical volumes of this volume group.
A size suffix (k for kilobytes up to t for terabytes) is optional, megabytes
-is the default if no suffix is present. The value must be at least 1 sector
-for LVM2 format (where the sector size is the largest sector size of the
-PVs currently used in the VG) or 8KiB for LVM1 format and it must be a
-power of 2. The default is 4 MiB.
+is the default if no suffix is present. For LVM2 format, the value must be a
+power of 2 of at least 1 sector (where the sector size is the largest sector
+size of the PVs currently used in the VG) or, if not a power of 2, at least
+128KiB. For the older LVM1 format, it must be a power of 2 of at least 8KiB.
+The default is 4 MiB.
Before increasing the physical extent size, you might need to use lvresize,
pvresize and/or pvmove so that everything fits. For example, every
diff --git a/man/vgcreate.8.in b/man/vgcreate.8.in
index bcfbcfc..d850659 100644
--- a/man/vgcreate.8.in
+++ b/man/vgcreate.8.in
@@ -105,10 +105,11 @@ See \fBlvm.conf\fP(5) for more information about \fBmetadata profiles\fP.
.BR \-s ", " \-\-physicalextentsize " " \fIPhysicalExtentSize [ \fIbBsSkKmMgGtTpPeE ]
Sets the physical extent size on physical volumes of this volume group.
A size suffix (k for kilobytes up to t for terabytes) is optional, megabytes
-is the default if no suffix is present. The value must be at least 1 sector
-for LVM2 format (where the sector size is the largest sector size of the
-PVs currently used in the VG) or 8KiB for LVM1 format and it must be a
-power of 2. The default is 4 MiB.
+is the default if no suffix is present. For LVM2 format, the value must be a
+power of 2 of at least 1 sector (where the sector size is the largest sector
+size of the PVs currently used in the VG) or, if not a power of 2, at least
+128KiB. For the older LVM1 format, it must be a power of 2 of at least 8KiB.
+The default is 4 MiB.
Once this value has been set, it is difficult to change it without recreating
the volume group which would involve backing up and restoring data on any
diff --git a/tools/vgconvert.c b/tools/vgconvert.c
index 86e3097..1089344 100644
--- a/tools/vgconvert.c
+++ b/tools/vgconvert.c
@@ -66,6 +66,9 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name,
rp.ba_size = arg_uint64_value(cmd, bootloaderareasize_ARG, UINT64_C(0));
}
+ if (!vg_check_new_extent_size(cmd->fmt, vg->extent_size))
+ return_ECMD_FAILED;
+
if (!archive(vg)) {
log_error("Archive of \"%s\" metadata failed.", vg_name);
return ECMD_FAILED;
8 years, 11 months
master - systemd: remove workaround for lvm2-monitor.service's ExecStop line
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=02628413ca9964...
Commit: 02628413ca99648e70e38406384be69e20a2a6ce
Parent: d1bcdd7338148a887aae44149e3ea756c1df17a3
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Oct 14 09:56:58 2014 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Oct 14 10:08:23 2014 +0200
systemd: remove workaround for lvm2-monitor.service's ExecStop line
Bug https://bugzilla.redhat.com/show_bug.cgi?id=843587 is handled better
now - the hang does not occur anymore. There are still error messages
issued though during shutdown if someone stops lvm2-lvmetad.service
manually that lvm2-monitor.service depends on (even during shutdown).
These errors are correct though and will point to incorrect
configuration (still having use_lvmetad=1 in lvm.conf and stopping
lvm2-lvmetad.service manually).
The workaround to prevent the hang is not needed now. So the
'--config "global{use_lvmetad=0}"' is now removed from the
lvm2-monitor.service's ExecStop line.
---
WHATS_NEW | 1 +
scripts/lvm2_monitoring_systemd_red_hat.service.in | 3 +--
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 8511a45..2a0adf4 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.112 -
=====================================
+ Remove workaround for lvm2-monitor.service hang on stop if lvmetad stopped.
Change vgremove to use process_each_lv_in_vg.
Introduce WARN_ flags to control some metadata warning messages.
Use process_each_pv in vgreduce.
diff --git a/scripts/lvm2_monitoring_systemd_red_hat.service.in b/scripts/lvm2_monitoring_systemd_red_hat.service.in
index 05f911b..bb52f0d 100644
--- a/scripts/lvm2_monitoring_systemd_red_hat.service.in
+++ b/scripts/lvm2_monitoring_systemd_red_hat.service.in
@@ -11,8 +11,7 @@ Conflicts=shutdown.target
Type=oneshot
Environment=LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
ExecStart=@sbindir@/lvm vgchange --monitor y --ignoreskippedcluster
-# The lvmetad must be disabled here, it needs https://bugzilla.redhat.com/show_bug.cgi?id=843587 to be resolved first.
-ExecStop=@sbindir@/lvm vgchange --monitor n --config 'global{use_lvmetad=0}' --ignoreskippedcluster
+ExecStop=@sbindir@/lvm vgchange --monitor n --ignoreskippedcluster
RemainAfterExit=yes
[Install]
8 years, 11 months
master - device: Fix BLKSSZGET definition check.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d1bcdd7338148a...
Commit: d1bcdd7338148a887aae44149e3ea756c1df17a3
Parent: 22a6b0e40b302b333f9bd995c0b81b0146e8232a
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Mon Oct 13 18:15:41 2014 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Mon Oct 13 18:15:41 2014 +0100
device: Fix BLKSSZGET definition check.
---
lib/device/dev-io.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/device/dev-io.c b/lib/device/dev-io.c
index 0a75088..122b616 100644
--- a/lib/device/dev-io.c
+++ b/lib/device/dev-io.c
@@ -154,7 +154,7 @@ int dev_get_block_size(struct device *dev, unsigned int *physical_block_size, un
}
log_debug_devs("%s: physical block size is %u bytes", name, dev->phys_block_size);
}
-#elif BLKSSZGET
+#elif defined (BLKSSZGET)
/* if we can't get physical block size, just use logical block size instead */
if (dev->phys_block_size == -1) {
if (ioctl(dev_fd(dev), BLKSSZGET, &dev->phys_block_size) < 0) {
8 years, 11 months