main - toollib: avoid repeated remove of online vg
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ed1651d11f42ea7157b...
Commit: ed1651d11f42ea7157b7b0aebf498b97e56b98aa
Parent: 522561e64b5fe73cb9d01c2ee2d4b7624b0ddff4
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Dec 17 13:18:56 2021 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Dec 20 16:13:28 2021 +0100
toollib: avoid repeated remove of online vg
Call just once unlink after every deactivation of LV from VG.
---
lib/commands/toolcontext.h | 1 +
tools/toollib.c | 7 ++++++-
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/lib/commands/toolcontext.h b/lib/commands/toolcontext.h
index fb7182db6..4d7d4630d 100644
--- a/lib/commands/toolcontext.h
+++ b/lib/commands/toolcontext.h
@@ -202,6 +202,7 @@ struct cmd_context {
unsigned backup_disabled:1; /* skip repeated debug message */
unsigned event_activation:1; /* whether event_activation is set */
unsigned udevoutput:1;
+ unsigned online_vg_file_removed:1;
/*
* Devices and filtering.
diff --git a/tools/toollib.c b/tools/toollib.c
index 33b704134..3b3a20689 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -829,8 +829,11 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
* user may want to take charge of activation changes to the VG
* and not have the system autoactivation interfere.
*/
- if (!is_change_activating(activate) && cmd->event_activation)
+ if (!is_change_activating(activate) && cmd->event_activation &&
+ !cmd->online_vg_file_removed) {
+ cmd->online_vg_file_removed = 1;
online_vg_file_remove(lv->vg->name);
+ }
set_lv_notify(lv->vg->cmd);
@@ -2983,6 +2986,8 @@ int process_each_lv_in_vg(struct cmd_context *cmd, struct volume_group *vg,
struct glv_list *glvl, *tglvl;
int do_report_ret_code = 1;
+ cmd->online_vg_file_removed = 0;
+
log_set_report_object_type(LOG_REPORT_OBJECT_TYPE_LV);
vg_uuid[0] = '\0';
2 years, 4 months
main - vdo: ensure VDO config is removed
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=522561e64b5fe73cb9d...
Commit: 522561e64b5fe73cb9d01c2ee2d4b7624b0ddff4
Parent: 0f71183f9434d513733d38fb7f9619421d8afaf5
Author: Andrew Walsh <awalsh(a)redhat.com>
AuthorDate: Mon Nov 15 10:49:06 2021 -0500
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Mon Dec 20 16:13:28 2021 +0100
vdo: ensure VDO config is removed
Make sure to remove the VDO config after conversion
of LVM-backed VDO.
Addresses point 3 in rhbz#1987024#c5
---
scripts/lvm_import_vdo.sh | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/scripts/lvm_import_vdo.sh b/scripts/lvm_import_vdo.sh
index 61a82e41e..d01766743 100755
--- a/scripts/lvm_import_vdo.sh
+++ b/scripts/lvm_import_vdo.sh
@@ -414,6 +414,12 @@ EOF
verbose "Converting to VDO pool."
dry "$LVM" lvconvert $YES $VERB $FORCE --config "$PARAMS" -Zn -V "${vdo_logicalSize}k" -n "$LVNAME" --type vdo-pool "$VGNAME/${LVNAME}_vpool"
+ # Note: that this is spelled OPPOSITE the other $IS_LV checks.
+ if [ "$IS_LV" = "1" ]; then
+ verbose "Removing now-unused VDO entry from VDO config."
+ dry "$VDO" remove $VDOCONF --force --verbose --name "$VDONAME"
+ fi
+
rm -fr "$TEMPDIR"
}
2 years, 4 months
main - man lvmautoactivation: replace systemctl with journalctl
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=0f71183f9434d513733...
Commit: 0f71183f9434d513733d38fb7f9619421d8afaf5
Parent: fbd8b0cf43dc67f51f86f060dce748f446985855
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Dec 14 12:02:08 2021 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Dec 14 12:02:08 2021 -0600
man lvmautoactivation: replace systemctl with journalctl
---
man/lvmautoactivation.7_main | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/man/lvmautoactivation.7_main b/man/lvmautoactivation.7_main
index bf885991d..54dab718b 100644
--- a/man/lvmautoactivation.7_main
+++ b/man/lvmautoactivation.7_main
@@ -107,7 +107,7 @@ vgchange -aay --autoactivation event <vgname>
.
.IP \[bu] 2
the activation command output can be seen from
-systemctl status lvm-activate-<vgname>
+journalctl -u lvm-activate-<vgname>
.P
.
.SS pvscan options
2 years, 4 months
main - udev: remove -r from systemd-run
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fbd8b0cf43dc67f51f8...
Commit: fbd8b0cf43dc67f51f86f060dce748f446985855
Parent: 6a431eb24241caf2277d3e5b4718782d92650a2a
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Dec 14 11:57:13 2021 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Dec 14 11:57:13 2021 -0600
udev: remove -r from systemd-run
If the transient service remains after it's done, then
it prevents the same transient service from being run
again later if the PVs are detached and reattached
(although the behavior of a second autoactivation is not
well defined and may only work in limited cases.)
---
udev/69-dm-lvm.rules.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/udev/69-dm-lvm.rules.in b/udev/69-dm-lvm.rules.in
index 4f34b2cc2..14e7dd26d 100644
--- a/udev/69-dm-lvm.rules.in
+++ b/udev/69-dm-lvm.rules.in
@@ -80,7 +80,7 @@ ENV{SYSTEMD_READY}="1"
# it's better suited to appearing in the journal.
IMPORT{program}="(LVM_EXEC)/lvm pvscan --cache --listvg --checkcomplete --vgonline --autoactivation event --udevoutput --journal=output $env{DEVNAME}"
-ENV{LVM_VG_NAME_COMPLETE}=="?*", RUN+="/usr/bin/systemd-run -r --no-block --property DefaultDependencies=no --unit lvm-activate-$env{LVM_VG_NAME_COMPLETE} (LVM_EXEC)/lvm vgchange -aay --autoactivation event $env{LVM_VG_NAME_COMPLETE}"
+ENV{LVM_VG_NAME_COMPLETE}=="?*", RUN+="/usr/bin/systemd-run --no-block --property DefaultDependencies=no --unit lvm-activate-$env{LVM_VG_NAME_COMPLETE} (LVM_EXEC)/lvm vgchange -aay --autoactivation event $env{LVM_VG_NAME_COMPLETE}"
GOTO="lvm_end"
LABEL="lvm_end"
2 years, 4 months
main - devices: recognise rbd (ceph rados block device)
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=6a431eb24241caf2277...
Commit: 6a431eb24241caf2277d3e5b4718782d92650a2a
Parent: c28541eccdbf76191f7728035cd2a48d26d06922
Author: ������ <nabijaczleweli(a)nabijaczleweli.xyz>
AuthorDate: Mon Dec 13 13:32:06 2021 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Dec 13 13:32:06 2021 -0600
devices: recognise rbd (ceph rados block device)
Description stolen from linux d/b/rbd.c L3:
rbd.c -- Export ceph rados objects as a Linux block device
16 partitions seem to make sense according to L90:
#define RBD_SINGLE_MAJOR_PART_SHIFT 4
Running *scan -vvvvvvdddddd yields
#filters/filter-type.c:28 /dev/rbd1p5: Skipping: Unrecognised LVM device type 252
#filters/filter-persistent.c:131 filter caching bad /dev/rbd1p5
right now, and adding
types = ["rbd", 252]
to /e/l/lvm.conf (with the matching "252 rbd" in /p/devices) works as a
per-machine fix:
rbd1 252:16 0 1T 1 disk
|-rbd1p1 252:17 0 243M 1 part
|-rbd1p2 252:18 0 1K 1 part
`-rbd1p5 252:21 0 1023.8G 1 part
`-dev01--vg-root 253:0 0 1023.8G 0 lvm
but rbd is supported by upstream so it'd be nice to have it work OOB
---
lib/device/device-types.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/device/device-types.h b/lib/device/device-types.h
index 2834cd11f..a4191e839 100644
--- a/lib/device/device-types.h
+++ b/lib/device/device-types.h
@@ -43,6 +43,7 @@ static const dev_known_type_t _dev_known_types[] = {
{"ubd", 16, "User-mode virtual block device"},
{"ataraid", 16, "ATA Raid"},
{"drbd", 16, "Distributed Replicated Block Device (DRBD)"},
+ {"rbd", 16, "Ceph rados object as a Linux block device"},
{"emcpower", 16, "EMC Powerpath"},
{"power2", 16, "EMC Powerpath"},
{"i2o_block", 16, "i2o Block Disk"},
2 years, 4 months
main - lvcreate: include recent options
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c28541eccdbf76191f7...
Commit: c28541eccdbf76191f7728035cd2a48d26d06922
Parent: d803d9202c7c11548c7ab81afb61ad738802b8f8
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Dec 13 08:59:31 2021 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Dec 13 08:59:31 2021 -0600
lvcreate: include recent options
The permitted option list in lvcreate has not kept
up with command-lines.in.
---
tools/lvcreate.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 0121c09a8..79af42685 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -824,12 +824,16 @@ static int _lvcreate_params(struct cmd_context *cmd,
autobackup_ARG,\
available_ARG,\
contiguous_ARG,\
+ devices_ARG,\
+ devicesfile_ARG,\
ignoreactivationskip_ARG,\
ignoremonitoring_ARG,\
+ journal_ARG,\
metadataprofile_ARG,\
monitor_ARG,\
mirrors_ARG,\
name_ARG,\
+ nohints_ARG,\
noudevsync_ARG,\
permission_ARG,\
persistent_ARG,\
2 years, 4 months
main - man: add section about static autoactivation
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=d803d9202c7c11548c7...
Commit: d803d9202c7c11548c7ab81afb61ad738802b8f8
Parent: ae54e75176d787de2d447ec40142f85f4dcc47c4
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Dec 6 13:20:32 2021 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Dec 6 13:20:32 2021 -0600
man: add section about static autoactivation
---
man/lvmautoactivation.7_main | 48 +++++++++++++++++++++++++++++++++++++-------
1 file changed, 41 insertions(+), 7 deletions(-)
diff --git a/man/lvmautoactivation.7_main b/man/lvmautoactivation.7_main
index 87c15a3d1..bf885991d 100644
--- a/man/lvmautoactivation.7_main
+++ b/man/lvmautoactivation.7_main
@@ -14,14 +14,16 @@ activated.
Autoactivation of VGs, or specific LVs, can be prevented using vgchange or
lvchange --setautoactivation n. The lvm.conf auto_activation_volume_list
is another way to limit autoactivation.
+.
+.SS event autoactivation
.P
The most common form of autoactivation is "event based", in which complete
VGs are activated in response to uevents which occur during system startup
or at any time after the system has started. Another form of
-autoactivation is "service based" in which complete VGs are activated at a
-fixed point during system startup by a systemd service, and are not
-activated in response to uevents. This can be controlled with the
-lvm.conf setting event_activation.
+autoactivation is "static" in which complete VGs are activated at a fixed
+point during system startup by a systemd service, and not in response to
+events. This can be controlled with the lvm.conf setting
+event_activation.
.P
Event based autoactivation is driven by udev, udev rules, and systemd.
When a device is attached to a machine, a uevent is generated by the
@@ -30,8 +32,8 @@ rules to process the new device. Udev rules use blkid to identify the
device as an LVM PV and then execute the lvm-specific udev rule for the
device, which triggers autoactivation.
.P
-There are two variations of event based autoactivation that may be used a
-system, depending on the LVM udev rule that is installed (found in
+There are two variations of event baed autoactivation that may be used on
+a system, depending on the LVM udev rule that is installed (found in
/lib/udev/rules.d/.) The following summarizes the steps in each rule
which lead to autoactivation:
.P
@@ -149,7 +151,7 @@ using the udev environment key format, i.e. NAME='value'.
Send standard command output to the journal (when stdout
is reserved for udev output.)
.P
-.SS Temp files
+.SS run files
.P
Autoactivation commands use a number of temp files in /run/lvm (with the
expectation that /run is cleared between boots.)
@@ -175,6 +177,38 @@ The first activation command (pvscan or vgchange) to create a file here,
named for the VG, will activate the VG. This resolves a race when
concurrent commands attempt to activate a VG at once.
.
+.SS static autoactivation
+.P
+When event autoactivation is disabled by setting lvm.conf
+event_activation=0, autoactivation is performed at one or more static
+points during system startup. At these points, a vgchange -aay command is
+run to activate complete VGs from devices that are present on the system
+at that time. pvscan commands (and lvm2-pvscan services) do not perform
+autoactivation in this mode. pvscan commands may still be run from
+uevents but will do nothing when they read the event_activation=0 setting.
+.P
+The static vgchange -aay commands are run by three systemd services at
+three points during startup: lvm2-activation-early, lvm2-activation, and
+lvm2-activation-net. These static activation services are "generated
+services", so the service files are created at run time by the
+lvm2-activation-generator command (run by systemd).
+lvm2-activation-generator creates the services if lvm.conf
+event_activation=0.
+.P
+The limitation of this method is that devices may not be attached to the
+system (or set up) at a reliable point in time during startup, and they
+may not be present when the services run vgchange. In this case, the VGs
+will not be autoactivated. So, the timing of device attachment/setup
+determines whether static autoactivation will produce the same results as
+event autoactivation. For this reason, static autoactivation is not
+recommended.
+.P
+Sometimes, static autoactivation is mistakenly expected to disable all
+autoactivation of particular VGs. This may appear to be effective if those
+VGs are slow to be attached or set up. But, the only correct and reliable
+way to disable autoactivation is using vgchange/lvchange
+--setautoactivation n, or lvm.conf auto_activation_volume_list.
+.
.SH EXAMPLES
.P
VG "vg" contains two PVs:
2 years, 4 months
main - device_id: handle wwid with spaces or control characters
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ae54e75176d787de2d4...
Commit: ae54e75176d787de2d447ec40142f85f4dcc47c4
Parent: 455c29b10dfd15a9fa2ad72c8f9de77572328d39
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Dec 2 13:30:36 2021 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Dec 2 13:33:18 2021 -0600
device_id: handle wwid with spaces or control characters
non-standard wwid can be reported from sysfs with spaces/etc.
replace with "_"
---
lib/device/device_id.c | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index bfee7d418..6e9107fff 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -304,6 +304,7 @@ const char *device_id_system_read(struct cmd_context *cmd, struct device *dev, u
{
char sysbuf[PATH_MAX] = { 0 };
const char *idname = NULL;
+ int i;
if (idtype == DEV_ID_TYPE_SYS_WWID) {
read_sys_block(cmd, dev, "device/wwid", sysbuf, sizeof(sysbuf));
@@ -311,18 +312,10 @@ const char *device_id_system_read(struct cmd_context *cmd, struct device *dev, u
if (!sysbuf[0])
read_sys_block(cmd, dev, "wwid", sysbuf, sizeof(sysbuf));
- /* scsi_debug wwid begins "t10.Linux scsi_debug ..." */
- if (strstr(sysbuf, "scsi_debug")) {
- int i;
- for (i = 0; i < strlen(sysbuf); i++) {
- if (sysbuf[i] == ' ')
- sysbuf[i] = '_';
- }
- }
-
/* qemu wwid begins "t10.ATA QEMU HARDDISK ..." */
if (strstr(sysbuf, "QEMU HARDDISK"))
sysbuf[0] = '\0';
+
}
else if (idtype == DEV_ID_TYPE_SYS_SERIAL)
@@ -360,6 +353,11 @@ const char *device_id_system_read(struct cmd_context *cmd, struct device *dev, u
return idname;
}
+ for (i = 0; i < strlen(sysbuf); i++) {
+ if (isblank(sysbuf[i]) || isspace(sysbuf[i]) || iscntrl(sysbuf[i]))
+ sysbuf[i] = '_';
+ }
+
if (!sysbuf[0])
goto_bad;
2 years, 4 months
main - print warning about unrecognized journal option value
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=455c29b10dfd15a9fa2...
Commit: 455c29b10dfd15a9fa2ad72c8f9de77572328d39
Parent: c42a05c3ec8608e438fca435e3cbe6d306af80c6
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Dec 2 12:40:52 2021 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Dec 2 12:40:52 2021 -0600
print warning about unrecognized journal option value
---
lib/log/log.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/log/log.c b/lib/log/log.c
index 7b4d537b3..5771a1d01 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -892,6 +892,7 @@ uint32_t log_journal_str_to_val(const char *str)
return LOG_JOURNAL_OUTPUT;
if (!strcasecmp(str, "debug"))
return LOG_JOURNAL_DEBUG;
+ log_warn("Ignoring unrecognized journal value.");
return 0;
}
2 years, 4 months
main - pvscan: fix error message for invalid devname
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c42a05c3ec8608e438f...
Commit: c42a05c3ec8608e438fca435e3cbe6d306af80c6
Parent: 05d9a013516f23e27b04b6933705c6ae45f9f5b2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Dec 1 14:36:40 2021 -0600
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Dec 1 14:38:17 2021 -0600
pvscan: fix error message for invalid devname
uninitialized name buffer used in message.
fixes "pvs_online: include devname in pvid files"
---
lib/device/dev-cache.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index b5f355484..825e348b4 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -2102,7 +2102,7 @@ int setup_devices_for_online_autoactivation(struct cmd_context *cmd)
static char *_get_devname_from_devno(struct cmd_context *cmd, dev_t devno)
{
char path[PATH_MAX];
- char devname[PATH_MAX];
+ char devname[PATH_MAX] = { 0 };
char namebuf[NAME_LEN];
char line[1024];
int major = MAJOR(devno);
@@ -2114,6 +2114,9 @@ static char *_get_devname_from_devno(struct cmd_context *cmd, dev_t devno)
struct dirent *dirent;
FILE *fp;
+ if (!devno)
+ return NULL;
+
/*
* $ ls /sys/dev/block/8:0/device/block/
* sda
@@ -2251,6 +2254,8 @@ struct device *setup_dev_in_dev_cache(struct cmd_context *cmd, dev_t devno, cons
if (devname) {
if (stat(devname, &buf) < 0) {
log_error("Cannot access device %s for %d:%d.", devname, major, minor);
+ if (!devno)
+ return_NULL;
if (!(devname = _get_devname_from_devno(cmd, devno))) {
log_error("No device name found from %d:%d.", major, minor);
return_NULL;
2 years, 4 months