master - report: fix seg_monitor field to display monitoring status for thin snapshots and mirrors
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=94d85f815e0ba1...
Commit: 94d85f815e0ba1f06f7cb9c4c4e9e97468c970a6
Parent: 56606b5f21682cfb8f36aef419f0cb7dcf55cce9
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Thu Mar 5 10:45:29 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Thu Mar 5 10:54:25 2015 +0100
report: fix seg_monitor field to display monitoring status for thin snapshots and mirrors
The seg_monitor did not display monitored status for thick snapshots
and mirrors (with mirror log *not* mirrored). The seg monitor did work
correctly even before for other segtypes - thins and raids.
Before (mirrors and snapshots, only mirrors with mirrored log properly displayed monitoring status):
[0] f21/~ # lvs -a -o lv_name,lv_layout,lv_role,seg_monitor vg
LV Layout Role Monitor
mirror mirror public
[mirror_mimage_0] linear private,mirror,image
[mirror_mimage_1] linear private,mirror,image
[mirror_mlog] linear private,mirror,log
mirror_with_mirror_log mirror public monitored
[mirror_with_mirror_log_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mimage_1] linear private,mirror,image
[mirror_with_mirror_log_mlog] mirror private,mirror,log monitored
[mirror_with_mirror_log_mlog_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mlog_mimage_1] linear private,mirror,image
thick_origin linear public,origin,thickorigin
thick_snapshot linear public,snapshot,thicksnapshot
With this patch applied (monitoring status displayed for all mirrors and snapshots):
[0] f21/~ # lvs -a -o lv_name,lv_layout,lv_role,seg_monitor vg
LV Layout Role Monitor
mirror mirror public monitored
[mirror_mimage_0] linear private,mirror,image
[mirror_mimage_1] linear private,mirror,image
[mirror_mlog] linear private,mirror,log
mirror_with_mirror_log mirror public monitored
[mirror_with_mirror_log_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mimage_1] linear private,mirror,image
[mirror_with_mirror_log_mlog] mirror private,mirror,log monitored
[mirror_with_mirror_log_mlog_mimage_0] linear private,mirror,image
[mirror_with_mirror_log_mlog_mimage_1] linear private,mirror,image
thick_origin linear public,origin,thickorigin
thick_snapshot linear public,snapshot,thicksnapshot monitored
---
WHATS_NEW | 1 +
lib/metadata/lv.c | 2 --
lib/report/report.c | 10 +++++-----
3 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index f597980..46783e1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.118 -
=================================
+ Fix seg_monitor field to report status also for mirrors and thick snapshots.
Version 2.02.117 - 4th March 2015
=================================
diff --git a/lib/metadata/lv.c b/lib/metadata/lv.c
index c3c5d4a..10ce906 100644
--- a/lib/metadata/lv.c
+++ b/lib/metadata/lv.c
@@ -152,8 +152,6 @@ char *lvseg_monitor_dup(struct dm_pool *mem, const 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 ((dmeventd_monitor_mode() != 1) ||
diff --git a/lib/report/report.c b/lib/report/report.c
index 75928c0..4ef2b04 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -791,14 +791,14 @@ static int _segmonitor_disp(struct dm_report *rh, struct dm_pool *mem,
const struct lv_segment *seg = (const struct lv_segment *)data;
char *str;
- if (!seg->segtype->ops || !seg->segtype->ops->target_monitored)
- return _field_set_value(field, GET_FIRST_RESERVED_NAME(seg_monitor_undef),
- GET_FIELD_RESERVED_VALUE(seg_monitor_undef));
-
if (!(str = lvseg_monitor_dup(mem, seg)))
return_0;
- return _field_set_value(field, str, NULL);
+ if (*str)
+ return _field_set_value(field, str, NULL);
+
+ return _field_set_value(field, GET_FIRST_RESERVED_NAME(seg_monitor_undef),
+ GET_FIELD_RESERVED_VALUE(seg_monitor_undef));
}
static int _segstart_disp(struct dm_report *rh, struct dm_pool *mem,
8 years, 7 months
v2_02_117 annotated tag has been created
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e518dc4ec835a0...
Commit: e518dc4ec835a03a044ae169bf283e983f27d4c1
Parent: 0000000000000000000000000000000000000000
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: 2015-03-04 13:51 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: 2015-03-04 13:51 +0000
annotated tag: v2_02_117 has been created
at e518dc4ec835a03a044ae169bf283e983f27d4c1 (tag)
tagging 930fa3290debbdecca44f334426d960e3160e7bf (commit)
replaces v2_02_116
Release 2.02.117.
148 files changed, 6636 insertions(+), 1287 deletions(-)
The system ID documentation included in this release relates
to code that is still under development and the code that
lets you set a system ID has not yet been enabled.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)
iEYEABECAAYFAlT3DvIACgkQIoGRwVZ+LBfbhgCeLj1aGiB48lVV/l8PI8naYXpm
VVcAoLmX+qnzBHk72FALuof6y4r4j8OK
=Mk0s
-----END PGP SIGNATURE-----
Alasdair G Kergon (34):
post-release
pvchange: Use process_each_pv.
conf: Set default global/etc from --with-confdir.
lvmetad: Add fn to scan only foreign VGs.
lvm-string: Fix HYPEN typo.
systemid: Add built-in systemid command.
config: Reinstate recursive tags setting.
format_text: Store creation_host_system_id.
format_text: Fix creation_host_system_id.
systemid: Require alphanumeric 1st character.
toolcontext: Move lvmlocal.conf loading.
toolcontext: Include system_id in refresh.
systemid: Add warnings if invalid.
systemid: Define file content more precisely.
config: Adjust system_id defaults.
config: Rename allow_system_id to extra_system_ids.
lvm1: Reenable sys ID.
systemid: Fix access restrictions.
systemid: Extend --foreign to reporting commands.
systemid: Allow empty systemid with warnings.
systemid: Improve concurrent warning.
example.conf: Update systemid comments.
toolcontext: Fix lvmlocal.conf load fail path.
lvchange: Allow -prw to change kernel only.
mirror: Avoid region size compiler warning.
mirror: Explicit cast in region_size_max
lvchange: Allow -pr to change kernel only.
archives: Preserve format type in file.
format1: Export generate_lvm1_system_id.
vgchange: Prevent lvm1 system ID changes.
systemid: Init and merge lvm2 and lvm1 fields.
systemid: Add ACCESS_NEEDS_SYSTEM_ID VG flag.
systemid: Disable --systemid.
pre-release
David Teigland (31):
toollib: prepare select_match_{pv,vg,lv} hooks
vgextend: Use process_each_vg.
system_id: use for VG ownership
WHATS_NEW for system_id
toollib: add underscore to static ignore_vg function
system_id: omit leading hyphens from system_id
system_id: warn if the system_id_file cannot be opened
man: update lvmthin about repair and recovery
doc: explanation of caching foreign VGs
tests: add system_id test
report: fix foreign reporting without lvmetad
man lvmsystemid: expanded limitations and warnings
tests: skip system_id machineid case when not available
man: systemid option for vgcreate and vgchange
vgchange, vgcreate: add systemid option to command help
man lvm: document --foreign option
man lvmsystemid: update changing the system_id
systemid: silently ignore foreign vgs unless named
vgcfgbackup: enable foreign VG access
lvchange: deactivate is always possible in foreign vgs
tests: add more systemid tests
tests: fix the system_id tests
WHATS_NEW: vgimport with lvmetad
pvscan, vgscan: include foreign vgs with --cache
tests: add more system_id tests
man: lvmsystemid: empty string equals no system_id
tests: more system_id tests
system_id: remove unwanted foreign error for some commands
system_id: apply consistent naming
vgchange: deactivate LVs in foreign VG
lvchange, vgchange: fix the system_id check
Jonathan Brassow (1):
cmirror: Adjust region size to work around CPG msg limit to avoid hang.
Jose Castillo (1):
initscripts: lvm2-monitor: implement status action
Marian Csontos (2):
test: Fix harness not building on RHEL5
test: Fix missing return in new test harness.
Ondrej Kozina (2):
libdaemon: set CLOEXEC on client socket fd
libdaemon: set CLOEXEC flag on systemd socket
Peter Rajnoha (55):
reporter: properly check for _do_info_and_status return value and free the mempool if created within the fn
lvm: recognize LVM_COMMAND_PROFILE env var for default command profile to use in LVM commands
libdm: report: add dm_report_object_is_selected
cleanup: make report type condition consistent with the rest of the code
toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related)
report: add report_init_for_selection fn and modify report_object to support reporting for selection only
toollib: pass struct processing_handle to _select_match_* functions
toollib: add init_processing_handle, init_selection_handle and destroy_processing_handle helper functions
toollib: initialize handles (including reporting for selection) for _select_match_* used in process_each_* fns
toollib: select the whole structure if at least one of its items is selected
refactor: report: factor out code to determine final report type
report: add report_for_selection and use it in select_match_{pv,vg,lv}
report: implement report_for_selection
pvchange: use processing_handle when processing items for pvchange
tools: allow -S|--select for vgchange, lvchange and pvchange
tools: allow -S|--select for vgremove and lvremove
tools: allow -S|--select for vgdisplay, lvdisplay and pvdisplay without -C
tools: allow -S|--select for vgexport and vgimport
select: initialize selection handle for process_each_* fns with initial report type
man: dumpconfig: mention LVM_COMMAND_PROFILE env var and add more references to --mergedconfig option
toollib: select: issue an error message for failed VG/LV/PV selection
man: reference -S/--select in {vg,lv,pv}change, {vg,lv}remove, {vg,lv,pv}display and vg{import,export} man pages
conf: update profile templates for recent changes
report: define ba_start, vg_free and seg_start fields as DM_REPORT_FIELD_TYPE_SIZE instead of DM_REPORT_FIELD_TYPE_NUM
tests: rename report-select.sh to select-report.sh
tests: add select-tools.sh to test selection support in toollib
config: fix version of introduction for devices/external_device_info_source (v115->v116)
toollib: process_each_pv: do not acquire list of all devices if not necessary
toollib: process_each_pv: use cmd->full_filter, not cmd->filter if we're getting full list of PV-capable devices (not just PVs)
toollib: process_each_pv: fix commit d38d047e which worked for processing "all devices", but didn't work for "all PVs"
autoreconf: recent changes
lvchange: change msg about required params (LV or selection) to be consistent with msgs used in other tools
pvchange: no need to initialize selection handle directly, process_each_pv will do that automatically
cleanup: replace static struct processing_handle initializer with common init_processing_handle
cleanup: remove deallocate_handle_root arg from destroy_procesing_handle fnw
tests: select-tools.sh: pvchange now uses process_each_pv
tolllib: process_each_pv: always use full_filter unconditionally when getting all devices
tests: comment in select-tools.sh
tests: fix pvcreate-operation-md test to properly clean up devs before their reuse
pvcreate: switch to "none" dev-ext source during pvcreate
filters: no need to refresh filters/rescan if no signature is wiped during pvcreate at all
wiping: blkid: do not count skipped signatures in final number of wipes
pvcreate: switch to "none" dev-ext source during pvcreate
configure: typo in configure --with-default-raid10-segtype causing it to be unrecognized
conf: be more clear about wipe_signatures_when_zeroing_new_lvs option in comments
report: fix handling of reports with pure label fields
report: one more comment explaining change of report type when tags are used for original LABEL reporting
cleanup: change check order in condition in _check_pv_list fn
initscripts: lvm2-monitor: use @DMEVENTD_PIDFILE@ instead of hardcoded /var/run/dmeventd.pid
report: check value of args_are_pvs, not the pointer (fix for commit 9ea77b7)
metadata: vg: add missing vg->lvm1_system_id initialization
metadata: vg: alloc lvm1_system_id in alloc_vg sooner
vgremove: select: direct selection to be done per-VG, not per-LV
config: add CFG_DISABLED flag and mark system_id settings with that flag
cleanup: tools: "or use -S for selection" --> "or use --select for selection"
Petr Rockai (113):
test: Import first draft of a new test runner.
configure: Allow C++ components.
configure: Add libexecdir/datadir to make.tmpl.in.
test: Build the new test runner.
test: Use the new runner in make check.
test: Split up the new runner into multiple files.
test: Implement journalling and --continue.
test: Clean up fds properly in the runner.
test: Write a results/list at the end of a test run.
test: Add new flavour definition files.
test: Allow test devices backed by a permanent block device.
test: Make runner use bigger IO buffers, put them on stack.
test: Implement a file-backed IO sink in the runner.
test: Add a buffer-backed IO sink (for interactive runs).
test: Fix IO sink destructors in the runner.
test: Use the new flavour setup files in lib/inittest.
test: Make it possible to run tests from an installed location.
test: Makefile updates.
test: Fix handling of envvars in the runner.
test: Implement flavours in the runner.
test: Make the runner's journal more reliable.
test: Improve tracking of silence (stuck testcases) in the runner.
test: Improve IO handling in the runner.
test: Run the testcases chdir'd into --testdir.
test: Targets and sources can't have the same name if builddir == srcdir.
test: Rename the --quiet option to --batch.
test: Run in /tmp if LVM_TEST_DIR is unset.
test: Avoid sleeps in the runner monitoring loop.
test: Print a heartbeat file (every 20s) in the runner.
test: Add time/rusage formatting to the runner.
test: Implement specialised --batch output style w/ rusage stats.
test: Use append for journal maintenance instead of rename.
test: Fix a precedence bug in the runner.
test: Add a missing copyright/licence notice to journal.h.
test: Fix loading of an append-mode journal.
test: Implement --only option to runner.
spec: Add an (optional) lvm2-testsuite subpackage.
NIX: Refactor around the new test runner.
NIX: Use --batch mode for running the testsuite.
NIX: Implement a smarter VM monitoring loop.
NIX: Adapt to the append-based test journal.
NIX: Use nixpkgs kernel for building, distro kernel for testing.
NIX: Drop -h from rpm invocations as it messes up logs.
NIX: Existence of results list no longer indicates that the suite has finished.
NIX: Add Fedora 20 jobs.
NIX: Re-work VM monitoring.
test: Disable lvmetad logging in lvconvert-{mirror,raid}*.
test: Make the runner's heartbeat more reliable.
test: Implement --fatal-timeouts to allow a timely VM restart.
NIX: Pass --fatal-timeouts to the testsuite.
test: Package up the test runner in a reusable C++ "brick".
NIX: Use the new --heartbeat option on lvm2-testsuite.
test: Update brick-shelltest, adding timestamps to logs.
libdaemon: Use select to yield CPU on a blocked read or write.
NIX: Use IDE drive emulation instead of virtio.
NIX: Some kernels need ide/ata modules (i.e. no builtin ata).
NIX: Keep the udev log out of tmpfs.
test: Update brick-shelltest.h.
NIX: Add --kmsg to lvm2-testsuite invocations.
NIX: Run each test flavour as a separate derivation.
NIX: Do not fail aggregation when a sub-job fails to produce output.
NIX: Update path to /xchg (was /tmp/xchg with older nixpkgs).
test: Fix implementation of check targets with new flavour system.
test: Do not rely on dev/mapper/* nodes in pvmove-restart.sh.
NIX: Mark builds with failed tests as such.
test: Update brick-shelltest (configurable timeout, better banner, exit code).
test: Fix 100%FREE RAID tests since test device sizes changed slightly.
test: Avoid running 'dmsetup remove' with no devices.
test: Fix failures due to undefined abs_top_builddir.
NIX: Avoid a spurious failure when all tests pass.
NIX: Detect that the VM booted up more directly.
test: Re-try with loopback if a backing device is too small.
test: Avoid passing -c to flock.
test: Fix prepare_scsi_debug_dev.
NIX: Make timeout and test envvars configurable via --arg.
NIX: Install valgrind, gdb and strace in the test environment.
test: Make lvm-wrapper available in the installed testsuite, too.
test: Add support for running LVM commands in tests through strace.
configure: Look for valgrind.h independently of VALGRIND_POOLS.
memlock: Do not check memory balance if RUNNING_ON_VALGRIND.
NIX: Add valgrind-devel to the build environment.
test: Call $VALGRIND directly in lvm-wrapper.
test: Disable lvmetad debug log on another bunch of tests.
test: Make killing local (test) daemons more robust.
test: Make dmsetup remove more robust in pvmove-restart.
test: Allow a longer timeout for lvextend-snapshot-dmeventd.
test: Only force an IO sync when the testcase has finished.
test: Properly detect warnings from testcases.
test: Remove spurious set -x in lvm-wrapper.
test: It is not an error for a test daemon to exit before teardown.
test: Fix a segfault in the test runner.
NIX: Add a CentOS 7.0 64b build.
NIX: Set ulimit -c to unlimited, to get backtraces in logs.
NIX: Allow adding/overriding test configurations.
NIX: Move corosynclib-devel & valgrind-devel out of common.
NIX: We need to install lcov for ./configure now as well.
NIX: Adjust install_rpms (kernel rpm is now required).
NIX: Request {fedora,centos}-release packages explicitly.
configure: Fix a warning about test/Makefile.in.
test: Fix a typo in shell/pvmove-restart.sh.
NIX: Adjust lists of extra RPMs to install.
NIX: Drop Fedora 16 builds.
NIX: Resolve issues with fedora-release and kernel-modules-extra.
NIX: Fix CentOS builds.
spec: Include lvmsystemid.7 in RPMs.
NIX: Fix a typo that broke evaluation of fc19+.
test: Make pvmove0 device removal more robust, in pvmove-restart.sh.
test: Avoid a race in pvmove-restart.sh.
clvmd: Fix BZ 1140095 by updating lastfd upon EINTR.
cache: Fix a segfault when passing --cachepolicy without --cachesettings.
lvmcache.7: add a section on --cachepolicy/--cachesettings
lvcreate.8: Mention --cachepolicy and --cachesettings.
spec: Add lvmlocal.conf to RPMs.
Zdenek Kabelac (17):
tests: respect LVM_TEST_DIR
makefiles: more _CFLAGS for -MM
tests: don't crash if checked string is shorter
tests: ensure array is synchronized
tests: BACKING_DEV
configure.in: AC_SUBST needs to be always executed
memory: disable check with valgrind pool build
valgrind: when executed within valrind skip close
tests: ensure lv1 goes away first
tests: syncaction update
cleanup: drop unused val
cleanup: drop !! from code
cleanup: fix compate of return value
tests: hide uninteresting output
cleanup: drop unused value assign
cleanup: simplify error path code
cleanup: drop unused header file
8 years, 7 months
master - post-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=56606b5f21682c...
Commit: 56606b5f21682cfb8f36aef419f0cb7dcf55cce9
Parent: 930fa3290debbdecca44f334426d960e3160e7bf
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Mar 4 14:00:46 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Mar 4 14:00:46 2015 +0000
post-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 3 +++
WHATS_NEW_DM | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/VERSION b/VERSION
index 22c760d..4f24316 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.117(2)-git (2015-03-04)
+2.02.118(2)-git (2015-03-04)
diff --git a/VERSION_DM b/VERSION_DM
index 4541e24..649324d 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.94-git (2015-03-04)
+1.02.95-git (2015-03-04)
diff --git a/WHATS_NEW b/WHATS_NEW
index af5704a..f597980 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,3 +1,6 @@
+Version 2.02.118 -
+=================================
+
Version 2.02.117 - 4th March 2015
=================================
Add CFG_DISABLED for new system ID config settings that must not yet be used.
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 8816312..9286bc6 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,6 @@
+Version 1.02.95 -
+================================
+
Version 1.02.94 - 4th March 2015
================================
Add dm_report_object_is_selected for generalized interface for report/select.
8 years, 7 months
master - pre-release
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=930fa3290debbd...
Commit: 930fa3290debbdecca44f334426d960e3160e7bf
Parent: a7bfc2cbb565eb668068a091d7c2a7a4f4f2ffcc
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Mar 4 13:49:51 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Mar 4 13:49:51 2015 +0000
pre-release
---
VERSION | 2 +-
VERSION_DM | 2 +-
WHATS_NEW | 14 +++++++-------
WHATS_NEW_DM | 4 ++--
4 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/VERSION b/VERSION
index 071f5f4..22c760d 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.02.117(2)-git (2015-01-30)
+2.02.117(2)-git (2015-03-04)
diff --git a/VERSION_DM b/VERSION_DM
index dc719d2..4541e24 100644
--- a/VERSION_DM
+++ b/VERSION_DM
@@ -1 +1 @@
-1.02.94-git (2015-01-30)
+1.02.94-git (2015-03-04)
diff --git a/WHATS_NEW b/WHATS_NEW
index 9beb668..af5704a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
-Version 2.02.117 -
-====================================
+Version 2.02.117 - 4th March 2015
+=================================
+ Add CFG_DISABLED for new system ID config settings that must not yet be used.
Set ACCESS_NEEDS_SYSTEM_ID VG status flag while system_id is set.
Preserve original format type field when processing backup files.
Implement status action for lvm2-monitor initscript to display monitored LVs.
@@ -12,14 +13,13 @@ Version 2.02.117 -
Add NEEDS_FOREIGN_VGS flag to vgimport so --foreign is always supplied.
Add --foreign to the 6 display and reporting tools and vgcfgbackup.
Install /etc/lvm/lvmlocal.conf template with local section for systemid.
- Record creation_host_system_id in lvm2 metadata.
+ Record creation_host_system_id in lvm2 metadata (never set yet).
Reinstate recursive config file tag section processing. (2.02.99)
- Add 'lvm systemid' to display the current system ID.
+ Add 'lvm systemid' to display the current system ID (never set yet).
Fix configure to properly recognize --with-default-raid10-segtype option.
Do not refresh filters/rescan if no signature is wiped during pvcreate.
Enforce none external dev info for wiping during pvcreate to avoid races.
- Add global/system_id_source and system_id_file to lvm.conf.
- Add --systemid to vgcreate and vchange to set / change a system ID.
+ Add global/system_id_source and system_id_file to lvm.conf (disabled).
Add support for VG system_id to control host access to VGs.
Update vgextend to use process_each_vg.
Add --ignoreskippedcluster to pvchange.
@@ -33,7 +33,7 @@ Version 2.02.117 -
Add support for -S/--select to vgchange,lvchange and pvchange.
Add infrastructure to support selection for non-reporting tools.
Add LVM_COMMAND_PROFILE env var to set default command profile name to use.
- set CLOEXEC flag on file descriptors originating in libdaemon
+ Set CLOEXEC flag on file descriptors originating in libdaemon.
Version 2.02.116 - 30th January 2015
====================================
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 183ef15..8816312 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,5 @@
-Version 1.02.94 -
-===================================
+Version 1.02.94 - 4th March 2015
+================================
Add dm_report_object_is_selected for generalized interface for report/select.
Version 1.02.93 - 21st January 2015
8 years, 7 months
master - cleanup: tools: "or use -S for selection" --> "or use --select for selection"
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=a7bfc2cbb565eb...
Commit: a7bfc2cbb565eb668068a091d7c2a7a4f4f2ffcc
Parent: 733bfe36f5ba34f11b297e41ec249aaa6b238d7b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Mar 4 14:40:04 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Mar 4 14:40:58 2015 +0100
cleanup: tools: "or use -S for selection" --> "or use --select for selection"
---
tools/lvchange.c | 2 +-
tools/lvremove.c | 2 +-
tools/pvchange.c | 2 +-
tools/vgexport.c | 2 +-
tools/vgremove.c | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/lvchange.c b/tools/lvchange.c
index 0351e4e..5e90adc 100644
--- a/tools/lvchange.c
+++ b/tools/lvchange.c
@@ -1182,7 +1182,7 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
cmd->handles_missing_pvs = 1;
if (!argc && !arg_is_set(cmd, select_ARG)) {
- log_error("Please give logical volume path(s) or use -S for selection.");
+ log_error("Please give logical volume path(s) or use --select for selection.");
return EINVALID_CMD_LINE;
}
diff --git a/tools/lvremove.c b/tools/lvremove.c
index df920fb..ce0b65b 100644
--- a/tools/lvremove.c
+++ b/tools/lvremove.c
@@ -19,7 +19,7 @@ int lvremove(struct cmd_context *cmd, int argc, char **argv)
{
if (!argc && !arg_is_set(cmd, select_ARG)) {
log_error("Please enter one or more logical volume paths "
- "or use -S for selection.");
+ "or use --select for selection.");
return EINVALID_CMD_LINE;
}
diff --git a/tools/pvchange.c b/tools/pvchange.c
index 3eb9e96..3e0894f 100644
--- a/tools/pvchange.c
+++ b/tools/pvchange.c
@@ -180,7 +180,7 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv)
handle->custom_handle = ¶ms;
if (!(arg_count(cmd, all_ARG)) && !argc && !handle->internal_report_for_select) {
- log_error("Please give a physical volume path or use -S for selection.");
+ log_error("Please give a physical volume path or use --select for selection.");
ret = EINVALID_CMD_LINE;
goto out;
}
diff --git a/tools/vgexport.c b/tools/vgexport.c
index 4bed421..6d5b4f6 100644
--- a/tools/vgexport.c
+++ b/tools/vgexport.c
@@ -53,7 +53,7 @@ bad:
int vgexport(struct cmd_context *cmd, int argc, char **argv)
{
if (!argc && !arg_count(cmd, all_ARG) && !arg_is_set(cmd, select_ARG)) {
- log_error("Please supply volume groups or use -S for selection or use -a for all.");
+ log_error("Please supply volume groups or use --select for selection or use -a for all.");
return EINVALID_CMD_LINE;
}
diff --git a/tools/vgremove.c b/tools/vgremove.c
index d33ab1b..fd97356 100644
--- a/tools/vgremove.c
+++ b/tools/vgremove.c
@@ -85,7 +85,7 @@ int vgremove(struct cmd_context *cmd, int argc, char **argv)
if (!argc && !arg_is_set(cmd, select_ARG)) {
log_error("Please enter one or more volume group paths "
- "or use -S for selection.");
+ "or use --select for selection.");
return EINVALID_CMD_LINE;
}
8 years, 7 months
master - systemid: Disable --systemid.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=733bfe36f5ba34...
Commit: 733bfe36f5ba34f11b297e41ec249aaa6b238d7b
Parent: 67c52a4453a941244b07044ee1b80284e8f181c6
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Mar 4 13:14:51 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Mar 4 13:14:51 2015 +0000
systemid: Disable --systemid.
Disable use of --systemid for this release.
---
tools/commands.h | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/tools/commands.h b/tools/commands.h
index 719c507..577589e 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -965,7 +965,6 @@ xx(vgchange,
"\t[--refresh]\n"
"\t[-S|--select Selection]\n"
"\t[--sysinit]\n"
- "\t[--systemid SystemID]\n"
"\t[-t|--test]\n"
"\t[-u|--uuid]\n"
"\t[-v|--verbose]\n"
@@ -988,7 +987,7 @@ xx(vgchange,
metadataprofile_ARG, monitor_ARG, noudevsync_ARG, metadatacopies_ARG,
vgmetadatacopies_ARG, partial_ARG, physicalextentsize_ARG, poll_ARG,
refresh_ARG, resizeable_ARG, resizable_ARG, select_ARG, sysinit_ARG,
- systemid_ARG, test_ARG, uuid_ARG)
+ test_ARG, uuid_ARG)
xx(vgck,
"Check the consistency of volume group(s)",
@@ -1039,7 +1038,6 @@ xx(vgcreate,
"\t[--[vg]metadatacopies #copies]\n"
"\t[-p|--maxphysicalvolumes MaxPhysicalVolumes]\n"
"\t[-s|--physicalextentsize PhysicalExtentSize[bBsSkKmMgGtTpPeE]]\n"
- "\t[--systemid SystemID]\n"
"\t[-t|--test]\n"
"\t[-v|--verbose]\n"
"\t[--version]\n"
@@ -1051,8 +1049,7 @@ xx(vgcreate,
maxphysicalvolumes_ARG, metadataprofile_ARG, metadatatype_ARG,
physicalextentsize_ARG, test_ARG, force_ARG, zero_ARG, labelsector_ARG,
metadatasize_ARG, pvmetadatacopies_ARG, metadatacopies_ARG,
- vgmetadatacopies_ARG, dataalignment_ARG, dataalignmentoffset_ARG,
- systemid_ARG)
+ vgmetadatacopies_ARG, dataalignment_ARG, dataalignmentoffset_ARG)
xx(vgdisplay,
"Display volume group information",
8 years, 7 months
master - config: add CFG_DISABLED flag and mark system_id settings with that flag
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=67c52a4453a941...
Commit: 67c52a4453a941244b07044ee1b80284e8f181c6
Parent: e73dad787439c1376dfa00fef6d1ee0f18f42c9b
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Mar 4 14:08:47 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Mar 4 14:08:47 2015 +0100
config: add CFG_DISABLED flag and mark system_id settings with that flag
If configuration setting is marked in config_setting.h with CFG_DISABLED
flag, default value is always used for such setting, no matter if it's defined
by user (in --config/lvm.conf/lvmlocal.conf).
A warning message is displayed if this happens:
For example:
[1] f21/~ # lvm dumpconfig --validate
WARNING: Configuration setting global/system_id_source is disabled. Using default value.
LVM configuration valid.
[1] f21/~ # pvs
WARNING: Configuration setting global/system_id_source is disabled. Using default value.
PV VG Fmt Attr PSize PFree
/dev/sdb lvm2 --- 128.00m 128.00m
...
---
lib/config/config.c | 31 ++++++++++++++++++++++++-------
lib/config/config.h | 21 ++++++++++++---------
lib/config/config_settings.h | 9 +++++----
3 files changed, 41 insertions(+), 20 deletions(-)
diff --git a/lib/config/config.c b/lib/config/config.c
index d7b11c3..effe93d 100644
--- a/lib/config/config.c
+++ b/lib/config/config.c
@@ -1145,6 +1145,16 @@ static int _apply_local_profile(struct cmd_context *cmd, struct profile *profile
return override_config_tree_from_profile(cmd, profile);
}
+static int _config_disabled(struct cmd_context *cmd, cfg_def_item_t *item, const char *path)
+{
+ if ((item->flags & CFG_DISABLED) && dm_config_tree_find_node(cmd->cft, path)) {
+ log_warn("WARNING: Configuration setting %s is disabled. Using default value.", path);
+ return 1;
+ }
+
+ return 0;
+}
+
const struct dm_config_node *find_config_node(struct cmd_context *cmd, struct dm_config_tree *cft, int id)
{
cfg_def_item_t *item = cfg_def_get_item_p(id);
@@ -1189,7 +1199,8 @@ const char *find_config_tree_str(struct cmd_context *cmd, int id, struct profile
if (item->type != CFG_TYPE_STRING)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as string.", path);
- str = dm_config_tree_find_str(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile));
+ str = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile)
+ : dm_config_tree_find_str(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile));
if (profile_applied)
remove_config_tree_by_source(cmd, profile->source);
@@ -1212,7 +1223,8 @@ const char *find_config_tree_str_allow_empty(struct cmd_context *cmd, int id, st
if (!(item->flags & CFG_ALLOW_EMPTY))
log_error(INTERNAL_ERROR "%s cfg tree element not declared to allow empty values.", path);
- str = dm_config_tree_find_str_allow_empty(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile));
+ str = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile)
+ : dm_config_tree_find_str_allow_empty(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_STRING, profile));
if (profile_applied)
remove_config_tree_by_source(cmd, profile->source);
@@ -1233,7 +1245,8 @@ int find_config_tree_int(struct cmd_context *cmd, int id, struct profile *profil
if (item->type != CFG_TYPE_INT)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
- i = dm_config_tree_find_int(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile));
+ i = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile)
+ : dm_config_tree_find_int(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile));
if (profile_applied)
remove_config_tree_by_source(cmd, profile->source);
@@ -1254,7 +1267,8 @@ int64_t find_config_tree_int64(struct cmd_context *cmd, int id, struct profile *
if (item->type != CFG_TYPE_INT)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as integer.", path);
- i64 = dm_config_tree_find_int64(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile));
+ i64 = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile)
+ : dm_config_tree_find_int64(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_INT, profile));
if (profile_applied)
remove_config_tree_by_source(cmd, profile->source);
@@ -1275,7 +1289,8 @@ float find_config_tree_float(struct cmd_context *cmd, int id, struct profile *pr
if (item->type != CFG_TYPE_FLOAT)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as float.", path);
- f = dm_config_tree_find_float(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_FLOAT, profile));
+ f = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_FLOAT, profile)
+ : dm_config_tree_find_float(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_FLOAT, profile));
if (profile_applied)
remove_config_tree_by_source(cmd, profile->source);
@@ -1294,7 +1309,8 @@ int find_config_bool(struct cmd_context *cmd, struct dm_config_tree *cft, int id
if (item->type != CFG_TYPE_BOOL)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as boolean.", path);
- b = dm_config_tree_find_bool(cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, NULL));
+ b = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, NULL)
+ : dm_config_tree_find_bool(cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, NULL));
return b;
}
@@ -1312,7 +1328,8 @@ int find_config_tree_bool(struct cmd_context *cmd, int id, struct profile *profi
if (item->type != CFG_TYPE_BOOL)
log_error(INTERNAL_ERROR "%s cfg tree element not declared as boolean.", path);
- b = dm_config_tree_find_bool(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, profile));
+ b = _config_disabled(cmd, item, path) ? cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, profile)
+ : dm_config_tree_find_bool(cmd->cft, path, cfg_def_get_default_value(cmd, item, CFG_TYPE_BOOL, profile));
if (profile_applied)
remove_config_tree_by_source(cmd, profile->source);
diff --git a/lib/config/config.h b/lib/config/config.h
index 965214e..ba34354 100644
--- a/lib/config/config.h
+++ b/lib/config/config.h
@@ -90,24 +90,27 @@ typedef union {
/* configuration definition item flags: */
+
/* whether the configuration item name is variable */
-#define CFG_NAME_VARIABLE 0x01
+#define CFG_NAME_VARIABLE 0x001
/* whether empty value is allowed */
-#define CFG_ALLOW_EMPTY 0x02
+#define CFG_ALLOW_EMPTY 0x002
/* whether the configuration item is for advanced use only */
-#define CFG_ADVANCED 0x04
+#define CFG_ADVANCED 0x004
/* whether the configuration item is not officially supported */
-#define CFG_UNSUPPORTED 0x08
+#define CFG_UNSUPPORTED 0x008
/* whether the configuration item is customizable by a profile */
-#define CFG_PROFILABLE 0x10
+#define CFG_PROFILABLE 0x010
/* whether the configuration item is customizable by a profile */
/* and whether it can be attached to VG/LV metadata at the same time
* The CFG_PROFILABLE_METADATA flag incorporates CFG_PROFILABLE flag!!! */
-#define CFG_PROFILABLE_METADATA 0x30
+#define CFG_PROFILABLE_METADATA 0x030
/* whether the default value is undefned */
-#define CFG_DEFAULT_UNDEFINED 0x40
-/* whether the defualt value is calculated during run time */
-#define CFG_DEFAULT_RUN_TIME 0x80
+#define CFG_DEFAULT_UNDEFINED 0x040
+/* whether the default value is calculated during run time */
+#define CFG_DEFAULT_RUN_TIME 0x080
+/* whether the configuration setting is disabled (and hence defaults always used) */
+#define CFG_DISABLED 0x100
/* configuration definition item structure */
typedef struct cfg_def_item {
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
index 4083785..f22039a 100644
--- a/lib/config/config_settings.h
+++ b/lib/config/config_settings.h
@@ -43,6 +43,7 @@
* CFG_PROFILABLE - this node is customizable by a profile
* CFG_PROFILABLE_METADATA - profilable and attachable to VG/LV metadata
* CFG_DEFAULT_UNDEFINED - node's default value is undefined
+ * CFG_DISABLED - configuration is disabled (defaults always used)
* type: allowed type for the value of simple configuation setting, one of:
* CFG_TYPE_BOOL
* CFG_TYPE_INT
@@ -193,8 +194,8 @@ cfg_array(global_cache_check_options_CFG, "cache_check_options", global_CFG_SECT
cfg(global_cache_dump_executable_CFG, "cache_dump_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, CACHE_DUMP_CMD, vsn(2, 2, 108), NULL)
cfg(global_cache_repair_executable_CFG, "cache_repair_executable", global_CFG_SECTION, CFG_ALLOW_EMPTY, CFG_TYPE_STRING, CACHE_REPAIR_CMD, vsn(2, 2, 108), NULL)
cfg_array(global_cache_repair_options_CFG, "cache_repair_options", global_CFG_SECTION, 0, CFG_TYPE_STRING, "#S" DEFAULT_CACHE_REPAIR_OPTIONS, vsn(2, 2, 108), NULL)
-cfg(global_system_id_source_CFG, "system_id_source", global_CFG_SECTION, 0, CFG_TYPE_STRING, DEFAULT_SYSTEM_ID_SOURCE, vsn(2, 2, 117), NULL)
-cfg(global_system_id_file_CFG, "system_id_file", global_CFG_SECTION, CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL)
+cfg(global_system_id_source_CFG, "system_id_source", global_CFG_SECTION, CFG_DISABLED, CFG_TYPE_STRING, DEFAULT_SYSTEM_ID_SOURCE, vsn(2, 2, 117), NULL)
+cfg(global_system_id_file_CFG, "system_id_file", global_CFG_SECTION, CFG_DISABLED | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL)
cfg(activation_checks_CFG, "checks", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_ACTIVATION_CHECKS, vsn(2, 2, 86), NULL)
cfg(activation_udev_sync_CFG, "udev_sync", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_UDEV_SYNC, vsn(2, 2, 51), NULL)
@@ -281,7 +282,7 @@ cfg(tags_hosttags_CFG, "hosttags", tags_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_H
cfg_section(tag_CFG_SUBSECTION, "tag", tags_CFG_SECTION, CFG_NAME_VARIABLE | CFG_DEFAULT_UNDEFINED, vsn(1, 0, 18), NULL)
cfg(tag_host_list_CFG, "host_list", tag_CFG_SUBSECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(1, 0, 18), NULL)
-cfg(local_system_id_CFG, "system_id", local_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL)
-cfg_array(local_extra_system_ids_CFG, "extra_system_ids", local_CFG_SECTION, CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL)
+cfg(local_system_id_CFG, "system_id", local_CFG_SECTION, CFG_DISABLED | CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL)
+cfg_array(local_extra_system_ids_CFG, "extra_system_ids", local_CFG_SECTION, CFG_DISABLED | CFG_ALLOW_EMPTY | CFG_DEFAULT_UNDEFINED, CFG_TYPE_STRING, NULL, vsn(2, 2, 117), NULL)
cfg(CFG_COUNT, NULL, root_CFG_SECTION, 0, CFG_TYPE_INT, 0, vsn(0, 0, 0), NULL)
8 years, 7 months
master - vgremove: select: direct selection to be done per-VG, not per-LV
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e73dad787439c1...
Commit: e73dad787439c1376dfa00fef6d1ee0f18f42c9b
Parent: bfbb5d269aa1ed56d9308117b57d4d2da49d53f6
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Mar 4 10:44:31 2015 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Mar 4 10:44:31 2015 +0100
vgremove: select: direct selection to be done per-VG, not per-LV
Though vgremove operates per VG by definition, internally, it
actually means iterating over each LV it contains to do the
remove.
So we need to direct selection a bit in this case so that the
selection is done per-VG, not per-LV.
That means, use processing handle with void_handle.internal_report_for_select=0
for the process_each_lv_in_vg that is called later in vgremove_single fn.
We need to disable internal selection for process_each_lv_in_vg
here as selection is already done by process_each_vg which calls
vgremove_single. Otherwise selection would be done per-LV and not
per-VG as we intend!
An intra-release fix for commit 00744b053f395be79ab1cb80fdf7342548aa79e2.
---
test/shell/select-tools.sh | 10 ++++++++++
tools/vgremove.c | 16 +++++++++++++++-
2 files changed, 25 insertions(+), 1 deletions(-)
diff --git a/test/shell/select-tools.sh b/test/shell/select-tools.sh
index c418716..1738a45 100644
--- a/test/shell/select-tools.sh
+++ b/test/shell/select-tools.sh
@@ -263,3 +263,13 @@ not check pv_field $dev2 pv_tags "309,tag"
not check pv_field $dev3 pv_tags "309,tag"
not check pv_field $dev4 pv_tags "309,tag"
pvchange -a --deltag 309 --deltag tag
+
+#########################
+# special cases to test #
+#########################
+
+# if calling vgremove, make sure we're doing selection per-VG, not per-LV
+# (vgremove calls process_each_vg with vgremove_single which itself
+# iterates over LVs with process_each_lv_in_vg - so internally it actually
+# operates per-LV, but we still need the selection to be done per-VG)
+vgremove --yes -S 'lv_name=lv2' # should remove whole vg1, not just the lv2
diff --git a/tools/vgremove.c b/tools/vgremove.c
index 3ce0763..d33ab1b 100644
--- a/tools/vgremove.c
+++ b/tools/vgremove.c
@@ -20,6 +20,19 @@ static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
struct processing_handle *handle __attribute__((unused)))
{
/*
+ * Though vgremove operates per VG by definition, internally, it
+ * actually means iterating over each LV it contains to do the remove.
+ *
+ * Use processing handle with void_handle.internal_report_for_select=0
+ * for the process_each_lv_in_vg that is called later in this fn.
+ * We need to disable internal selection for process_each_lv_in_vg
+ * here as selection is already done by process_each_vg which calls
+ * vgremove_single. Otherwise selection would be done per-LV and
+ * not per-VG as we intend!
+ */
+ struct processing_handle void_handle = {0};
+
+ /*
* Single force is equivalent to sinle --yes
* Even multiple --yes are equivalent to single --force
* When we require -ff it cannot be replaces with -f -y
@@ -47,7 +60,8 @@ static int vgremove_single(struct cmd_context *cmd, const char *vg_name,
return ECMD_FAILED;
}
}
- if ((ret = process_each_lv_in_vg(cmd, vg, NULL, NULL, 1, NULL,
+
+ if ((ret = process_each_lv_in_vg(cmd, vg, NULL, NULL, 1, &void_handle,
(process_single_lv_fn_t)lvremove_single)) != ECMD_PROCESSED) {
stack;
return ret;
8 years, 7 months
master - systemid: Add ACCESS_NEEDS_SYSTEM_ID VG flag.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=bfbb5d269aa1ed...
Commit: bfbb5d269aa1ed56d9308117b57d4d2da49d53f6
Parent: 3562b5ab39b32bd27c81f57185e397facb7690f5
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Mar 4 01:16:32 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Mar 4 01:16:32 2015 +0000
systemid: Add ACCESS_NEEDS_SYSTEM_ID VG flag.
Set ACCESS_NEEDS_SYSTEM_ID VG status flag whenever there is
a non-lvm1 system_id set. Prevents concurrent access from
older LVM2 versions.
Not set on VGs that bear a system_id only due to conversion
from lvm1 metadata.
---
WHATS_NEW | 1 +
lib/format1/format1.c | 2 ++
lib/format1/import-export.c | 4 +++-
lib/format_text/flags.c | 1 +
lib/format_text/import_vsn1.c | 20 ++++++++++++--------
lib/metadata/metadata-exported.h | 3 ++-
lib/metadata/vg.c | 3 +++
tools/vgchange.c | 6 +++++-
8 files changed, 29 insertions(+), 11 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ae8bc70..9beb668 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.117 -
====================================
+ Set ACCESS_NEEDS_SYSTEM_ID VG status flag while system_id is set.
Preserve original format type field when processing backup files.
Implement status action for lvm2-monitor initscript to display monitored LVs.
Allow lvchange -p to change kernel state only if metadata state differs.
diff --git a/lib/format1/format1.c b/lib/format1/format1.c
index 19df8aa..7f37cf5 100644
--- a/lib/format1/format1.c
+++ b/lib/format1/format1.c
@@ -501,6 +501,8 @@ static int _format1_vg_setup(struct format_instance *fid, struct volume_group *v
!generate_lvm1_system_id(vg->cmd, vg->lvm1_system_id, ""))
return_0;
+ vg->status &= ~ACCESS_NEEDS_SYSTEM_ID;
+
return 1;
}
diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c
index 9b387e2..4846a8b 100644
--- a/lib/format1/import-export.c
+++ b/lib/format1/import-export.c
@@ -69,8 +69,10 @@ int import_pv(const struct format_type *fmt, struct dm_pool *mem,
memcpy(&pv->vgid, vgd->vg_uuid, sizeof(vg->id));
/* Store system_id from first PV if PV belongs to a VG */
- if (vg && !*vg->lvm1_system_id)
+ if (vg && !*vg->lvm1_system_id) {
strncpy(vg->lvm1_system_id, (char *)pvd->system_id, NAME_LEN);
+ vg->status &= ~ACCESS_NEEDS_SYSTEM_ID;
+ }
if (vg &&
strncmp(vg->lvm1_system_id, (char *)pvd->system_id, sizeof(pvd->system_id)))
diff --git a/lib/format_text/flags.c b/lib/format_text/flags.c
index cf01271..1a4a503 100644
--- a/lib/format_text/flags.c
+++ b/lib/format_text/flags.c
@@ -36,6 +36,7 @@ static const struct flag _vg_flags[] = {
{LVM_WRITE, "WRITE", STATUS_FLAG},
{CLUSTERED, "CLUSTERED", STATUS_FLAG},
{SHARED, "SHARED", STATUS_FLAG},
+ {ACCESS_NEEDS_SYSTEM_ID, "ACCESS_NEEDS_SYSTEM_ID", STATUS_FLAG},
{PARTIAL_VG, NULL, 0},
{PRECOMMITTED, NULL, 0},
{ARCHIVED_VG, NULL, 0},
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index 64c08a0..8ab9363e 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -733,11 +733,10 @@ static struct volume_group *_read_vg(struct format_instance *fid,
{
const struct dm_config_node *vgn;
const struct dm_config_value *cv;
- const char *str, *format_str;
+ const char *str, *system_id, *format_str;
struct volume_group *vg;
struct dm_hash_table *pv_hash = NULL, *lv_hash = NULL;
unsigned scan_done_once = use_cached_pvs;
- char *system_id;
/* skip any top-level values */
for (vgn = cft->root; (vgn && vgn->v); vgn = vgn->sib)
@@ -751,9 +750,6 @@ static struct volume_group *_read_vg(struct format_instance *fid,
if (!(vg = alloc_vg("read_vg", fid->fmt->cmd, vgn->key)))
return_NULL;
- if (!(system_id = dm_pool_zalloc(vg->vgmem, NAME_LEN + 1)))
- goto_bad;
- vg->system_id = system_id;
/*
* The pv hash memorises the pv section names -> pv
@@ -782,9 +778,6 @@ static struct volume_group *_read_vg(struct format_instance *fid,
goto bad;
}
- if (dm_config_get_str(vgn, "system_id", &str))
- strncpy(system_id, str, NAME_LEN);
-
if (!_read_id(&vg->id, vgn, "id")) {
log_error("Couldn't read uuid for volume group %s.", vg->name);
goto bad;
@@ -802,6 +795,17 @@ static struct volume_group *_read_vg(struct format_instance *fid,
goto bad;
}
+ if (dm_config_get_str(vgn, "system_id", &system_id)) {
+ if (!(vg->status & ACCESS_NEEDS_SYSTEM_ID)) {
+ if (!(vg->lvm1_system_id = dm_pool_zalloc(vg->vgmem, NAME_LEN + 1)))
+ goto_bad;
+ strncpy(vg->lvm1_system_id, system_id, NAME_LEN);
+ } else if (!(vg->system_id = dm_pool_strdup(vg->vgmem, system_id))) {
+ log_error("Failed to allocate memory for system_id in vg_set_system_id.");
+ goto bad;
+ }
+ }
+
if (!_read_int32(vgn, "extent_size", &vg->extent_size)) {
log_error("Couldn't read extent size for volume group %s.",
vg->name);
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 758fa53..5fbfdef 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -60,6 +60,7 @@
#define LVM_WRITE UINT64_C(0x0000000000000200) /* LV, VG */
#define CLUSTERED UINT64_C(0x0000000000000400) /* VG */
+#define ACCESS_NEEDS_SYSTEM_ID UINT64_C(0x0020000000000000) /* VG */
//#define SHARED UINT64_C(0x0000000000000800) /* VG */
/* FIXME Remove when metadata restructuring is completed */
@@ -122,7 +123,7 @@
#define PV_ALLOCATION_PROHIBITED UINT64_C(0x0010000000000000) /* PV - internal use only - allocation prohibited
e.g. to prohibit allocation of a RAID image
on a PV already holing an image of the RAID set */
-/* Next unused flag: UINT64_C(0x0020000000000000) */
+/* Next unused flag: UINT64_C(0x0040000000000000) */
/* Format features flags */
#define FMT_SEGMENTS 0x00000001U /* Arbitrary segment params? */
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index 404cc6f..b23063e 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -615,6 +615,7 @@ int vg_set_system_id(struct volume_group *vg, const char *system_id)
{
if (!system_id || !*system_id) {
vg->system_id = NULL;
+ vg->status &= ~ACCESS_NEEDS_SYSTEM_ID;
return 1;
}
@@ -632,6 +633,8 @@ int vg_set_system_id(struct volume_group *vg, const char *system_id)
if (vg->lvm1_system_id)
*vg->lvm1_system_id = '\0';
+ vg->status |= ACCESS_NEEDS_SYSTEM_ID;
+
return 1;
}
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 36b44a9..557fe34 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -575,10 +575,14 @@ static int _vgchange_system_id(struct cmd_context *cmd, struct volume_group *vg)
vg->name, vg->system_id, system_id);
vg->system_id = system_id;
-
if (vg->lvm1_system_id)
*vg->lvm1_system_id = '\0';
+ if (vg->system_id && *vg->system_id)
+ vg->status |= ACCESS_NEEDS_SYSTEM_ID;
+ else
+ vg->status &= ~ACCESS_NEEDS_SYSTEM_ID;
+
return 1;
}
8 years, 7 months
master - systemid: Init and merge lvm2 and lvm1 fields.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3562b5ab39b32b...
Commit: 3562b5ab39b32bd27c81f57185e397facb7690f5
Parent: dcba4781eaa5545981a831c3c27374d3fce085fe
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Wed Mar 4 01:00:51 2015 +0000
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Wed Mar 4 01:00:51 2015 +0000
systemid: Init and merge lvm2 and lvm1 fields.
Use system_id field in preference to lvm1_system_id.
Initialise both for now.
---
lib/display/display.c | 2 +-
lib/format1/import-export.c | 4 +++-
lib/format_text/export.c | 4 +++-
lib/format_text/import_vsn1.c | 2 --
lib/metadata/vg.c | 5 +++++
lib/report/report.c | 2 +-
tools/toollib.c | 5 +++--
tools/vgchange.c | 3 +++
8 files changed, 19 insertions(+), 8 deletions(-)
diff --git a/lib/display/display.c b/lib/display/display.c
index b511b8e..cf3c7f6 100644
--- a/lib/display/display.c
+++ b/lib/display/display.c
@@ -695,7 +695,7 @@ void vgdisplay_full(const struct volume_group *vg)
log_print("--- Volume group ---");
log_print("VG Name %s", vg->name);
- log_print("System ID %s", vg->system_id);
+ log_print("System ID %s", (vg->system_id && *vg->system_id) ? vg->system_id : vg->lvm1_system_id ? : "");
log_print("Format %s", vg->fid->fmt->name);
if (vg->fid->fmt->features & FMT_MDAS) {
log_print("Metadata Areas %d",
diff --git a/lib/format1/import-export.c b/lib/format1/import-export.c
index 8155b04..9b387e2 100644
--- a/lib/format1/import-export.c
+++ b/lib/format1/import-export.c
@@ -156,8 +156,10 @@ int export_pv(struct cmd_context *cmd, struct dm_pool *mem __attribute__((unused
}
/* Preserve existing system_id if it exists */
- if (vg && *vg->lvm1_system_id)
+ if (vg && vg->lvm1_system_id && *vg->lvm1_system_id)
strncpy((char *)pvd->system_id, vg->lvm1_system_id, sizeof(pvd->system_id));
+ else if (vg && vg->system_id && *vg->system_id)
+ strncpy((char *)pvd->system_id, vg->system_id, sizeof(pvd->system_id));
/* Is VG already exported or being exported? */
if (vg && vg_is_exported(vg)) {
diff --git a/lib/format_text/export.c b/lib/format_text/export.c
index ddaaebb..8232e2f 100644
--- a/lib/format_text/export.c
+++ b/lib/format_text/export.c
@@ -414,9 +414,11 @@ static int _print_vg(struct formatter *f, struct volume_group *vg)
if (!_out_tags(f, &vg->tags))
return_0;
-
+
if (vg->system_id && *vg->system_id)
outf(f, "system_id = \"%s\"", vg->system_id);
+ else if (vg->lvm1_system_id && *vg->lvm1_system_id)
+ outf(f, "system_id = \"%s\"", vg->lvm1_system_id);
outsize(f, (uint64_t) vg->extent_size, "extent_size = %u",
vg->extent_size);
diff --git a/lib/format_text/import_vsn1.c b/lib/format_text/import_vsn1.c
index 366e61c..64c08a0 100644
--- a/lib/format_text/import_vsn1.c
+++ b/lib/format_text/import_vsn1.c
@@ -883,8 +883,6 @@ static struct volume_group *_read_vg(struct format_instance *fid,
dm_hash_destroy(pv_hash);
dm_hash_destroy(lv_hash);
- /* FIXME Determine format type from file contents */
- /* eg Set to instance of fmt1 here if reading a format1 backup? */
vg_set_fid(vg, fid);
/*
diff --git a/lib/metadata/vg.c b/lib/metadata/vg.c
index 2bed1ad..404cc6f 100644
--- a/lib/metadata/vg.c
+++ b/lib/metadata/vg.c
@@ -47,6 +47,8 @@ struct volume_group *alloc_vg(const char *pool_name, struct cmd_context *cmd,
return NULL;
}
+ vg->system_id = "";
+
vg->cmd = cmd;
vg->vgmem = vgmem;
vg->alloc = ALLOC_NORMAL;
@@ -627,6 +629,9 @@ int vg_set_system_id(struct volume_group *vg, const char *system_id)
return 0;
}
+ if (vg->lvm1_system_id)
+ *vg->lvm1_system_id = '\0';
+
return 1;
}
diff --git a/lib/report/report.c b/lib/report/report.c
index b5418e5..75928c0 100644
--- a/lib/report/report.c
+++ b/lib/report/report.c
@@ -989,7 +989,7 @@ static int _vgsystemid_disp(struct dm_report *rh, struct dm_pool *mem,
const void *data, void *private)
{
const struct volume_group *vg = (const struct volume_group *) data;
- const char *repstr = vg->system_id ? : vg->lvm1_system_id ? : "";
+ const char *repstr = (vg->system_id && *vg->system_id) ? vg->system_id : vg->lvm1_system_id ? : "";
return _string_disp(rh, mem, field, &repstr, private);
}
diff --git a/tools/toollib.c b/tools/toollib.c
index 19c23fe..12fe1e2 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -200,8 +200,9 @@ static int _ignore_vg(struct volume_group *vg, const char *vg_name,
*/
if (read_error & FAILED_SYSTEMID) {
if (arg_vgnames && str_list_match_item(arg_vgnames, vg->name)) {
- log_error("Cannot access VG %s with system ID %s with local system ID %s.",
- vg->name, vg->system_id, vg->cmd->system_id);
+ log_error("Cannot access VG %s with system ID %s with %slocal system ID%s%s.",
+ vg->name, vg->system_id, vg->cmd->system_id ? "" : "unknown ",
+ vg->cmd->system_id ? " " : "", vg->cmd->system_id ? vg->cmd->system_id : "");
return 1;
} else {
read_error &= ~FAILED_SYSTEMID; /* Check for other errors */
diff --git a/tools/vgchange.c b/tools/vgchange.c
index 3f97722..36b44a9 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -575,6 +575,9 @@ static int _vgchange_system_id(struct cmd_context *cmd, struct volume_group *vg)
vg->name, vg->system_id, system_id);
vg->system_id = system_id;
+
+ if (vg->lvm1_system_id)
+ *vg->lvm1_system_id = '\0';
return 1;
}
8 years, 7 months