Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
List overview
Download
lvm2-commits
September 2018
----- 2024 -----
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
lvm2-commits@lists.fedorahosted.org
4 participants
37 discussions
Start a n
N
ew thread
master - [radix-tree] Fix bug in _dump
by Joe Thornber
20 Sep '18
20 Sep '18
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0ac7913c6a43c5bcfbba7…
Commit: 0ac7913c6a43c5bcfbba735652041a0eae4180c6 Parent: abe2210c261223212435fbfd505842583ee1145a Author: Joe Thornber <ejt(a)redhat.com> AuthorDate: Thu Sep 20 14:18:57 2018 +0100 Committer: Joe Thornber <ejt(a)redhat.com> CommitterDate: Thu Sep 20 14:18:57 2018 +0100 [radix-tree] Fix bug in _dump Values in an n48 were not being printed in the correct order. --- base/data-struct/radix-tree-adaptive.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/base/data-struct/radix-tree-adaptive.c b/base/data-struct/radix-tree-adaptive.c index 233bebd..a657b2b 100644 --- a/base/data-struct/radix-tree-adaptive.c +++ b/base/data-struct/radix-tree-adaptive.c @@ -1260,9 +1260,10 @@ static void _dump(FILE *out, struct value v, unsigned indent) fprintf(out, "%x ", i); fprintf(out, ">\n"); - for (i = 0; i < 256; i++) - if (n48->keys[i] < 48) - _dump(out, n48->values[i], indent + 1); + for (i = 0; i < n48->nr_entries; i++) { + assert(n48->values[i].type != UNSET); + _dump(out, n48->values[i], indent + 1); + } break; case NODE256:
1
0
0
0
master - [radix-tree] Add some extra checks to is_well_formed()
by Joe Thornber
20 Sep '18
20 Sep '18
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=abe2210c261223212435f…
Commit: abe2210c261223212435fbfd505842583ee1145a Parent: fdb6ef8a85e9adc4805202b3200b17bd3b351982 Author: Joe Thornber <ejt(a)redhat.com> AuthorDate: Thu Sep 20 14:18:10 2018 +0100 Committer: Joe Thornber <ejt(a)redhat.com> CommitterDate: Thu Sep 20 14:18:10 2018 +0100 [radix-tree] Add some extra checks to is_well_formed() --- base/data-struct/radix-tree-adaptive.c | 26 ++++++++++++++++++++++++++ 1 files changed, 26 insertions(+), 0 deletions(-) diff --git a/base/data-struct/radix-tree-adaptive.c b/base/data-struct/radix-tree-adaptive.c index 1eef1f8..233bebd 100644 --- a/base/data-struct/radix-tree-adaptive.c +++ b/base/data-struct/radix-tree-adaptive.c @@ -1036,6 +1036,7 @@ void radix_tree_iterate(struct radix_tree *rt, uint8_t *kb, uint8_t *ke, static bool _check_nodes(struct value *v, unsigned *count) { + uint64_t bits; unsigned i, ncount; struct value_chain *vc; struct prefix_chain *pc; @@ -1090,22 +1091,47 @@ static bool _check_nodes(struct value *v, unsigned *count) return true; case NODE48: + bits = 0; n48 = v->value.ptr; ncount = 0; for (i = 0; i < 256; i++) { if (n48->keys[i] < 48) { + if (n48->keys[i] >= n48->nr_entries) { + fprintf(stderr, "referencing value past nr_entries (n48)\n"); + return false; + } + + if (bits & (1ull << n48->keys[i])) { + fprintf(stderr, "duplicate entry (n48) %u\n", (unsigned) n48->keys[i]); + return false; + } + bits = bits | (1ull << n48->keys[i]); ncount++; + if (!_check_nodes(n48->values + n48->keys[i], count)) return false; } } + for (i = 0; i < n48->nr_entries; i++) { + if (!(bits & (1ull << i))) { + fprintf(stderr, "not all values are referenced (n48)\n"); + return false; + } + } + if (ncount != n48->nr_entries) { fprintf(stderr, "incorrect number of entries in n48, n48->nr_entries = %u, actual = %u\n", n48->nr_entries, ncount); return false; } + for (i = 0; i < n48->nr_entries; i++) + if (n48->values[i].type == UNSET) { + fprintf(stderr, "value in UNSET (n48)\n"); + return false; + } + for (i = n48->nr_entries; i < 48; i++) if (n48->values[i].type != UNSET) { fprintf(stderr, "unused value is not UNSET (n48)\n");
1
0
0
0
master - tests: fix lvconvert-raid-reshape-linear_to_striped-single-type.sh
by Heinz Mauelshagen
19 Sep '18
19 Sep '18
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=945d13541e50a25f859e4…
Commit: 945d13541e50a25f859e471abea4d86f00ce0964 Parent: 41ef146dc3bf9bd2ecbcedb8c3cdbd2535149296 Author: Heinz Mauelshagen <heinzm(a)redhat.com> AuthorDate: Wed Sep 19 14:53:38 2018 +0200 Committer: Heinz Mauelshagen <heinzm(a)redhat.com> CommitterDate: Wed Sep 19 14:53:41 2018 +0200 tests: fix lvconvert-raid-reshape-linear_to_striped-single-type.sh Add errouneously removed VG creation back in. --- ...t-raid-reshape-linear_to_striped-single-type.sh | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/test/shell/lvconvert-raid-reshape-linear_to_striped-single-type.sh b/test/shell/lvconvert-raid-reshape-linear_to_striped-single-type.sh index c9c4321..6d49f54 100644 --- a/test/shell/lvconvert-raid-reshape-linear_to_striped-single-type.sh +++ b/test/shell/lvconvert-raid-reshape-linear_to_striped-single-type.sh @@ -20,6 +20,8 @@ aux lvmconf 'activation/raid_region_size = 512' which mkfs.ext4 || skip aux have_raid 1 14 0 || skip +aux prepare_vg 5 + # # Test multi step linear -> striped conversion #
1
0
0
0
master - radix-tree: default to simple version
by David Teigland
17 Sep '18
17 Sep '18
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=41ef146dc3bf9bd2ecbce…
Commit: 41ef146dc3bf9bd2ecbcedb8c3cdbd2535149296 Parent: fdb6ef8a85e9adc4805202b3200b17bd3b351982 Author: David Teigland <teigland(a)redhat.com> AuthorDate: Mon Sep 17 11:19:53 2018 -0500 Committer: David Teigland <teigland(a)redhat.com> CommitterDate: Mon Sep 17 11:19:53 2018 -0500 radix-tree: default to simple version Avoid problems with the advanced version. --- base/Makefile | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/base/Makefile b/base/Makefile index 1823c9b..ff77815 100644 --- a/base/Makefile +++ b/base/Makefile @@ -11,7 +11,8 @@ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA # Uncomment this to build the simple radix tree. You'll need to make clean too. -# base/data-struct/radix-tree.o: CFLAGS += -DSIMPLE_RADIX_TREE +# Comment to build the advanced radix tree. +base/data-struct/radix-tree.o: CFLAGS += -DSIMPLE_RADIX_TREE BASE_SOURCE=\ base/data-struct/radix-tree.c \
1
0
0
0
master - libdm: fix buffer overflow
by Marian Csontos
14 Sep '18
14 Sep '18
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fdb6ef8a85e9adc480520…
Commit: fdb6ef8a85e9adc4805202b3200b17bd3b351982 Parent: 0c00af776a27875ee5ffbf3ab2d3b73495ce8c52 Author: Marian Csontos <mcsontos(a)redhat.com> AuthorDate: Thu Jun 21 10:20:09 2018 +0200 Committer: Marian Csontos <mcsontos(a)redhat.com> CommitterDate: Fri Sep 14 16:57:22 2018 +0200 libdm: fix buffer overflow (cherry picked from commit 8a0af1bec882de66677e1a0cdceff841c39f92b0) --- libdm/libdm-common.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index 7c740d8..5099f91 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -1763,7 +1763,7 @@ static int _mountinfo_parse_line(const char *line, unsigned *maj, unsigned *min, return 0; } devmapper += 12; /* skip fixed prefix */ - for (i = 0; devmapper[i] && devmapper[i] != ' ' && i < sizeof(root); ++i) + for (i = 0; devmapper[i] && devmapper[i] != ' ' && i < sizeof(root)-1; ++i) root[i] = devmapper[i]; root[i] = 0; _unmangle_mountinfo_string(root, buf);
1
0
0
0
master - build: Update configure
by Marian Csontos
14 Sep '18
14 Sep '18
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0c00af776a27875ee5ffb…
Commit: 0c00af776a27875ee5ffbf3ab2d3b73495ce8c52 Parent: ccb08dfa1d6828c494882030ef181d7fdf38cb0b Author: Marian Csontos <mcsontos(a)redhat.com> AuthorDate: Fri Sep 14 13:53:29 2018 +0200 Committer: Marian Csontos <mcsontos(a)redhat.com> CommitterDate: Fri Sep 14 13:53:29 2018 +0200 build: Update configure --- configure | 6 +++--- include/configure.h.in | 9 --------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/configure b/configure index d6ddbc2..3e1d5d7 100755 --- a/configure +++ b/configure @@ -13769,7 +13769,7 @@ _ACEOF ################################################################################ -ac_config_files="$ac_config_files Makefile make.tmpl libdm/make.tmpl daemons/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/dmeventd/plugins/vdo/Makefile daemons/lvmdbusd/Makefile daemons/lvmdbusd/lvmdbusd daemons/lvmdbusd/lvmdb.py daemons/lvmdbusd/lvm_shell_proxy.py daemons/lvmdbusd/path.py daemons/lvmpolld/Makefile daemons/lvmlockd/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/Makefile lib/Makefile include/lvm-version.h libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/dm-tools/Makefile libdm/libdevmapper.pc man/Makefile po/Makefile scripts/blkdeactiva te.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/cmirrord_init_red_hat scripts/com.redhat.lvmdbus1.service scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmdbusd_systemd_red_hat.service scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_lvmlockd_systemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile test/Makefile tools/Makefile udev/Makefile" +ac_config_files="$ac_config_files Makefile make.tmpl libdm/make.tmpl daemons/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/dmeventd/plugins/vdo/Makefile daemons/lvmdbusd/Makefile daemons/lvmdbusd/lvmdbusd daemons/lvmdbusd/lvmdb.py daemons/lvmdbusd/lvm_shell_proxy.py daemons/lvmdbusd/path.py daemons/lvmpolld/Makefile daemons/lvmlockd/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/Makefile lib/Makefile include/lvm-version.h libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/dm-tools/Makefile libdm/libdevmapper.pc man/Makefile po/Makefile scripts/blkdeactiva te.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/cmirrord_init_red_hat scripts/com.redhat.lvmdbus1.service scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmdbusd_systemd_red_hat.service scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvmlockd.service scripts/lvmlocks.service scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile test/Makefile tools/Makefile udev/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -14513,10 +14513,10 @@ do "scripts/lvm2_lvmpolld_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_init_red_hat" ;; "scripts/lvm2_lvmpolld_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_systemd_red_hat.service" ;; "scripts/lvm2_lvmpolld_systemd_red_hat.socket") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_systemd_red_hat.socket" ;; - "scripts/lvm2_lvmlockd_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmlockd_systemd_red_hat.service" ;; + "scripts/lvmlockd.service") CONFIG_FILES="$CONFIG_FILES scripts/lvmlockd.service" ;; + "scripts/lvmlocks.service") CONFIG_FILES="$CONFIG_FILES scripts/lvmlocks.service" ;; "scripts/lvm2_monitoring_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_monitoring_init_red_hat" ;; "scripts/lvm2_monitoring_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_monitoring_systemd_red_hat.service" ;; - "scripts/lvm2_pvscan_systemd_red_hat@.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_pvscan_systemd_red_hat@.service" ;; "scripts/lvm2_tmpfiles_red_hat.conf") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_tmpfiles_red_hat.conf" ;; "scripts/lvmdump.sh") CONFIG_FILES="$CONFIG_FILES scripts/lvmdump.sh" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; diff --git a/include/configure.h.in b/include/configure.h.in index f68b092..3721844 100644 --- a/include/configure.h.in +++ b/include/configure.h.in @@ -90,9 +90,6 @@ /* Use blkid wiping by default. */ #undef DEFAULT_USE_BLKID_WIPING -/* Use lvmetad by default. */ -#undef DEFAULT_USE_LVMETAD - /* Use lvmlockd by default. */ #undef DEFAULT_USE_LVMLOCKD @@ -550,12 +547,6 @@ /* Path to lvmconfig binary. */ #undef LVMCONFIG_PATH -/* Path to lvmetad pidfile. */ -#undef LVMETAD_PIDFILE - -/* Define to 1 to include code that uses lvmetad. */ -#undef LVMETAD_SUPPORT - /* Path to lvmlockd pidfile. */ #undef LVMLOCKD_PIDFILE
1
0
0
0
master - spec: Remove lvmconf refernces
by Marian Csontos
14 Sep '18
14 Sep '18
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ccb08dfa1d6828c494882…
Commit: ccb08dfa1d6828c494882030ef181d7fdf38cb0b Parent: 19a59cc53c723f3614d68edcdd9dfabe15c1299b Author: Marian Csontos <mcsontos(a)redhat.com> AuthorDate: Fri Sep 14 13:49:51 2018 +0200 Committer: Marian Csontos <mcsontos(a)redhat.com> CommitterDate: Fri Sep 14 13:49:51 2018 +0200 spec: Remove lvmconf refernces Fixes: 81ca0cb1619b6ea22fa68f54783cd62dafbd2eaf --- spec/packages.inc | 2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/spec/packages.inc b/spec/packages.inc index 4049f27..67a521d 100644 --- a/spec/packages.inc +++ b/spec/packages.inc @@ -41,7 +41,6 @@ fi %{_sbindir}/lvdisplay %{_sbindir}/lvextend %{_sbindir}/lvm -%{_sbindir}/lvmconf %{_sbindir}/lvmconfig %{_sbindir}/lvmdiskscan %{_sbindir}/lvmdump @@ -99,7 +98,6 @@ fi %{_mandir}/man8/lvm-dumpconfig.8.gz %{_mandir}/man8/lvm.8.gz %{_mandir}/man8/lvm2-activation-generator.8.gz -%{_mandir}/man8/lvmconf.8.gz %{_mandir}/man8/lvmconfig.8.gz %{_mandir}/man8/lvmdiskscan.8.gz %{_mandir}/man8/lvmdump.8.gz
1
0
0
0
master - More cleanup needed for dropped scripts
by David Teigland
13 Sep '18
13 Sep '18
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=19a59cc53c723f3614d68…
Commit: 19a59cc53c723f3614d68edcdd9dfabe15c1299b Parent: e9b6cdd6e65196d6ada6ce54e8d256c3dc57329b Author: David Teigland <teigland(a)redhat.com> AuthorDate: Thu Sep 13 11:02:53 2018 -0500 Committer: David Teigland <teigland(a)redhat.com> CommitterDate: Thu Sep 13 11:09:25 2018 -0500 More cleanup needed for dropped scripts and drop the lvm2 prefix from lvmlockd service --- configure.ac | 4 +- man/Makefile.in | 2 +- man/lvmconf.8_main | 70 ---------------------- man/lvmlockd.8_main | 2 +- scripts/Makefile.in | 8 ++- scripts/lvm2_lvmlockd_systemd_red_hat.service.in | 13 ---- scripts/lvmlockd.service.in | 13 ++++ scripts/lvmlocks.service.in | 2 +- spec/packages.inc | 3 +- 9 files changed, 25 insertions(+), 92 deletions(-) diff --git a/configure.ac b/configure.ac index 6d9308f..32cd921 100644 --- a/configure.ac +++ b/configure.ac @@ -1819,10 +1819,10 @@ scripts/lvm2_lvmdbusd_systemd_red_hat.service scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket -scripts/lvm2_lvmlockd_systemd_red_hat.service +scripts/lvmlockd.service +scripts/lvmlocks.service scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service -scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/lvmdump.sh scripts/Makefile diff --git a/man/Makefile.in b/man/Makefile.in index aefda2d..6d5e2ac 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -37,7 +37,7 @@ LVMRAIDMAN = lvmraid.7 MAN5=lvm.conf.5 MAN7=lvmsystemid.7 lvmreport.7 -MAN8=lvm.8 lvmconf.8 lvmdump.8 lvm-fullreport.8 lvm-lvpoll.8 \ +MAN8=lvm.8 lvmdump.8 lvm-fullreport.8 lvm-lvpoll.8 \ lvcreate.8 lvchange.8 lvmconfig.8 lvconvert.8 lvdisplay.8 \ lvextend.8 lvreduce.8 lvremove.8 lvrename.8 lvresize.8 lvs.8 \ lvscan.8 pvchange.8 pvck.8 pvcreate.8 pvdisplay.8 pvmove.8 pvremove.8 \ diff --git a/man/lvmconf.8_main b/man/lvmconf.8_main deleted file mode 100644 index ca66ae6..0000000 --- a/man/lvmconf.8_main +++ /dev/null @@ -1,70 +0,0 @@ -.TH "LVMCONF" "8" "LVM TOOLS #VERSION#" "Red Hat, Inc" "\"" - -.SH "NAME" -lvmconf \(em LVM configuration modifier -.SH "SYNOPSIS" -.B lvmconf -.RB [ --disable-cluster ] -.RB [ --enable-cluster ] -.RB [ --enable-halvm ] -.RB [ --disable-halvm ] -.RB [ --file -.RI < configfile >] -.RB [ --lockinglib -.RI < lib >] -.RB [ --lockinglibdir -.RI < dir >] -.RB [ --services ] -.RB [ --mirrorservice ] -.RB [ --startstopservices ] - -.SH "DESCRIPTION" -lvmconf is a script that modifies the locking configuration in -an lvm configuration file. See \fBlvm.conf\fP(5). In addition -to that, it can also set Systemd or SysV services according to -changes in the lvm configuration if needed. - -.SH "OPTIONS" -.TP -.BR --disable-cluster -Set \fBlocking_type\fR to the default non-clustered type. Also reset -lvmetad use to its default. -.TP -.BR --enable-cluster -Set \fBlocking_type\fR to the default clustered type on this system. -Also disable lvmetad use as it is not yet supported in clustered environment. -.TP -.BR --disable-halvm -Set \fBlocking_type\fR to the default non-clustered type. Also reset -lvmetad use to its default. -.TP -.BR --enable-halvm -Set \fBlocking_type\fR suitable for HA LVM use. -Also disable lvmetad use as it is not yet supported in HA LVM environment. -.TP -.BR --file " <" \fIconfigfile > -Apply the changes to \fIconfigfile\fP instead of the default -\fI#DEFAULT_SYS_DIR#/lvm.conf\fP. -.TP -.BR --lockinglib " <" \fIlib > -Set external \fBlocking_library\fR locking library to load if an external locking type is used. -.TP -.BR --lockinglibdir " <" \fIdir > -.TP -.BR --services -In addition to setting the lvm configuration, also enable or disable related Systemd or SysV -clvmd and lvmetad services. This script does not configure services provided by cluster resource -agents. -.TP -.BR --mirrorservice -Also enable or disable optional cmirrord service when handling services (applicable only with --services). -.TP -.BR --startstopservices -In addition to enabling or disabling related services, start or stop them immediately -(applicable only with --services). -.SH FILES -.I #DEFAULT_SYS_DIR#/lvm.conf - -.SH "SEE ALSO" -.BR lvm (8), -.BR lvm.conf (5) diff --git a/man/lvmlockd.8_main b/man/lvmlockd.8_main index cfb45b2..1a52fc5 100644 --- a/man/lvmlockd.8_main +++ b/man/lvmlockd.8_main @@ -121,7 +121,7 @@ Start the lvmlockd daemon. .br Use systemctl, a cluster resource agent, or run directly, e.g. .br -systemctl start lvm2-lvmlockd +systemctl start lvmlockd .SS 4. start lock manager diff --git a/scripts/Makefile.in b/scripts/Makefile.in index 6d32b63..039cac2 100644 --- a/scripts/Makefile.in +++ b/scripts/Makefile.in @@ -24,7 +24,7 @@ ifeq ("@BUILD_DMEVENTD@", "yes") LDFLAGS += -Wl,-rpath-link,$(top_builddir)/daemons/dmeventd endif -LVM_SCRIPTS = lvmdump.sh lvmconf.sh +LVM_SCRIPTS = lvmdump.sh DM_SCRIPTS = ifeq ("@FSADM@", "yes") @@ -105,7 +105,8 @@ ifeq ("@BUILD_LVMPOLLD@", "yes") $(INSTALL_DATA) lvm2_lvmpolld_systemd_red_hat.service $(systemd_unit_dir)/lvm2-lvmpolld.service endif ifeq ("@BUILD_LVMLOCKD@", "yes") - $(INSTALL_DATA) lvm2_lvmlockd_systemd_red_hat.service $(systemd_unit_dir)/lvm2-lvmlockd.service + $(INSTALL_DATA) lvmlockd.service $(systemd_unit_dir)/lvmlockd.service + $(INSTALL_DATA) lvmlocks.service $(systemd_unit_dir)/lvmlocks.service endif ifeq ("@BUILD_CMIRRORD@", "yes") $(INSTALL_DATA) lvm2_cmirrord_systemd_red_hat.service $(systemd_unit_dir)/lvm2-cmirrord.service @@ -149,7 +150,8 @@ DISTCLEAN_TARGETS += \ lvm2_lvmetad_systemd_red_hat.socket \ lvm2_lvmpolld_systemd_red_hat.service \ lvm2_lvmpolld_systemd_red_hat.socket \ - lvm2_lvmlockd_systemd_red_hat.service \ + lvmlockd.service \ + lvmlocks.service \ lvm2_monitoring_init_red_hat \ lvm2_monitoring_systemd_red_hat.service \ lvm2_pvscan_systemd_red_hat@.service \ diff --git a/scripts/lvm2_lvmlockd_systemd_red_hat.service.in b/scripts/lvm2_lvmlockd_systemd_red_hat.service.in deleted file mode 100644 index efe489a..0000000 --- a/scripts/lvm2_lvmlockd_systemd_red_hat.service.in +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=LVM lock daemon -Documentation=man:lvmlockd(8) - -[Service] -Type=notify -ExecStart=@SBINDIR@/lvmlockd --foreground -PIDFile=@LVMLOCKD_PIDFILE@ -SendSIGKILL=no - -[Install] -WantedBy=multi-user.target - diff --git a/scripts/lvmlockd.service.in b/scripts/lvmlockd.service.in new file mode 100644 index 0000000..efe489a --- /dev/null +++ b/scripts/lvmlockd.service.in @@ -0,0 +1,13 @@ +[Unit] +Description=LVM lock daemon +Documentation=man:lvmlockd(8) + +[Service] +Type=notify +ExecStart=@SBINDIR@/lvmlockd --foreground +PIDFile=@LVMLOCKD_PIDFILE@ +SendSIGKILL=no + +[Install] +WantedBy=multi-user.target + diff --git a/scripts/lvmlocks.service.in b/scripts/lvmlocks.service.in index 79598db..f6a951f 100644 --- a/scripts/lvmlocks.service.in +++ b/scripts/lvmlocks.service.in @@ -1,7 +1,7 @@ [Unit] Description=LVM locking start and stop Documentation=man:lvmlockd(8) -After=lvm2-lvmlockd.service sanlock.service dlm.service +After=lvmlockd.service sanlock.service dlm.service [Service] Type=oneshot diff --git a/spec/packages.inc b/spec/packages.inc index 38f90ec..4049f27 100644 --- a/spec/packages.inc +++ b/spec/packages.inc @@ -285,7 +285,8 @@ fi %{_mandir}/man8/lvmlockd.8.gz %{_mandir}/man8/lvmlockctl.8.gz %dir %{_default_locking_dir} -%{_unitdir}/lvm2-lvmlockd.service +%{_unitdir}/lvmlockd.service +%{_unitdir}/lvmlocks.service %endif ##############################################################################
1
0
0
0
master - add lvmlocks service to start and stop lockspaces
by David Teigland
13 Sep '18
13 Sep '18
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e9b6cdd6e65196d6ada6c…
Commit: e9b6cdd6e65196d6ada6ce54e8d256c3dc57329b Parent: 81ca0cb1619b6ea22fa68f54783cd62dafbd2eaf Author: David Teigland <teigland(a)redhat.com> AuthorDate: Thu Sep 13 10:50:50 2018 -0500 Committer: David Teigland <teigland(a)redhat.com> CommitterDate: Thu Sep 13 10:50:50 2018 -0500 add lvmlocks service to start and stop lockspaces --- scripts/lvmlocks.service.in | 18 ++++++++++++++++++ 1 files changed, 18 insertions(+), 0 deletions(-) diff --git a/scripts/lvmlocks.service.in b/scripts/lvmlocks.service.in new file mode 100644 index 0000000..79598db --- /dev/null +++ b/scripts/lvmlocks.service.in @@ -0,0 +1,18 @@ +[Unit] +Description=LVM locking start and stop +Documentation=man:lvmlockd(8) +After=lvm2-lvmlockd.service sanlock.service dlm.service + +[Service] +Type=oneshot +RemainAfterExit=yes + +# start lockspaces and wait for them to finish starting +ExecStart=@SBINDIR@/lvm vgchange --lock-start --lock-opt autowait + +# stop lockspaces and wait for them to finish stopping +ExecStop=@SBINDIR@/lvmlockctl --stop-lockspaces --wait 1 + +[Install] +WantedBy=multi-user.target +
1
0
0
0
master - Remove init scripts related to clvm and lvmetad
by David Teigland
13 Sep '18
13 Sep '18
Gitweb:
https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=81ca0cb1619b6ea22fa68…
Commit: 81ca0cb1619b6ea22fa68f54783cd62dafbd2eaf Parent: 297f6d51228d0f0d5debca9e95785f3623e0ef9d Author: David Teigland <teigland(a)redhat.com> AuthorDate: Thu Sep 13 10:08:03 2018 -0500 Committer: David Teigland <teigland(a)redhat.com> CommitterDate: Thu Sep 13 10:08:03 2018 -0500 Remove init scripts related to clvm and lvmetad --- scripts/clvmd_fix_conf.sh | 161 ------- scripts/clvmd_init_red_hat.in | 214 --------- scripts/lvm2_cluster_activation_red_hat.sh.in | 62 --- ...2_cluster_activation_systemd_red_hat.service.in | 17 - scripts/lvm2_clvmd_systemd_red_hat.service.in | 23 - scripts/lvm2_lvmetad_init_red_hat.in | 110 ----- scripts/lvm2_lvmetad_systemd_red_hat.service.in | 15 - scripts/lvm2_lvmetad_systemd_red_hat.socket.in | 13 - scripts/lvm2_pvscan_systemd_red_hat@.service.in | 16 - scripts/lvmconf.sh | 459 -------------------- scripts/lvmconf_lockingtype2.sh | 259 ----------- 11 files changed, 0 insertions(+), 1349 deletions(-) diff --git a/scripts/clvmd_fix_conf.sh b/scripts/clvmd_fix_conf.sh deleted file mode 100644 index 5716d06..0000000 --- a/scripts/clvmd_fix_conf.sh +++ /dev/null @@ -1,161 +0,0 @@ -#!/bin/bash -# -# Edit an lvm.conf file to enable cluster locking. -# -# $1 is the directory where the locking library is installed. -# $2 (optional) is the config file -# $3 (optional) is the locking library name -# -# -PREFIX=$1 -LVMCONF=$2 -LIB=$3 - -if [ -z "$PREFIX" ] -then - echo "usage: $0 <prefix> [<config file>] [<library>]" - echo "" - echo "<prefix>|UNDO location of the cluster locking shared library. (no default)" - echo " UNDO will reset the locking back to local" - echo "<config file> name of the LVM config file (default: /etc/lvm/lvm.conf)" - echo "<library> name of the shared library (default: liblvm2clusterlock.so)" - echo "" - exit 0 -fi - -[ -z "$LVMCONF" ] && LVMCONF="/etc/lvm/lvm.conf" -[ -z "$LIB" ] && LIB="liblvm2clusterlock.so" - -if [ "$PREFIX" = "UNDO" ] -then - locking_type="1" -else - locking_type="2" - - if [ "${PREFIX:0:1}" != "/" ] - then - echo "Prefix must be an absolute path name (starting with a /)" - exit 12 - fi - - if [ ! -f "$PREFIX/$LIB" ] - then - echo "$PREFIX/$LIB does not exist, did you do a \"make install\" ?" - exit 11 - fi -fi - -if [ ! -f "$LVMCONF" ] -then - echo "$LVMCONF does not exist" - exit 10 -fi - - -SCRIPTFILE=$(mktemp -t lvmscript.XXXXXXXXXX) -TMPFILE=$(mktemp -t lvmtmp.XXXXXXXXXX) - - -# Flags so we know which parts of the file we can replace and which need -# adding. These are return codes from grep, so zero means it IS present! -have_type=1 -have_dir=1 -have_library=1 -have_global=1 - -grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' "$LVMCONF" -have_type=$? - -grep -q '^[[:blank:]]*library_dir[[:blank:]]*=' "$LVMCONF" -have_dir=$? - -grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' "$LVMCONF" -have_library=$? - -# Those options are in section "global {" so we must have one if any are present. -if [ "$have_type" = 0 ] || [ "$have_dir" = 0 ] || [ "$have_library" = 0 ] ; then - - # See if we can find it... - grep -q '^[[:blank:]]*global[[:blank:]]*{' "$LVMCONF" - have_global=$? - - if [ "$have_global" = "1" ] - then - echo "global keys but no 'global {' found, can't edit file" - exit 12 - fi -fi - -# So if we don't have "global {" we need to create one and -# populate it - -if [ "$have_global" = "1" ] -then - cat "$LVMCONF" - <<EOF > "$TMPFILE" -global { - # Enable locking for cluster LVM - locking_type = $locking_type - library_dir = "$PREFIX" - locking_library = "$LIB" -} -EOF - if [ $? != 0 ] - then - echo "failed to create temporary config file, $LVMCONF not updated" - exit 1 - fi -else - # - # We have a "global {" section, so add or replace the - # locking entries as appropriate - # - - if [ "$have_type" = "0" ] - then - SEDCMD=" s/^[[:blank:]]*locking_type[[:blank:]]*=.*/\ \ \ \ locking_type = $locking_type/g" - else - SEDCMD=" /global[[:blank:]]*{/a\ \ \ \ locking_type = 2" - fi - - if [ "$have_dir" = "0" ] - then - SEDCMD="${SEDCMD}\ns'^[[:blank:]]*library_dir[[:blank:]]*=.*'\ \ \ \ library_dir = \"$PREFIX\"'g" - else - SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ library_dir = \"$PREFIX\"" - fi - - if [ "$have_library" = "0" ] - then - SEDCMD="${SEDCMD}\ns/^[[:blank:]]*locking_library[[:blank:]]*=.*/\ \ \ \ locking_library = \"$LIB\"/g" - else - SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ locking_library = \"$LIB\"" - fi - - echo -e "$SEDCMD" > "$SCRIPTFILE" - sed <"$LVMCONF" >"$TMPFILE" -f "$SCRIPTFILE" - if [ $? != 0 ] - then - echo "sed failed, $LVMCONF not updated" - exit 1 - fi -fi - -# Now we have a suitably editted config file in a temp place, -# backup the original and copy our new one into place. - -cp "$LVMCONF" "$LVMCONF.nocluster" -if [ $? != 0 ] - then - echo "failed to backup old config file, $LVMCONF not updated" - exit 2 -fi - -cp "$TMPFILE" "$LVMCONF" -if [ $? != 0 ] - then - echo "failed to copy new config file into place, check $LVMCONF is still OK" - exit 3 -fi - -rm -f "$SCRIPTFILE" "$TMPFILE" - diff --git a/scripts/clvmd_init_red_hat.in b/scripts/clvmd_init_red_hat.in deleted file mode 100644 index fff7912..0000000 --- a/scripts/clvmd_init_red_hat.in +++ /dev/null @@ -1,214 +0,0 @@ -#!/bin/bash -# -# clvmd - Clustered LVM Daemon init script -# -# chkconfig: - 24 76 -# description: Cluster daemon for userland logical volume management tools. -# pidfile: @CLVMD_PIDFILE@ -# -# For Red-Hat-based distributions such as Fedora, RHEL, CentOS. -# -### BEGIN INIT INFO -# Provides: clvmd -# Required-Start: $local_fs@CLVMD_CMANAGERS@ -# Required-Stop: $local_fs@CLVMD_CMANAGERS@ -# Short-Description: This service is Clusterd LVM Daemon. -# Description: Cluster daemon for userland logical volume management tools. -### END INIT INFO - -. /etc/rc.d/init.d/functions - -DAEMON=clvmd - -sbindir="@SBINDIR@" -usrsbindir="@USRSBINDIR@" - -lvm_vgchange="$sbindir/vgchange" -lvm_vgs="$sbindir/vgs" -lvm_vgscan="$sbindir/vgscan" -lvm_lvs="$sbindir/lvs" - -CLVMDOPTS="-T30" - -[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster -[ -f "/etc/sysconfig/$DAEMON" ] && . "/etc/sysconfig/$DAEMON" - -[ -n "$CLVMD_CLUSTER_IFACE" ] && CLVMDOPTS="$CLVMDOPTS -I $CLVMD_CLUSTER_IFACE" - -# allow up to $CLVMD_STOP_TIMEOUT seconds to clvmd to complete exit operations -# default to 10 seconds - -[ -z $CLVMD_STOP_TIMEOUT ] && CLVMD_STOP_TIMEOUT=10 - -LOCK_FILE="/var/lock/subsys/$DAEMON" - -clustered_vgs() { - "$lvm_vgs" --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null -} - -clustered_active_lvs() { - "$lvm_lvs" --noheadings -o lv_name -S 'vg_clustered=1 && lv_active!=""' 2>/dev/null -} - -rh_status() { - status "$DAEMON" -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -start() -{ - if ! rh_status_q; then - echo -n "Starting $DAEMON: " - "$usrsbindir/$DAEMON" $CLVMDOPTS || return $? - echo - fi - - # Refresh local cache. - # - # It's possible that new PVs were added to this, or other VGs - # while this node was down. So we run vgscan here to avoid - # any potential "Missing UUID" messages with subsequent - # LVM commands. - - # The following step would be better and more informative to the user: - # 'action "Refreshing VG(s) local cache:" ${lvm_vgscan}' - # but it could show warnings such as: - # 'clvmd not running on node x-y-z Unable to obtain global lock.' - # and the action would be shown as FAILED when in reality it didn't. - # Ideally vgscan should have a startup mode that would not print - # unnecessary warnings. - - "$lvm_vgscan" > /dev/null 2>&1 - - action "Activating VG(s):" "$lvm_vgchange" -aay $LVM_VGS || return $? - - touch "$LOCK_FILE" - - return 0 -} - -wait_for_finish() -{ - count=0 - while [ "$count" -le "$CLVMD_STOP_TIMEOUT" ] && \ - rh_status_q ]; do - sleep 1 - count=$((count+1)) - done - - ! rh_status_q -} - -stop() -{ - rh_status_q || return 0 - - [ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)" - if [ -n "$LVM_VGS" ]; then - action "Deactivating clustered VG(s):" "$lvm_vgchange" -anl $LVM_VGS || return $? - fi - - action "Signaling $DAEMON to exit" kill -TERM "$(pidofproc "$DAEMON")" || return $? - - # wait half second before we start the waiting loop or we will show - # the loop more time than really necessary - usleep 500000 - - # clvmd could take some time to stop - rh_status_q && action "Waiting for $DAEMON to exit:" wait_for_finish - - if rh_status_q; then - echo -n "$DAEMON failed to exit" - failure - echo - return 1 - else - echo -n "$DAEMON terminated" - success - echo - fi - - rm -f "$LOCK_FILE" - - return 0 -} - -reload() { - rh_status_q || exit 7 - action "Reloading $DAEMON configuration: " "$usrsbindir/$DAEMON" -R || return $? -} - -restart() { - # if stop fails, restart will return the error and not attempt - # another start. Even if start is protected by rh_status_q, - # that would avoid spawning another daemon, it would try to - # reactivate the VGs. - - # Try to get clvmd to restart itself. This will preserve - # exclusive LV locks - action "Restarting $DAEMON: " "$usrsbindir/$DAEMON" -S - - # If that fails then do a normal stop & restart - if [ $? != 0 ]; then - stop && start - return $? - else - touch "$LOCK_FILE" - return 0 - fi -} - -[ "$EUID" != "0" ] && { - echo "clvmd init script can only be executed as root user" - exit 4 -} - -# See how we were called. -case "$1" in - start) - start - rtrn=$? - ;; - - stop) - stop - rtrn=$? - ;; - - restart|force-reload) - restart - rtrn=$? - ;; - - condrestart|try-restart) - rh_status_q || exit 0 - restart - rtrn=$? - ;; - - reload) - reload - rtrn=$? - ;; - - status) - rh_status - rtrn=$? - if [ "$rtrn" = 0 ]; then - cvgs="$(clustered_vgs)" - echo Clustered Volume Groups: ${cvgs:-"(none)"} - clvs="$(clustered_active_lvs)" - echo Active clustered Logical Volumes: ${clvs:-"(none)"} - fi - ;; - - *) - echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}" - rtrn=2 - ;; -esac - -exit $rtrn diff --git a/scripts/lvm2_cluster_activation_red_hat.sh.in b/scripts/lvm2_cluster_activation_red_hat.sh.in deleted file mode 100644 index e600745..0000000 --- a/scripts/lvm2_cluster_activation_red_hat.sh.in +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/bash - -sbindir="@SBINDIR@" - -lvm_vgchange="$sbindir/vgchange" -lvm_vgscan="$sbindir/vgscan" -lvm_vgs="$sbindir/vgs" -lvm_lvm="$sbindir/lvm" - -clustered_vgs() { - "$lvm_vgs" --noheadings -o vg_name -S 'vg_clustered=1' 2>/dev/null -} - -activate() { - eval local "$("${lvm_lvm}" dumpconfig devices/obtain_device_list_from_udev 2>/dev/null)" 2>/dev/null - if [ $? -ne 0 ]; then - echo "Warning: expected single couple of key=value in output of dumpconfig" - fi - - if [ -z "$obtain_device_list_from_udev" ] || [ "$obtain_device_list_from_udev" -ne 1 ]; then - echo -n "lvm.conf option obtain_device_list_from_udev!=1: Executing vgscan" - "$lvm_vgscan" > /dev/null 2>&1 - fi - - echo -n "Activating ${LVM_VGS:-"all VG(s)"}: " - # Respect activation/auto_activation_volume_list! - # Call "-aay" which is equal to "-aly" but respects this list. - "$lvm_vgchange" -aay $LVM_VGS || return 1 - - return 0 -} - -deactivate() -{ - # NOTE: following section will be replaced by blkdeactivate script - # with option supporting request to deactivate all clustered volume - # groups in the system - [ -z "$LVM_VGS" ] && LVM_VGS="$(clustered_vgs)" - if [ -n "$LVM_VGS" ]; then - echo -n "Deactivating clustered VG(s): " - "$lvm_vgchange" -anl $LVM_VGS || return 1 - fi - - return 0 -} - -case "$1" in - deactivate) - deactivate - rtrn=$? - ;; - activate) - activate - rtrn=$? - ;; - *) - echo $"Usage: $0 {activate|deactivate}" - rtrn=3 - ;; -esac - -exit "$rtrn" diff --git a/scripts/lvm2_cluster_activation_systemd_red_hat.service.in b/scripts/lvm2_cluster_activation_systemd_red_hat.service.in deleted file mode 100644 index bf4aa1e..0000000 --- a/scripts/lvm2_cluster_activation_systemd_red_hat.service.in +++ /dev/null @@ -1,17 +0,0 @@ -[Unit] -Description=Clustered LVM volumes activation service -Requires=lvm2-clvmd.service -After=lvm2-clvmd.service lvm2-cmirrord.service -OnFailure=lvm2-clvmd.service -DefaultDependencies=no -Conflicts=shutdown.target - -[Service] -Type=simple -RemainAfterExit=yes -EnvironmentFile=-@SYSCONFDIR@/sysconfig/clvmd -ExecStart=@systemdutildir@/lvm2-cluster-activation activate -ExecStop=@systemdutildir@/lvm2-cluster-activation deactivate - -[Install] -WantedBy=multi-user.target diff --git a/scripts/lvm2_clvmd_systemd_red_hat.service.in b/scripts/lvm2_clvmd_systemd_red_hat.service.in deleted file mode 100644 index ced2774..0000000 --- a/scripts/lvm2_clvmd_systemd_red_hat.service.in +++ /dev/null @@ -1,23 +0,0 @@ -[Unit] -Description=Clustered LVM daemon -Documentation=man:clvmd(8) -After=dlm.service corosync.service -Before=remote-fs-pre.target -Requires=network.target dlm.service corosync.service -RefuseManualStart=true -RefuseManualStop=true -StopWhenUnneeded=true -DefaultDependencies=no -Conflicts=shutdown.target - -[Service] -Type=forking -Environment=CLVMD_OPTS=-T30 -EnvironmentFile=-@SYSCONFDIR@/sysconfig/clvmd -ExecStart=@USRSBINDIR@/clvmd $CLVMD_OPTS -SuccessExitStatus=5 -TimeoutStartSec=30 -TimeoutStopSec=10 -OOMScoreAdjust=-1000 -Restart=on-abort -PIDFile=@CLVMD_PIDFILE@ diff --git a/scripts/lvm2_lvmetad_init_red_hat.in b/scripts/lvm2_lvmetad_init_red_hat.in deleted file mode 100644 index daec7ac..0000000 --- a/scripts/lvm2_lvmetad_init_red_hat.in +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2012-2017 Red Hat, Inc. All rights reserved. -# -# This copyrighted material is made available to anyone wishing to use, -# modify, copy, or redistribute it subject to the terms and conditions -# of the GNU General Public License v.2. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -# -# This file is part of LVM2. -# It is required for the proper handling of failures of LVM2 mirror -# devices that were created using the -m option of lvcreate. -# -# -# chkconfig: 12345 02 99 -# description: Starts and stops LVM metadata daemon -# -# For Red-Hat-based distributions such as Fedora, RHEL, CentOS. -# -### BEGIN INIT INFO -# Provides: lvm2-lvmetad -# Required-Start: $local_fs -# Required-Stop: $local_fs -# Default-Start: 1 2 3 4 5 -# Default-Stop: 0 6 -# Short-Description: A daemon that maintains LVM metadata state for improved -# performance by avoiding further scans while running -# subsequent LVM commands or while using lvm2app library. -### END INIT INFO - -. /etc/init.d/functions - -DAEMON=lvmetad - -sbindir="@SBINDIR@" - -LOCK_FILE="@DEFAULT_SYS_LOCK_DIR@/subsys/$DAEMON" -PID_FILE="@LVMETAD_PIDFILE@" - -rh_status() { - status -p "$PID_FILE" "$DAEMON" -} - -rh_status_q() { - rh_status >/dev/null 2>&1 -} - -start() -{ - ret=0 - action "Starting LVM metadata daemon:" "$sbindir/$DAEMON" || ret=$? - return $ret -} - -stop() -{ - ret=0 - action "Signaling LVM metadata daemon to exit:" killproc -p "$PID_FILE" "$DAEMON" -TERM || ret=$? - return $ret -} - -rtrn=1 - -# See how we were called. -case "$1" in - start) - rh_status_q && exit 0 - start - rtrn=$? - [ "$rtrn" = 0 ] && touch "$LOCK_FILE" - ;; - - stop|force-stop) - rh_status_q || exit 0 - stop - rtrn=$? - [ "$rtrn" = 0 ] && rm -f "$LOCK_FILE" - ;; - - restart) - if stop - then - start - fi - rtrn=$? - ;; - - condrestart|try-restart) - rh_status_q || exit 0 - if stop - then - start - fi - rtrn=$? - ;; - - status) - rh_status - rtrn=$? - ;; - - *) - echo $"Usage: $0 {start|stop|force-stop|restart|condrestart|try-restart|status}" - ;; -esac - -exit $rtrn diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.service.in b/scripts/lvm2_lvmetad_systemd_red_hat.service.in deleted file mode 100644 index 92e6d69..0000000 --- a/scripts/lvm2_lvmetad_systemd_red_hat.service.in +++ /dev/null @@ -1,15 +0,0 @@ -[Unit] -Description=LVM2 metadata daemon -Documentation=man:lvmetad(8) -Requires=lvm2-lvmetad.socket -After=lvm2-lvmetad.socket -DefaultDependencies=no -Conflicts=shutdown.target - -[Service] -Type=simple -NonBlocking=true -ExecStart=@SBINDIR@/lvmetad -f -Environment=SD_ACTIVATION=1 -Restart=on-abort -PIDFile=@LVMETAD_PIDFILE@ diff --git a/scripts/lvm2_lvmetad_systemd_red_hat.socket.in b/scripts/lvm2_lvmetad_systemd_red_hat.socket.in deleted file mode 100644 index 2663c72..0000000 --- a/scripts/lvm2_lvmetad_systemd_red_hat.socket.in +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=LVM2 metadata daemon socket -Documentation=man:lvmetad(8) -DefaultDependencies=no -Conflicts=shutdown.target - -[Socket] -ListenStream=@DEFAULT_RUN_DIR@/lvmetad.socket -SocketMode=0600 -RemoveOnStop=true - -[Install] -WantedBy=sysinit.target diff --git a/scripts/lvm2_pvscan_systemd_red_hat@.service.in b/scripts/lvm2_pvscan_systemd_red_hat@.service.in deleted file mode 100644 index 839bfd1..0000000 --- a/scripts/lvm2_pvscan_systemd_red_hat@.service.in +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=LVM2 PV scan on device %i -Documentation=man:pvscan(8) -DefaultDependencies=no -StartLimitInterval=0 -BindsTo=dev-block-%i.device -Requires=lvm2-lvmetad.socket -After=lvm2-lvmetad.socket lvm2-lvmetad.service -Before=shutdown.target -Conflicts=shutdown.target - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=@SBINDIR@/lvm pvscan --cache --activate ay %i -ExecStop=@SBINDIR@/lvm pvscan --cache %i diff --git a/scripts/lvmconf.sh b/scripts/lvmconf.sh deleted file mode 100644 index 8579338..0000000 --- a/scripts/lvmconf.sh +++ /dev/null @@ -1,459 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. -# -# This file is part of the lvm2 package. -# -# This copyrighted material is made available to anyone wishing to use, -# modify, copy, or redistribute it subject to the terms and conditions -# of the GNU General Public License v.2. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# -# Edit an lvm.conf file to adjust various properties -# - -# cluster with clvmd and/or locking lib? -HANDLE_CLUSTER=0 - -# cluster without clvmd? -HANDLE_HALVM=0 - -# also enable services appropriately (lvmetad, clvmd)? -HANDLE_SERVICES=0 - -# also enable cmirrord service in addition? -HANDLE_MIRROR_SERVICE=0 - -# also start/start services in addition to enabling/disabling them? -START_STOP_SERVICES=0 - -function usage -{ - echo "Usage: $0 <command>" - echo "" - echo "Commands:" - echo "Enable clvm: --enable-cluster [--lockinglibdir <dir>] [--lockinglib <lib>]" - echo "Disable clvm: --disable-cluster" - echo "Enable halvm: --enable-halvm" - echo "Disable halvm: --disable-halvm" - echo "Set locking library: --lockinglibdir <dir> [--lockinglib <lib>]" - echo "" - echo "Global options:" - echo "Config file location: --file <configfile>" - echo "Set services: --services [--mirrorservice] [--startstopservices]" - echo "" - echo "Use the separate command 'lvmconfig' to display configuration information" -} - -function set_default_use_lvmetad_var -{ - eval "$(lvm dumpconfig --type default global/use_lvmetad 2>/dev/null)" - if [ "$?" != 0 ]; then - USE_LVMETAD=0 - else - USE_LVMETAD=$use_lvmetad - fi -} - -function parse_args -{ - while [ -n "$1" ]; do - case "$1" in - --enable-cluster) - LOCKING_TYPE=3 - USE_LVMETAD=0 - HANDLE_CLUSTER=1 - shift - ;; - --disable-cluster) - LOCKING_TYPE=1 - set_default_use_lvmetad_var - HANDLE_CLUSTER=1 - shift - ;; - --enable-halvm) - LOCKING_TYPE=1 - USE_LVMETAD=0 - HANDLE_HALVM=1 - shift - ;; - --disable-halvm) - LOCKING_TYPE=1 - set_default_use_lvmetad_var - HANDLE_HALVM=1 - shift - ;; - --lockinglibdir) - if [ -n "$2" ]; then - LOCKINGLIBDIR=$2 - shift 2 - else - usage - exit 1 - fi - HANDLE_CLUSTER=1 - ;; - --lockinglib) - if [ -n "$2" ]; then - LOCKINGLIB=$2 - shift 2 - else - usage - exit 1 - fi - HANDLE_CLUSTER=1 - ;; - --file) - if [ -n "$2" ]; then - CONFIGFILE=$2 - shift 2 - else - usage - exit 1 - fi - ;; - --services) - HANDLE_SERVICES=1 - shift - ;; - --mirrorservice) - HANDLE_MIRROR_SERVICE=1 - shift - ;; - --startstopservices) - START_STOP_SERVICES=1 - shift - ;; - *) - usage - exit 1 - esac - done - - if [ -n "$LOCKINGLIBDIR" ] || [ -n "$LOCKINGLIB" ]; then - LOCKING_TYPE=2 - USE_LVMETAD=0 - fi -} - -function validate_args -{ - [ -z "$CONFIGFILE" ] && CONFIGFILE="/etc/lvm/lvm.conf" - - if [ ! -f "$CONFIGFILE" ] - then - echo "$CONFIGFILE does not exist" - exit 10 - fi - - if [ "$HANDLE_CLUSTER" = 1 ] && [ "$HANDLE_HALVM" = 1 ]; then - echo "Either HA LVM or cluster method may be used at one time" - exit 18 - fi - - if [ "$HANDLE_SERVICES" = 0 ]; then - if [ "$HANDLE_MIRROR_SERVICE" = 1 ]; then - echo "--mirrorservice may be used only with --services" - exit 19 - fi - if [ "$START_STOP_SERVICES" = 1 ]; then - echo "--startstopservices may be used only with --services" - exit 19 - fi - fi - - if [ -z "$LOCKING_TYPE" ] && [ -z "$LOCKINGLIBDIR" ]; then - usage - exit 1 - fi - - if [ -n "$LOCKINGLIBDIR" ]; then - - if [ "${LOCKINGLIBDIR:0:1}" != "/" ] - then - echo "Prefix must be an absolute path name (starting with a /)" - exit 12 - fi - - if [ -n "$LOCKINGLIB" ] && [ ! -f "$LOCKINGLIBDIR/$LOCKINGLIB" ] - then - echo "$LOCKINGLIBDIR/$LOCKINGLIB does not exist, did you do a \"make install\" ?" - exit 11 - fi - - fi - - if [ "$LOCKING_TYPE" = 1 ] ; then - if [ -n "$LOCKINGLIBDIR" ] || [ -n "$LOCKINGLIB" ]; then - echo "Superfluous locking lib parameter, ignoring" - fi - fi -} - -umask 0077 - -parse_args "$@" - -validate_args - - -SCRIPTFILE=/etc/lvm/.lvmconf-script.tmp -TMPFILE=/etc/lvm/.lvmconf-tmp.tmp - - -# Flags so we know which parts of the file we can replace and which need -# adding. These are return codes from grep, so zero means it IS present! -have_type=1 -have_dir=1 -have_library=1 -have_use_lvmetad=1 -have_global=1 - -grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' "$CONFIGFILE" -have_type=$? - -grep -q '^[[:blank:]]*library_dir[[:blank:]]*=' "$CONFIGFILE" -have_dir=$? - -grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' "$CONFIGFILE" -have_library=$? - -grep -q '^[[:blank:]]*use_lvmetad[[:blank:]]*=' "$CONFIGFILE" -have_use_lvmetad=$? - -# Those options are in section "global {" so we must have one if any are present. -if [ "$have_type" = 0 ] || [ "$have_dir" = 0 ] || [ "$have_library" = 0 ] || [ "$have_use_lvmetad" = 0 ] -then - - # See if we can find it... - grep -q '^[[:blank:]]*global[[:blank:]]*{' $CONFIGFILE - have_global=$? - - if [ "$have_global" = 1 ] - then - echo "global keys but no 'global {' found, can't edit file" - exit 13 - fi -fi - -if [ "$LOCKING_TYPE" = 2 ] && [ -z "$LOCKINGLIBDIR" ] && [ "$have_dir" = 1 ]; then - echo "no library_dir specified in $CONFIGFILE" - exit 16 -fi - -# So if we don't have "global {" we need to create one and -# populate it - -if [ "$have_global" = 1 ] -then - if [ -z "$LOCKING_TYPE" ]; then - LOCKING_TYPE=1 - fi - if [ "$LOCKING_TYPE" = 3 ] || [ "$LOCKING_TYPE" = 2 ]; then - cat "$CONFIGFILE" - <<EOF > "$TMPFILE" -global { - # Enable locking for cluster LVM - locking_type = $LOCKING_TYPE - library_dir = "$LOCKINGLIBDIR" - # Disable lvmetad in cluster - use_lvmetad = 0 -EOF - if [ $? != 0 ] - then - echo "failed to create temporary config file, $CONFIGFILE not updated" - exit 14 - fi - if [ -n "$LOCKINGLIB" ]; then - cat - <<EOF >> "$TMPFILE" - locking_library = "$LOCKINGLIB" -EOF - if [ $? != 0 ] - then - echo "failed to create temporary config file, $CONFIGFILE not updated" - exit 16 - fi - fi - cat - <<EOF >> "$TMPFILE" -} -EOF - fi # if we aren't setting cluster locking, we don't need to create a global section - - if [ $? != 0 ] - then - echo "failed to create temporary config file, $CONFIGFILE not updated" - exit 17 - fi -else - # - # We have a "global {" section, so add or replace the - # locking entries as appropriate - # - - if [ -n "$LOCKING_TYPE" ]; then - if [ "$have_type" = 0 ] - then - SEDCMD=" s/^[[:blank:]]*locking_type[[:blank:]]*=.*/\ \ \ \ locking_type = $LOCKING_TYPE/g" - else - SEDCMD=" /global[[:blank:]]*{/a\ \ \ \ locking_type = $LOCKING_TYPE" - fi - fi - - if [ -n "$LOCKINGLIBDIR" ]; then - if [ "$have_dir" = 0 ] - then - SEDCMD="${SEDCMD}\ns'^[[:blank:]]*library_dir[[:blank:]]*=.*'\ \ \ \ library_dir = \"$LOCKINGLIBDIR\"'g" - else - SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ library_dir = \"$LOCKINGLIBDIR\"" - fi - fi - - if [ -n "$LOCKINGLIB" ]; then - if [ "$have_library" = 0 ] - then - SEDCMD="${SEDCMD}\ns/^[[:blank:]]*locking_library[[:blank:]]*=.*/\ \ \ \ locking_library = \"$LOCKINGLIB\"/g" - else - SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ locking_library = \"$LOCKINGLIB\"" - fi - fi - - if [ "$have_use_lvmetad" = 0 ] - then - SEDCMD="${SEDCMD}\ns'^[[:blank:]]*use_lvmetad[[:blank:]]*=.*'\ \ \ \ use_lvmetad = $USE_LVMETAD'g" - else - SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ use_lvmetad = $USE_LVMETAD" - fi - - echo -e "$SEDCMD" > "$SCRIPTFILE" - sed <"$CONFIGFILE" >"$TMPFILE" -f "$SCRIPTFILE" - if [ $? != 0 ] - then - echo "sed failed, $CONFIGFILE not updated" - exit 15 - fi -fi - -# Now we have a suitably editted config file in a temp place, -# backup the original and copy our new one into place. - -cp "$CONFIGFILE" "$CONFIGFILE.lvmconfold" -if [ $? != 0 ] - then - echo "failed to backup old config file, $CONFIGFILE not updated" - exit 2 -fi - -cp "$TMPFILE" "$CONFIGFILE" -if [ $? != 0 ] - then - echo "failed to copy new config file into place, check $CONFIGFILE is still OK" - exit 3 -fi - -rm -f "$SCRIPTFILE" "$TMPFILE" - -function set_service { - local type=$1 - local action=$2 - shift 2 - - if [ "$type" = "systemd" ]; then - if [ "$action" = "activate" ]; then - for i in "$@"; do - unset LoadState - eval "$($SYSTEMCTL_BIN show "$i" -p LoadState 2>/dev/null)" - test "$LoadState" = "loaded" || continue - $SYSTEMCTL_BIN enable "$i" - if [ "$START_STOP_SERVICES" = 1 ]; then - $SYSTEMCTL_BIN start "$i" - fi - done - elif [ "$action" = "deactivate" ]; then - for i in "$@"; do - unset LoadState - eval "$($SYSTEMCTL_BIN show "$i" -p LoadState 2>/dev/null)" - test "$LoadState" = "loaded" || continue - "$SYSTEMCTL_BIN" disable "$i" - if [ "$START_STOP_SERVICES" = 1 ]; then - "$SYSTEMCTL_BIN" stop "$i" - fi - done - fi - elif [ "$type" = "sysv" ]; then - if [ "$action" = "activate" ]; then - for i in "$@"; do - "$CHKCONFIG_BIN" --list "$i" > /dev/null || continue - "$CHKCONFIG_BIN" "$i" on - if [ "$START_STOP_SERVICES" = 1 ]; then - "$SERVICE_BIN" "$i" start - fi - done - elif [ "$action" = "deactivate" ]; then - for i in "$@"; do - "$CHKCONFIG_BIN" --list "$i" > /dev/null || continue - if [ "$START_STOP_SERVICES" = 1 ]; then - "$SERVICE_BIN" "$i" stop - fi - "$CHKCONFIG_BIN" "$i" off - done - fi - fi -} - -# Start/stop and enable/disable services if needed. - -if [ "$HANDLE_SERVICES" = 1 ]; then - - SYSTEMCTL_BIN=$(which systemctl 2>/dev/null) - CHKCONFIG_BIN=$(which chkconfig 2>/dev/null) - SERVICE_BIN=$(which service 2>/dev/null) - - # Systemd services - if [ -n "$SYSTEMCTL_BIN" ]; then - if [ "$USE_LVMETAD" = 0 ]; then - set_service systemd deactivate lvm2-lvmetad.service lvm2-lvmetad.socket - else - set_service systemd activate lvm2-lvmetad.socket - fi - - if [ "$LOCKING_TYPE" = 3 ]; then - set_service systemd activate lvm2-cluster-activation.service - if [ "$HANDLE_MIRROR_SERVICE" = 1 ]; then - set_service activate lvm2-cmirrord.service - fi - else - set_service systemd deactivate lvm2-cluster-activation.service - if [ "$HANDLE_MIRROR_SERVICE" = 1 ]; then - set_service systemd deactivate lvm2-cmirrord.service - fi - fi - - # System V init scripts - elif [ -n "$SERVICE_BIN" ] && [ -n "$CHKCONFIG_BIN" ]; then - if [ "$USE_LVMETAD" = 0 ]; then - set_service sysv deactivate lvm2-lvmetad - else - set_service sysv activate lvm2-lvmetad - fi - - if [ "$LOCKING_TYPE" = 3 ]; then - set_service sysv activate clvmd - if [ "$HANDLE_MIRROR_SERVICE" = 1 ]; then - set_service sysv activate cmirrord - fi - else - set_service sysv deactivate clvmd - if [ "$HANDLE_MIRROR_SERVICE" = 1 ]; then - set_service sysv deactivate cmirrord - fi - fi - - # None of the service tools found, error out - else - echo "Missing tools to handle services" - exit 20 - fi -fi diff --git a/scripts/lvmconf_lockingtype2.sh b/scripts/lvmconf_lockingtype2.sh deleted file mode 100644 index 52929d3..0000000 --- a/scripts/lvmconf_lockingtype2.sh +++ /dev/null @@ -1,259 +0,0 @@ -#!/bin/bash -# -# Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved. -# -# This file is part of the lvm2-cluster package. -# -# This copyrighted material is made available to anyone wishing to use, -# modify, copy, or redistribute it subject to the terms and conditions -# of the GNU General Public License v.2. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -# -# Edit an lvm.conf file to adjust various properties -# - -function usage -{ - echo "usage: $0 <command>" - echo "" - echo "Commands:" - echo "Enable clvm: --enable-cluster [--lockinglibdir <dir>] [--lockinglib <lib>]" - echo "Disable clvm: --disable-cluster" - echo "Set locking library: --lockinglibdir <dir> [--lockinglib <lib>]" - echo "" - echo "Global options:" - echo "Config file location: --file <configfile>" - echo "" -} - - -function parse_args -{ - while [ -n "$1" ]; do - case "$1" in - --enable-cluster) - LOCKING_TYPE=2 - shift - ;; - --disable-cluster) - LOCKING_TYPE=1 - shift - ;; - --lockinglibdir) - if [ -n "$2" ]; then - LOCKINGLIBDIR=$2 - shift 2 - else - usage - exit 1 - fi - ;; - --lockinglib) - if [ -n "$2" ]; then - LOCKINGLIB=$2 - shift 2 - else - usage - exit 1 - fi - ;; - --file) - if [ -n "$2" ]; then - CONFIGFILE=$2 - shift 2 - else - usage - exit 1 - fi - ;; - *) - usage - exit 1 - esac - done -} - -function validate_args -{ - [ -z "$CONFIGFILE" ] && CONFIGFILE="/etc/lvm/lvm.conf" - - if [ ! -f "$CONFIGFILE" ] - then - echo "$CONFIGFILE does not exist" - exit 10 - fi - - if [ -z "$LOCKING_TYPE" ] && [ -z "$LOCKINGLIBDIR" ]; then - usage - exit 1 - fi - - if [ -n "$LOCKINGLIBDIR" ]; then - - [ -z "$LOCKINGLIB" ] && LOCKINGLIB="liblvm2clusterlock.so" - - if [ "${LOCKINGLIBDIR:0:1}" != "/" ] - then - echo "Prefix must be an absolute path name (starting with a /)" - exit 12 - fi - - if [ ! -f "$LOCKINGLIBDIR/$LOCKINGLIB" ] - then - echo "$LOCKINGLIBDIR/$LOCKINGLIB does not exist, did you do a \"make install\" ?" - exit 11 - fi - - fi - - if [ "$LOCKING_TYPE" = "1" ] ; then - if [ -n "$LOCKINGLIBDIR" ] || [ -n "$LOCKINGLIB" ]; then - echo "Superfluous locking lib parameter, ignoring" - fi - fi -} - -umask 0077 - -parse_args "$@" - -validate_args - - -SCRIPTFILE=/etc/lvm/.lvmconf-script.tmp -TMPFILE=/etc/lvm/.lvmconf-tmp.tmp - - -# Flags so we know which parts of the file we can replace and which need -# adding. These are return codes from grep, so zero means it IS present! -have_type=1 -have_dir=1 -have_library=1 -have_global=1 - -grep -q '^[[:blank:]]*locking_type[[:blank:]]*=' "$CONFIGFILE" -have_type=$? - -grep -q '^[[:blank:]]*library_dir[[:blank:]]*=' "$CONFIGFILE" -have_dir=$? - -grep -q '^[[:blank:]]*locking_library[[:blank:]]*=' "$CONFIGFILE" -have_library=$? - -# Those options are in section "global {" so we must have one if any are present. -if [ "$have_type" = "0" ] || [ "$have_dir" = "0" ] || [ "$have_library" = "0" ]; then - # See if we can find it... - grep -q '^[[:blank:]]*global[[:blank:]]*{' "$CONFIGFILE" - have_global=$? - - if [ "$have_global" = "1" ] - then - echo "global keys but no 'global {' found, can't edit file" - exit 13 - fi -fi - -if [ "$LOCKING_TYPE" = "2" ] && [ -z "$LOCKINGLIBDIR" ] && [ "$have_dir" = "1" ]; then - echo "no library_dir specified in $CONFIGFILE" - exit 16 -fi - -# So if we don't have "global {" we need to create one and -# populate it - -if [ "$have_global" = "1" ] -then - if [ -z "$LOCKING_TYPE" ]; then - LOCKING_TYPE=1 - fi - if [ "$LOCKING_TYPE" = "2" ]; then - cat "$CONFIGFILE" - <<EOF > $TMPFILE -global { - # Enable locking for cluster LVM - locking_type = $LOCKING_TYPE - library_dir = "$LOCKINGLIBDIR" - locking_library = "$LOCKINGLIB" -} -EOF - fi # if we aren't setting cluster locking, we don't need to create a global section - - if [ $? != 0 ] - then - echo "failed to create temporary config file, $CONFIGFILE not updated" - exit 14 - fi -else - # - # We have a "global {" section, so add or replace the - # locking entries as appropriate - # - - if [ -n "$LOCKING_TYPE" ]; then - if [ "$have_type" = "0" ] - then - SEDCMD=" s/^[[:blank:]]*locking_type[[:blank:]]*=.*/\ \ \ \ locking_type = $LOCKING_TYPE/g" - else - SEDCMD=" /global[[:blank:]]*{/a\ \ \ \ locking_type = $LOCKING_TYPE" - fi - fi - - if [ -n "$LOCKINGLIBDIR" ]; then - if [ "$have_dir" = "0" ] - then - SEDCMD="${SEDCMD}\ns'^[[:blank:]]*library_dir[[:blank:]]*=.*'\ \ \ \ library_dir = \"$LOCKINGLIBDIR\"'g" - else - SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ library_dir = \"$LOCKINGLIBDIR\"" - fi - - if [ "$have_library" = "0" ] - then - SEDCMD="${SEDCMD}\ns/^[[:blank:]]*locking_library[[:blank:]]*=.*/\ \ \ \ locking_library = \"$LOCKINGLIB\"/g" - else - SEDCMD="${SEDCMD}\n/global[[:blank:]]*{/a\ \ \ \ locking_library = \"$LOCKINGLIB\"" - fi - fi - - if [ "$LOCKING_TYPE" = "1" ]; then - # if we're not using cluster locking, remove the library dir and locking library name - if [ "$have_dir" = "0" ] - then - SEDCMD="${SEDCMD}\n/^[[:blank:]]*library_dir[[:blank:]]*=.*/d" - fi - - if [ "$have_library" = "0" ] - then - SEDCMD="${SEDCMD}\n/^[[:blank:]]*locking_library[[:blank:]]*=.*/d" - fi - fi - - echo -e "$SEDCMD" > "$SCRIPTFILE" - sed <"$CONFIGFILE" >"$TMPFILE" -f "$SCRIPTFILE" - if [ $? != 0 ] - then - echo "sed failed, $CONFIGFILE not updated" - exit 15 - fi -fi - -# Now we have a suitably editted config file in a temp place, -# backup the original and copy our new one into place. - -cp "$CONFIGFILE" "$CONFIGFILE.lvmconfold" -if [ $? != 0 ] - then - echo "failed to backup old config file, $CONFIGFILE not updated" - exit 2 -fi - -cp "$TMPFILE" "$CONFIGFILE" -if [ $? != 0 ] - then - echo "failed to copy new config file into place, check $CONFIGFILE is still OK" - exit 3 -fi - -rm -f "$SCRIPTFILE" "$TMPFILE"
1
0
0
0
← Newer
1
2
3
4
Older →
Jump to page:
1
2
3
4
Results per page:
10
25
50
100
200