]> sourceware.org Git - lvm2.git/log
lvm2.git
21 months agolvmdbustest: Add test to ensure error collection
Tony Asleson [Tue, 29 Nov 2022 15:57:20 +0000 (09:57 -0600)]
lvmdbustest: Add test to ensure error collection

Recreates https://bugzilla.redhat.com/show_bug.cgi?id=2145114

21 months agoman: dmsetup concise format consitency
Zdenek Kabelac [Fri, 25 Nov 2022 13:19:57 +0000 (14:19 +0100)]
man: dmsetup concise format consitency

Use <name> consistenly.

21 months agodmsetup: fix udev event handling for create
Zdenek Kabelac [Fri, 25 Nov 2022 14:45:47 +0000 (15:45 +0100)]
dmsetup: fix udev event handling for create

With newer kernels (>5.13)  DM_CREATE no longer generates
uevent for DM devices without table.
There are even no sysfs block device entries in such case,
although device has asigned major:minor and it is being listed
by 'dmsetup info'.

So this patch calculates amount of 'table' lines and in case
no table line comes from cmdline or stdin - waiting on cookie
is avoided generically instead of disabling just case with
option --notable - which then also skipped handling of an
option --addnodeoncreate (which is however historical and
should be avoided)

As a result there should be no leaking udev cookies and endlessly
waiting commands like this:

dmsetup create mytestdev  </dev/null

21 months agoconfigure: update
Zdenek Kabelac [Wed, 23 Nov 2022 12:18:07 +0000 (13:18 +0100)]
configure: update

21 months agolvmpolld: fix `strerror_r` check for musl
Sam James [Sat, 19 Nov 2022 16:51:09 +0000 (17:51 +0100)]
lvmpolld: fix `strerror_r` check for musl

We can't assume that strerror_r returns char* just because _GNU_SOURCE is
defined. We already call the appropriate autoconf test, so let's use its
result (STRERROR_R_CHAR_P).

Note that in configure, _GNU_SOURCE is always set, but we add a defined
guard just in case for futureproofing.

Bug: https://bugs.gentoo.org/869404

21 months agoconfigure: allow for overriding of `readelf`
David Seifert [Sat, 19 Nov 2022 16:51:08 +0000 (17:51 +0100)]
configure: allow for overriding of `readelf`

This allows users to use e.g. `llvm-readelf`
on systems with binutils as default.

Bug: https://bugs.gentoo.org/840628

21 months agotests: devicesfile-vpd-ids add nvme wwid
David Teigland [Mon, 21 Nov 2022 16:57:30 +0000 (10:57 -0600)]
tests: devicesfile-vpd-ids add nvme wwid

22 months agoreport: query lvmlockd for lv_active_exclusively
corubba [Tue, 1 Nov 2022 21:23:47 +0000 (22:23 +0100)]
report: query lvmlockd for lv_active_exclusively

Query LV lock state in lvmlockd to report lv_active_exclusively
for active LVs in a shared VGs.  As with all lvmlockd state,
it is from the perspective of the local node.

Signed-off-by: corubba <corubba@gmx.de>
22 months agoreport: adjust lv_active_remotely for shared VGs
corubba [Tue, 1 Nov 2022 21:18:19 +0000 (22:18 +0100)]
report: adjust lv_active_remotely for shared VGs

Add a note to the manpage that lvmlockd is unable to determine
accurately and without side-effects whether a LV is remotely active.
Also change the value of the lv_active_remotely option from false to
undefined for shared VGs to distinctly communicate that inability to
users. Only for local VGs it can be definitely stated that they are not
remotely active.

Signed-off-by: corubba <corubba@gmx.de>
22 months agopost-release
Marian Csontos [Thu, 10 Nov 2022 13:21:57 +0000 (14:21 +0100)]
post-release

22 months agopre-release v2_03_17
Marian Csontos [Thu, 10 Nov 2022 09:23:38 +0000 (10:23 +0100)]
pre-release

22 months agomake: generate
Marian Csontos [Thu, 10 Nov 2022 08:57:57 +0000 (09:57 +0100)]
make: generate

22 months agovdo: improve validation message
Zdenek Kabelac [Tue, 8 Nov 2022 11:40:21 +0000 (12:40 +0100)]
vdo: improve validation message

Rephrase.

22 months agolvcreate: fix error path return values
Zdenek Kabelac [Tue, 8 Nov 2022 11:39:25 +0000 (12:39 +0100)]
lvcreate: fix error path return values

Return failing error code for return path, as 'return 0' in this
case was returning success.

22 months agotests: update test to handle different status
Zdenek Kabelac [Fri, 4 Nov 2022 16:00:48 +0000 (17:00 +0100)]
tests: update test to handle different status

Since now we change deduplication with V4 table line change,
the modification tends to be faster and we can capture for a few ms
also 'status' about opening or closing deduplication index.
Use 'grep -E' to handle both words.

22 months agovdo: enhance detection of virtual size
Zdenek Kabelac [Sat, 5 Nov 2022 22:10:36 +0000 (23:10 +0100)]
vdo: enhance detection of virtual size

Improve detection of VDO virtual size - so it's not reading VDO
metadata when VDO device is already active and instead we reuse
existing table line for knowing existing metadata size.

NOTE: if there is ever going to be added support for reduction
of VDO virtual size - this method will need to be reworked to
allow size difference only within 'extent_size' alignment.

22 months agovdo: replace errors with debug
Zdenek Kabelac [Fri, 4 Nov 2022 15:27:56 +0000 (16:27 +0100)]
vdo: replace errors with debug

As we actully use reading of VDO metadata only as extra 'information' source,
and not error command - switch to 'log_debug()' severity with messages
out of parser code.

22 months agodevices: factor common list functions
David Teigland [Mon, 7 Nov 2022 17:38:46 +0000 (11:38 -0600)]
devices: factor common list functions

which were duplicated in various places

22 months agodevice_id: handle duplicate serial numbers
David Teigland [Mon, 31 Oct 2022 21:14:01 +0000 (16:14 -0500)]
device_id: handle duplicate serial numbers

Handle multiple devices using the same serial number as
their device id.  After matching devices to devices file
entries, if there is a discrepency between the ondisk PVID
and the devices file PVID, then rematch devices to
devices file entries using PVID, looking at all disks
on the system with the same serial number.

22 months agodevice_id: look for serial number in other locations
David Teigland [Mon, 24 Oct 2022 21:23:36 +0000 (16:23 -0500)]
device_id: look for serial number in other locations

Only /sys/dev/block/major:minor/device/serial was read to find
a disk serial number, but a serial number seems to be reported
more often in other locations, so check these also:
/sys/dev/block/major:minor/device/vpd_pg80
/sys/class/block/vda/serial (for virtio disks only)

22 months agodevice_mapper: vdo V4 avoid messaging
Zdenek Kabelac [Thu, 27 Oct 2022 21:58:42 +0000 (23:58 +0200)]
device_mapper: vdo V4 avoid messaging

With V4 format build table line with compression and
deduplication and skip sending any messages to set up
these parameters.

22 months agodev_manager: accept misalined vdo pools.
Zdenek Kabelac [Wed, 26 Oct 2022 12:38:29 +0000 (14:38 +0200)]
dev_manager: accept misalined vdo pools.

Since lvm2 may create VDO pool virtual size aligned only on extent size
while VDO itself is just 4K aligned - we need to support such misalign.

22 months agodevice_mapper: add parser for vdo metadata
Zdenek Kabelac [Wed, 26 Oct 2022 12:33:09 +0000 (14:33 +0200)]
device_mapper: add parser for vdo metadata

Add very simplistic parser of vdo metadata to be able to obtain
logical_blocks stored within vdo metadata - as lvm2 may
submit smaller value due to internal aligment rules.

To avoid creation of mismatching table line - use this number
instead the one provided by lvm2.

22 months agoconfigure: update use_devicesfile in example.conf
Zdenek Kabelac [Mon, 24 Oct 2022 16:03:42 +0000 (18:03 +0200)]
configure: update use_devicesfile in example.conf

Example.conf missed to properly replace default value for
use_devicesfile setting and left there @VAR@.

22 months agovgchange systemid: use tag or select
David Teigland [Mon, 31 Oct 2022 13:54:33 +0000 (08:54 -0500)]
vgchange systemid: use tag or select

The command can do this but the command defs
were missing the annotation to allow it.

22 months agodevice_id: remove debug trace
David Teigland [Mon, 24 Oct 2022 21:19:05 +0000 (16:19 -0500)]
device_id: remove debug trace

for common case where a device id type is not used.

22 months agocmd: save device_id_sysfs_dir
David Teigland [Mon, 24 Oct 2022 21:15:53 +0000 (16:15 -0500)]
cmd: save device_id_sysfs_dir

read and save device_id_sysfs_dir to avoid spamming
debug output from find_config_tree_str.

22 months agolvmdbusd: Handle PV signature copy
Tony Asleson [Thu, 20 Oct 2022 15:46:51 +0000 (10:46 -0500)]
lvmdbusd: Handle PV signature copy

If something manually copies a PV signature to a block device we will
miss it.  Handle this case too.

22 months agolvmdbustest: Add test for copy signature
Tony Asleson [Thu, 20 Oct 2022 17:48:40 +0000 (12:48 -0500)]
lvmdbustest: Add test for copy signature

Add test to ensure we detect when a PV signature is copied to a block
device.

22 months agolvmdbusd: Always leverage udev
Tony Asleson [Tue, 18 Oct 2022 17:30:09 +0000 (12:30 -0500)]
lvmdbusd: Always leverage udev

Previously we utilized udev until we got a dbus notification from lvm
command line tools.  This however misses the case where something outside
of lvm clears the signatures on a block device and we fail to refresh the
state of the daemon.  Change the behavior so we always monitor udev events,
but ignore those udev events that pertain to lvm members.

Note: --udev command line option no longer does anything and simply
outputs a message that it's no longer used.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1967171

22 months agolvmdbustest: Add test for wipefs
Tony Asleson [Tue, 18 Oct 2022 17:26:14 +0000 (12:26 -0500)]
lvmdbustest: Add test for wipefs

Ensure that if an external program or user calles wipefs on a PV that we
correctly update the state of the daemon.

22 months agolvmnotify.c: Check to see if dbus daemon is running
Tony Asleson [Wed, 19 Oct 2022 17:46:45 +0000 (12:46 -0500)]
lvmnotify.c: Check to see if dbus daemon is running

The lvm dbus daemon will auto activate on dbus API calls.  To
prevent the dbus daemon starting when lvm command line tools are
being used we will check to see if the daemon is running first.
If the daemon is not running, we will not notify the daemon.

For this check to work it requires the changes done previously
with commit: 3fdf4493481ff8baae2ac5416dce6d05b69e6b28

Reviewed-by: David Teigland <teigland@redhat.com>
23 months agolvreduce: change error message about --fs options
David Teigland [Wed, 12 Oct 2022 15:05:14 +0000 (10:05 -0500)]
lvreduce: change error message about --fs options

23 months agolvmlockd: Fix sanlock lvmlock lv size calculation
corubba [Wed, 12 Oct 2022 14:19:01 +0000 (09:19 -0500)]
lvmlockd: Fix sanlock lvmlock lv size calculation

The number of extents for the sanlock lvmlock lv is calculated using
integer division, which rounds towards zero. With a physical extent size
of 129M, instead of the requested 256M the lv is only 129M (1 extent).
With any physical extent size greater than 256M the lv creation fails
because the number of extents is zero.

This is fixed by replacing the integer division with a division macro
that rounds up and thus guarantees that the size of the lv will always
be equal or greater than the requested size. Using the examples above, a
pes of 129M will result in a 258M lv (2 extents), pes of 300M in a 300M
lv (1 extent).

The re-calculation of the lv size in bytes and megabytes is only so the
debug output shows the correct values. The size in mb there is still
not byte-perfect-accurate, but good enough for a human-readable estimate;
and the exact size in bytes and extents is right next to it.

Signed-off-by: corubba <corubba@gmx.de>
23 months agotoollib: do not process just created historical LV
Peter Rajnoha [Wed, 12 Oct 2022 12:41:58 +0000 (14:41 +0200)]
toollib: do not process just created historical LV

When executing process_each_lv_in_vg, we process live LVs first and
after that, we process any historical LVs. In case we have just removed
an LV, which also means we have just made it "historical" and so it
appears as fresh item in vg->historical_lvs list, we have to skip it
when we get to processing historical LVs inside the same process_each_lv_in_vg
call.

The simplest approach here, without introducing another LV list, is to
simply mark such historical LVs as "fresh" directly in struct
historical_logical_volume when we have just removed the original LV
and created the historical LV for it. Then, we just need to check the
flag when processing historical LVs and skip it if it is "fresh".

When we read historical LVs out of metadata, they are marked as
"not fresh" and so they can be processed as usual.

This was mainly an issue in conjuction with -S|--select use:

#  lvmconfig --type diff
metadata {
record_lvs_history=1
}

(In this example, a thin pool with lvol1 thin LV and lvol2 and lvol3 snapshots.)

#  lvs -H vg -o name,pool_lv,full_ancestors,full_descendants
  LV    Pool FAncestors  FDescendants
  lvol1 pool             lvol2,lvol3
  lvol2 pool lvol1       lvol3
  lvol3 pool lvol2,lvol1
  pool

#  lvremove -S 'name=lvol2'
  Logical volume "lvol2" successfully removed.
  Historical logical volume "lvol2" successfully removed.

...here, the historical LV lvol2 should not have been removed because
we have just removed its original non-historical lvol2 and the fresh
historical lvol2 must not be included in the same processing spree.

23 months agolvreduce: require active LV when no fs option is used
David Teigland [Tue, 11 Oct 2022 16:50:47 +0000 (11:50 -0500)]
lvreduce: require active LV when no fs option is used

Without an --fs option set, make lvreduce of an inactive LV
fail and report that the LV must be active.

23 months agotests: add comments to fsadm-renamed
David Teigland [Tue, 11 Oct 2022 16:28:19 +0000 (11:28 -0500)]
tests: add comments to fsadm-renamed

to explain the what and why of the steps that are
not obvious

23 months agolvmlockd: fix warning
David Teigland [Tue, 11 Oct 2022 17:35:38 +0000 (12:35 -0500)]
lvmlockd: fix warning

23 months agotests: skip lvresize tests without mkfs.xfs
David Teigland [Mon, 10 Oct 2022 18:25:50 +0000 (13:25 -0500)]
tests: skip lvresize tests without mkfs.xfs

23 months agolvmdevices: use deviceidtype option strictly
David Teigland [Thu, 15 Sep 2022 14:45:21 +0000 (09:45 -0500)]
lvmdevices: use deviceidtype option strictly

Only use the device id type specified by --deviceidtype,
and fail if that type is not available for the device.

23 months agotests: device ids using vpd data
David Teigland [Tue, 20 Sep 2022 15:54:57 +0000 (10:54 -0500)]
tests: device ids using vpd data

23 months agodevice id: add new types using values from vpd_pg83
David Teigland [Wed, 31 Aug 2022 21:05:07 +0000 (16:05 -0500)]
device id: add new types using values from vpd_pg83

The new device_id types are: wwid_naa, wwid_eui, wwid_t10.
The new types use the specific wwid type in their name.
lvm currently gets the values for these types by reading
the device's vpd_pg83 sysfs file (this could change in the
future if better methods become available for reading the
values.)

If a device is added to the devices file using one of these
types, prior versions of lvm will not recognize the types
and will be unable to use the devices.

When adding a new device, lvm continues to first use sys_wwid
from the sysfs wwid file.  If the device has no sysfs wwid file,
lvm now attempts to use one of the new types from vpd_pg83.

If a devices file entry with type sys_wwid does not match a
given device's sysfs wwid file, the sys_wwid value will also
be compared to that device's other wwids from its vpd_pg83 file.
If the kernel changes the wwid type reported from the sysfs
wwid file, e.g. from a device's t10 id to its naa id, then lvm
should still be able to match it correctly using the vpd_pg83
data which will include both ids.

23 months agodevice id: change space handling in t10 wwid
David Teigland [Wed, 31 Aug 2022 20:59:28 +0000 (15:59 -0500)]
device id: change space handling in t10 wwid

t10 wwids are now edited in the same way that multipath does,
which is replacing a series of spaces with one _.  Previously
lvm replaced every space with one _.  Devices file entries
with the old form will be converted to the new shorter form.

23 months agodevice id wwid adjustments
David Teigland [Tue, 30 Aug 2022 20:10:52 +0000 (15:10 -0500)]
device id wwid adjustments

Move the functions handling dev wwids.

Add dev flags indicating that wwids have been read from
sysfs wwid file or sysfs vpd_pg83 file.  This can be
used to avoid rereading these.

Improve filter-mpath search for a device's wwid in
/etc/multipath/wwids, to avoid unnecessary rereading
of wwids from sysfs files.

Type 8 wwids from vpd_pg83 with naa or eui names should be
saved as those types.

23 months agolvmlockd: purge the lock resources left in previous lockspace
Lidong Zhong [Fri, 30 Sep 2022 08:34:51 +0000 (16:34 +0800)]
lvmlockd: purge the lock resources left in previous lockspace

If lvmlockd in cluster is killed accidently or any other reason, the
lock resources will become orphaned in the VG lockspace. When the
cluster manager tries to restart this daemon, the LVs will probably
become inactive because of resource schedule policy and thus the lock
resouce will be omited during the adoption process. This patch will
try to purge the lock resources left in previous lockspace, so the
following actions can work again.

23 months agolvresize: move the lockd_lv earlier
David Teigland [Fri, 30 Sep 2022 17:16:32 +0000 (12:16 -0500)]
lvresize: move the lockd_lv earlier

the lock should cover any potential activation,
not just the resizing changes

23 months agolvmdbusd: Correct env. variable
Tony Asleson [Fri, 30 Sep 2022 16:49:49 +0000 (11:49 -0500)]
lvmdbusd: Correct env. variable

Make this match the unit test expectation and the form we use for
other env. variables.

23 months agoblkid: fix BLKID_SUBLKS_FSINFO usage
David Teigland [Thu, 29 Sep 2022 20:25:32 +0000 (15:25 -0500)]
blkid: fix BLKID_SUBLKS_FSINFO usage

Use this flag for all fs info lookups, including BLOCK_SIZE,
if it is defined in blkid.h.

23 months agolvresize: give special advice to reiserfs users
David Teigland [Wed, 28 Sep 2022 16:52:40 +0000 (11:52 -0500)]
lvresize: give special advice to reiserfs users

23 months agolvresize: exclude new fs handling at build time
David Teigland [Wed, 28 Sep 2022 16:02:17 +0000 (11:02 -0500)]
lvresize: exclude new fs handling at build time

Exclude the new fs resizing capabilities at build time
(rather than run time) if the necessary libblkid features
are not available.  When excluded, all fs resizing options
are translated to resize_fsadm.  Accessing the new
features now requires rebuilding lvm if libblkid is
upgraded.

23 months agolvresize: let env var set lvresize_fs_helper_path
David Teigland [Tue, 27 Sep 2022 20:39:09 +0000 (15:39 -0500)]
lvresize: let env var set lvresize_fs_helper_path

23 months agoremove unused variables
David Teigland [Tue, 27 Sep 2022 20:40:39 +0000 (15:40 -0500)]
remove unused variables

23 months agochange messages about libblkid features
David Teigland [Tue, 27 Sep 2022 20:10:04 +0000 (15:10 -0500)]
change messages about libblkid features

remove message about missing libblkid features

change message recommending resize_fsadm when libblkid
features are not available.

23 months agolvreduce: use temporary flag when activating lv to check for fs
David Teigland [Tue, 27 Sep 2022 17:59:17 +0000 (12:59 -0500)]
lvreduce: use temporary flag when activating lv to check for fs

This flag is meant to suppress udev processing of the LV.

23 months agomake: move cmds.h
David Teigland [Tue, 27 Sep 2022 14:06:06 +0000 (09:06 -0500)]
make: move cmds.h

generate the header in the include dir so it
can be easily used from both lib and tools dirs.

23 months agolvmdbustest: Add test to stress mode changing
Tony Asleson [Thu, 22 Sep 2022 22:11:45 +0000 (17:11 -0500)]
lvmdbustest: Add test to stress mode changing

Add a test to toggle from fork & exec to lvm shell repeatedly, to stress
test it.

23 months agolvmdbustest: Re-work setUp
Tony Asleson [Thu, 22 Sep 2022 22:10:13 +0000 (17:10 -0500)]
lvmdbustest: Re-work setUp

Place the addCleanup at the end as we don't want to go through clean up
if we don't make it through setUp.  If we don't do this we can remove VGs
that we didn't create in the unit test.

23 months agolvmdbustest: Refuse to remove a VG we didn't create
Tony Asleson [Thu, 22 Sep 2022 21:18:48 +0000 (16:18 -0500)]
lvmdbustest: Refuse to remove a VG we didn't create

One of our previous commits introduced the side effect that we could
inadvertently remove a VG we didn't create, and lose data.

23 months agolvmdbustest: Make vg name suffix more unique
Tony Asleson [Thu, 22 Sep 2022 21:17:20 +0000 (16:17 -0500)]
lvmdbustest: Make vg name suffix more unique

23 months agolvmdbusd: Correct lvm shell signal & child process handling
Tony Asleson [Wed, 21 Sep 2022 15:05:36 +0000 (10:05 -0500)]
lvmdbusd: Correct lvm shell signal & child process handling

Previously when the __del__ method ran on LVMShellProxy we would blindly
call terminate().  This was a race condition as the underlying process
may/maynot be present.  When the process is still present the SIGTERM will
end up being seen by lvmdbusd too.  Re-work the code so that we
first try to wait for the child process to exit and only then if it hasn't
exited will we send it a SIGTERM.  We also ensure that when this is
executed we will briefly ignore a SIGTERM that arrives for the daemon.

23 months agocovscan: free wwid strings in lvmcache
David Teigland [Wed, 21 Sep 2022 17:15:13 +0000 (12:15 -0500)]
covscan: free wwid strings in lvmcache

23 months agomake: generate
Zdenek Kabelac [Fri, 16 Sep 2022 10:52:28 +0000 (12:52 +0200)]
make: generate

23 months agotests: validate CONFIG_HZ_1000
Zdenek Kabelac [Wed, 21 Sep 2022 12:44:05 +0000 (14:44 +0200)]
tests: validate CONFIG_HZ_1000

If we plan to use dm throttling for mirror targets - we actually
have to check whether kernel runs with CONFIG_HZ_1000 - if it does
not the whole idea of throttling is actually not working in the
testsuite as within a single 'tick' with HZ 100 way too much date
is being moved on any modern hardware - and since there is no plan
to change this in kernel - we simply avoid using throttling on such
kernel and test needs to work differently - either ignore results
or use much larger mirror sizes...

23 months agotests: discard update
Zdenek Kabelac [Fri, 16 Sep 2022 10:52:08 +0000 (12:52 +0200)]
tests: discard update

23 months agomakefiles: use single libs definition
Zdenek Kabelac [Mon, 5 Sep 2022 13:57:21 +0000 (15:57 +0200)]
makefiles: use single libs definition

23 months agotests: integrity switch to ext4
Zdenek Kabelac [Fri, 9 Sep 2022 11:33:28 +0000 (13:33 +0200)]
tests: integrity switch to ext4

Since we would need to create a lot of 300M filesystem,
switch this test suite to ext4.

23 months agolvmdbusd: Register for SIGTERM
Tony Asleson [Tue, 20 Sep 2022 19:28:57 +0000 (14:28 -0500)]
lvmdbusd: Register for SIGTERM

Ensure we log that we are exiting on this signal too.

23 months agolvmdbusd: Correct get_object_path_by_uuid_lvm_id
Tony Asleson [Tue, 20 Sep 2022 16:40:15 +0000 (11:40 -0500)]
lvmdbusd: Correct get_object_path_by_uuid_lvm_id

When checking to see if the PV is missing we incorrectly checked that the
path_create was equal to PV creation.  However, there are cases where we
are doing a lookup where the path_create == None.  In this case, we would
fail to set lvm_id == None which caused a problem as we had more than 1
PV that was missing.  When this occurred, the second lookup matched the
first missing PV that was added to the object manager.  This resulted in
the following:

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/lvmdbusd/utils.py", line 667, in _run
    self.rc = self.f(*self.args)
  File "/usr/lib/python3.9/site-packages/lvmdbusd/fetch.py", line 25, in _main_thread_load
    (changes, remove) = load_pvs(
  File "/usr/lib/python3.9/site-packages/lvmdbusd/pv.py", line 46, in load_pvs
    return common(
  File "/usr/lib/python3.9/site-packages/lvmdbusd/loader.py", line 55, in common
    del existing_paths[dbus_object.dbus_object_path()]

Because we expect to find the object in existing_paths if we found it in
the lookup.

resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2085078

23 months agomake: Fix build in chroot dev-mcsontos-lib-tools-dependency
Marian Csontos [Tue, 20 Sep 2022 13:56:13 +0000 (15:56 +0200)]
make: Fix build in chroot

When building in a buildroot, must create libexec directory explicitly.

23 months agospec: Workaround for failing build
Marian Csontos [Tue, 20 Sep 2022 13:12:44 +0000 (15:12 +0200)]
spec: Workaround for failing build

Commit 18722dfdf4d3e6f172d0b2af8bbdc4a154ea1dc0 introduced a dependency
on file from tools/ into lib/.

TODO: revert this once the issue is resolved.

23 months agolvmdbusd: Remove --reportformat
Tony Asleson [Wed, 14 Sep 2022 18:11:47 +0000 (13:11 -0500)]
lvmdbusd: Remove --reportformat

Latest upstream build of lvm results in the following error when
trying to use lvmshell.

"Argument --reportformat cannot be used in interactive mode.,
Error during parsing of command line."

23 months agolvmdbustest: Add wrapper for injecting errors
Tony Asleson [Fri, 9 Sep 2022 21:05:11 +0000 (16:05 -0500)]
lvmdbustest: Add wrapper for injecting errors

Useful for forcing lvmdbusd down error paths.

23 months agolvmdbusd: Include lvm debug output for lvmshell
Tony Asleson [Fri, 9 Sep 2022 15:03:35 +0000 (10:03 -0500)]
lvmdbusd: Include lvm debug output for lvmshell

Move the option to add the debug file into lvm_full_report_json so that
we collect the debug data when we fork & exec lvm and when we use lvm
shell.

23 months agolvmdbusd: Call readlines instead of readline
Tony Asleson [Thu, 8 Sep 2022 20:42:26 +0000 (15:42 -0500)]
lvmdbusd: Call readlines instead of readline

Better to drain everything we have now that our IO is line orientated
when using a ptty.

23 months agolvmdbusd: Raise IOError instead of ignoring
Tony Asleson [Thu, 8 Sep 2022 20:41:20 +0000 (15:41 -0500)]
lvmdbusd: Raise IOError instead of ignoring

We end up in a bad state if we simply eat IOErrors here.  Exit the lvmshell
process and raise the IOError.

23 months agolvmdbusd: Correct log_error for shell proxy
Tony Asleson [Thu, 8 Sep 2022 20:40:03 +0000 (15:40 -0500)]
lvmdbusd: Correct log_error for shell proxy

23 months agolvmdbusd: Check for KeyError in refresh
Tony Asleson [Thu, 8 Sep 2022 20:39:30 +0000 (15:39 -0500)]
lvmdbusd: Check for KeyError in refresh

Bubble up a LvmBug if we get a KeyError on a lvm column name.

23 months agolvmdbusd: Use common func. for checking missing LV keys
Tony Asleson [Thu, 8 Sep 2022 20:38:31 +0000 (15:38 -0500)]
lvmdbusd: Use common func. for checking missing LV keys

23 months agolvmdbusd: Correct undefined var
Tony Asleson [Thu, 8 Sep 2022 20:37:34 +0000 (15:37 -0500)]
lvmdbusd: Correct undefined var

23 months agolvmdbustest: Check for self.pvs
Tony Asleson [Thu, 8 Sep 2022 20:29:55 +0000 (15:29 -0500)]
lvmdbustest: Check for self.pvs

If we don't make it through setUp, self.pvs will not exist.

23 months agolvmdbustest: Move signals to last
Tony Asleson [Thu, 8 Sep 2022 20:28:52 +0000 (15:28 -0500)]
lvmdbustest: Move signals to last

When we do the signal testing we default back to fork & exec.  Put these
on the end to maximize our lvm shell testing until we fix this proper.

23 months agolvmdbusd: Handle 'exit' for lvm_shell_proxy
Tony Asleson [Tue, 6 Sep 2022 21:24:20 +0000 (16:24 -0500)]
lvmdbusd: Handle 'exit' for lvm_shell_proxy

Useful for testing `exit_shell` when running interactively.

23 months agolvmdbusd: Use pseudo tty to get "lvm>" prompt again
Tony Asleson [Tue, 6 Sep 2022 21:23:06 +0000 (16:23 -0500)]
lvmdbusd: Use pseudo tty to get "lvm>" prompt again

When lvm is compiled with editline, if the file descriptors don't look like
a tty, then no "lvm> " prompt is done.  Having lvm output the shell prompt
when consuming JSON on a report file descriptor is very useful in
determining if lvm command is complete.

23 months agolvmdbusd: Remove PID from log messages
Tony Asleson [Thu, 1 Sep 2022 02:25:36 +0000 (21:25 -0500)]
lvmdbusd: Remove PID from log messages

Previously the daemon would output PID:TID.  If it's running under systemd
it skips outputting PID as systemd already does this.

23 months agolvmdbustest: Utilize addCleanup in unit test
Tony Asleson [Wed, 31 Aug 2022 23:03:16 +0000 (18:03 -0500)]
lvmdbustest: Utilize addCleanup in unit test

Register the clean up with addCleanup so we ensure clean_up gets run
regardless of what happens in setUp.

23 months agolvmdbusd: Remove duplicate code
Tony Asleson [Wed, 31 Aug 2022 20:42:48 +0000 (15:42 -0500)]
lvmdbusd: Remove duplicate code

The logic for _cache_lv and _writecache_lv was identical except for which
underlying lvm command to run.  Factor out common.

23 months agolvmdbusd: Raise LvmBug exception for invalid JSON
Tony Asleson [Wed, 31 Aug 2022 20:08:09 +0000 (15:08 -0500)]
lvmdbusd: Raise LvmBug exception for invalid JSON

This will cause lvm debug data to get logged if it's available.

23 months agolvmdbusd: Instruct lvm to output debug to file for fullreport
Tony Asleson [Wed, 31 Aug 2022 20:04:59 +0000 (15:04 -0500)]
lvmdbusd: Instruct lvm to output debug to file for fullreport

Historically we have seen a few different errors which occur when we call
fullreport.  Failing exit code and JSON which is missing one or more keys.
Instruct lvm to dump the debug to a file during fullreport calls when we
fork & exec lvm. If we encounter an error, ouput the debug data.
The reason this isn't being done when lvmshell is used is because we
don't have an easy way to test the error paths.

This change is complicated by the following:

1. We don't know if fullreport was good until we evaluate all the JSON.
   This is done a bit after we have called into lvm and returned.
2. We don't want to orphan the debug file used by lvm if the daemon is
   killed. Thus we try to minimize the window where the debug file hasn't
   already been unlinked.  A RFE to pass an open FD to lvm for this
   purpose is outstanding.

The temp. file is:
-rw------. 1 root root /tmp/lvmdbusd.lvm.debug.XXXXXXXX.log

23 months agolvmdbusd: Re-work error handling
Tony Asleson [Wed, 31 Aug 2022 16:20:49 +0000 (11:20 -0500)]
lvmdbusd: Re-work error handling

Introduce an exception which is used for known existing issues with lvm.
This is used to distinguish between errors between lvm itself and lvmdbusd.
In the case of lvm bugs, when we simply retry the operation we will log
very little.  Otherwise, we will dump a full traceback for investigation
when we do the retry.

23 months agolvmdbusd: Use common function for traceback
Tony Asleson [Wed, 31 Aug 2022 16:18:55 +0000 (11:18 -0500)]
lvmdbusd: Use common function for traceback

We were using a number of different ways to achieve the same result.  Use
a common function to make this consistent.

23 months agolvmdbusd: Don't output debug for fullreport exit code 5
Tony Asleson [Wed, 31 Aug 2022 16:05:36 +0000 (11:05 -0500)]
lvmdbusd: Don't output debug for fullreport exit code 5

This is expected with an exported vg

23 months agolvmdbustest: Skip test_nesting if scan_lvs is not enabled
Tony Asleson [Tue, 30 Aug 2022 17:47:14 +0000 (12:47 -0500)]
lvmdbustest: Skip test_nesting if scan_lvs is not enabled

23 months agolvmdbusd: refactor and correct fetch thread logic
Tony Asleson [Mon, 29 Aug 2022 21:18:06 +0000 (16:18 -0500)]
lvmdbusd: refactor and correct fetch thread logic

Simplify the fetch thread and correct the logic used for selecting the
options which are used when we batch update a state refresh.

23 months agolvmdbusd: Re-work error handling for run_cmd
Tony Asleson [Fri, 26 Aug 2022 18:01:05 +0000 (13:01 -0500)]
lvmdbusd: Re-work error handling for run_cmd

Instead of lumping all the exceptions, break them out to handle the dbus
exceptions separately, to reduce the amount of debug information that ends
up in the journal that has questionable value.

23 months agolvmdbusd: Handle SIGINT quietly
Tony Asleson [Fri, 26 Aug 2022 16:10:24 +0000 (11:10 -0500)]
lvmdbusd: Handle SIGINT quietly

Change how we exit on SIGINT so that we don't output needless debug.

23 months agolvmdbusd: Don't report recoverable error
Tony Asleson [Thu, 25 Aug 2022 14:33:50 +0000 (09:33 -0500)]
lvmdbusd: Don't report recoverable error

Lvm occasionally fails to return all the request JSON keys in the output of
"fullreport".  This happens very rarely.  When it does the daemon was reporting
the resulting informational exception:

MThreadRunner: exception
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/lvmdbusd/utils.py", line 667, in _run
    self.rc = self.f(*self.args)
  File "/usr/lib/python3.9/site-packages/lvmdbusd/fetch.py", line 40, in _main_thread_load
    (lv_changes, remove) = load_lvs(
  File "/usr/lib/python3.9/site-packages/lvmdbusd/lv.py", line 143, in load_lvs
    return common(
  File "/usr/lib/python3.9/site-packages/lvmdbusd/loader.py", line 37, in common
    objects = retrieve(search_keys, cache_refresh=False)
  File "/usr/lib/python3.9/site-packages/lvmdbusd/lv.py", line 95, in lvs_state_retrieve
    l['vdo_operating_mode'],
KeyError: 'vdo_operating_mode'

The daemon retries the operation, which usually works and the daemon continues.
However, simply reporting this informational stack trace is causing CI and other
automated tests to fail as they expect no tracebacks in the log output.

Remove the reporting of this code path unless it persists and causes the daemon
to give up and exit.

Ref: https://bugzilla.redhat.com/show_bug.cgi?id=2120267

23 months agolvmdbusd: WS, imports, grammar
Tony Asleson [Thu, 25 Aug 2022 13:33:50 +0000 (08:33 -0500)]
lvmdbusd: WS, imports, grammar

23 months agolvmdbusd: Add debug circular buffer
Tony Asleson [Wed, 17 Aug 2022 22:24:08 +0000 (17:24 -0500)]
lvmdbusd: Add debug circular buffer

When the daemon isn't started with --debug we will keep a circular
buffer of the past N number of debug messages which we will output
when we encounter an issue.

23 months agolvmdbustest: Skip test_singleton_daemon running systemd svc.
Tony Asleson [Wed, 24 Aug 2022 20:41:03 +0000 (15:41 -0500)]
lvmdbustest: Skip test_singleton_daemon running systemd svc.

23 months agolvmdbusd: Set LVM_COMMAND_PROFILE=lvmdbusd
Tony Asleson [Wed, 24 Aug 2022 20:37:56 +0000 (15:37 -0500)]
lvmdbusd: Set LVM_COMMAND_PROFILE=lvmdbusd

We need this to prevent lvm from interleaving the JSON output with errors
written to stderr.

This page took 0.074181 seconds and 5 git commands to generate.