]> sourceware.org Git - lvm2.git/log
lvm2.git
2 years agolvmdbusd: Correct undefined var
Tony Asleson [Thu, 8 Sep 2022 20:37:34 +0000 (15:37 -0500)]
lvmdbusd: Correct undefined var

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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.

2 years 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

2 years 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.

2 years 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.

2 years 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

2 years 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

2 years 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.

2 years 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.

2 years 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.

2 years 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

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

2 years 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.

2 years 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.

2 years 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.

2 years agolvmdbustest: Add systemctl daemon start
Tony Asleson [Tue, 23 Aug 2022 15:54:22 +0000 (10:54 -0500)]
lvmdbustest: Add systemctl daemon start

2 years agolvmdbustest: Add test for ensuring only 1 instance of daemon
Tony Asleson [Tue, 23 Aug 2022 15:31:31 +0000 (10:31 -0500)]
lvmdbustest: Add test for ensuring only 1 instance of daemon

2 years agolvmdbustest: Add test_sigint test
Tony Asleson [Tue, 23 Aug 2022 15:30:53 +0000 (10:30 -0500)]
lvmdbustest: Add test_sigint test

Get the daemon busy and send it SIGINT to ensure the daemon exits.

2 years agolvmdbustest: Add optional option to _create_num_lvs
Tony Asleson [Tue, 23 Aug 2022 15:29:26 +0000 (10:29 -0500)]
lvmdbustest: Add optional option to _create_num_lvs

This allows us to create the LVs async., thus queuing them up in daemon.

2 years agolvmdbustest: Factor out tearDown implementation for re-use
Tony Asleson [Tue, 23 Aug 2022 15:28:27 +0000 (10:28 -0500)]
lvmdbustest: Factor out tearDown implementation for re-use

2 years agolvmdbustest: Add DaemonInfo class
Tony Asleson [Tue, 23 Aug 2022 15:27:30 +0000 (10:27 -0500)]
lvmdbustest: Add DaemonInfo class

This class handles identifying daemon, sending signals to it, and starting
it back up again.

2 years agolvmdbusd: Correct typos
Tony Asleson [Tue, 23 Aug 2022 15:24:37 +0000 (10:24 -0500)]
lvmdbusd: Correct typos

2 years agolvmdbusd: fix hangs on SIGINT
Tony Asleson [Wed, 17 Aug 2022 22:21:19 +0000 (17:21 -0500)]
lvmdbusd: fix hangs on SIGINT

Rather than trying to bubble up return codes that get us to exit cleanly
it's better to just raise an exception to bail.  In some cases functions
don't have return codes, so they cannot be checked.

2 years agolvmdbustest: Add test removing incomplete job
Tony Asleson [Wed, 17 Aug 2022 17:14:02 +0000 (12:14 -0500)]
lvmdbustest: Add test removing incomplete job

When you try to remove a job that is incomplete you get a dbus exception.
Test for this error condition.

2 years agolvmdbustest: Add test for external event
Tony Asleson [Wed, 17 Aug 2022 17:12:17 +0000 (12:12 -0500)]
lvmdbustest: Add test for external event

Ensure that when we trigger an external event that we don't incorrectly
handle multiple --config options.

2 years agolvmdbustest: Add test for passing log file in options
Tony Asleson [Wed, 17 Aug 2022 17:11:07 +0000 (12:11 -0500)]
lvmdbustest: Add test for passing log file in options

2 years agolvmdbusd: Remove unused locking functionality
Tony Asleson [Wed, 17 Aug 2022 17:09:30 +0000 (12:09 -0500)]
lvmdbusd: Remove unused locking functionality

I don't think we have ever utilized this, remove.

2 years agolvmdbusd: Make sure to set cfg.got_external_event
Tony Asleson [Wed, 17 Aug 2022 17:08:16 +0000 (12:08 -0500)]
lvmdbusd: Make sure to set cfg.got_external_event

We were incorrectly only setting this if --udev wasn't present on the
command line.  In all cases when we see a manager.ExternalEvent we want
to set this.

2 years agolvmdbusd: Correct typos
Tony Asleson [Wed, 17 Aug 2022 17:06:17 +0000 (12:06 -0500)]
lvmdbusd: Correct typos

2 years agolvmdbusd: Handle no lastlog
Tony Asleson [Wed, 17 Aug 2022 17:05:06 +0000 (12:05 -0500)]
lvmdbusd: Handle no lastlog

Depending on when an occurs, it maynot have any information available for
lastlog.  In this case try to grab an error message from the original
response.

2 years agolvmdbustest: nesting improvements
Tony Asleson [Wed, 10 Aug 2022 18:59:11 +0000 (13:59 -0500)]
lvmdbustest: nesting improvements

2 years agolvmdbusd: Remove exclusionary language
Tony Asleson [Tue, 9 Aug 2022 22:55:27 +0000 (17:55 -0500)]
lvmdbusd: Remove exclusionary language

2 years agolvmdbusd: Remove unneeded command line args
Tony Asleson [Tue, 9 Aug 2022 22:45:04 +0000 (17:45 -0500)]
lvmdbusd: Remove unneeded command line args

2 years agolvmdbusd: Add SIGUSR2 to dump flight recorder
Tony Asleson [Tue, 9 Aug 2022 22:44:10 +0000 (17:44 -0500)]
lvmdbusd: Add SIGUSR2 to dump flight recorder

2 years agolvmdbusd: Re-work flight recorder data
Tony Asleson [Tue, 9 Aug 2022 22:43:00 +0000 (17:43 -0500)]
lvmdbusd: Re-work flight recorder data

Introduce a new lock for the flight recorder, so that we can dump it when
a command is block waiting for lvm to complete.  Also in all paths we will
addthe metadata to the flight recorder before it's done, so we will have
it when a command hangs and we dump the flight recorder. Add the missing
bits after the command has finished.

Cleaned up the output too.

2 years agolvmdbustest: Remove force exception in _wait_for_job
Tony Asleson [Tue, 9 Aug 2022 22:36:54 +0000 (17:36 -0500)]
lvmdbustest: Remove force exception in _wait_for_job

We put this in to test one of the paths in the damon, but unfortunately
if we hit the race condition where the job actually is done we will try
to call j.Wait(1) after the remove.  This fails with:

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod:
Method "Wait" with signature "i" on interface "com.redhat.lvmdbus1.Job"
doesn't exist

Which is caused by the dbus object no longer existing.  We could handle
this, but the issue is we no longer have the ability to get the result to
return, they have been lost.

A better solution would be to write a specific unit test to force this code
path and handle all the possible outcomes.

2 years agolvmdbusd: Add lockfile
Tony Asleson [Tue, 9 Aug 2022 01:48:10 +0000 (20:48 -0500)]
lvmdbusd: Add lockfile

The daemon cannot handle multiple copies of itself running at the
same time, ensure this cannot happen.

2 years agolvmdbusd: Move arg. setup/checking to function
Tony Asleson [Tue, 9 Aug 2022 01:44:32 +0000 (20:44 -0500)]
lvmdbusd: Move arg. setup/checking to function

2 years agolvmdbusd: Remove addl. checks on --nojson
Tony Asleson [Mon, 8 Aug 2022 21:08:23 +0000 (16:08 -0500)]
lvmdbusd: Remove addl. checks on --nojson

We check earlier that if you specify --nojson we will exit.

2 years agolvmdbustest: Include major number 259
Tony Asleson [Mon, 8 Aug 2022 15:03:52 +0000 (10:03 -0500)]
lvmdbustest: Include major number 259

When you have > 16 partitions for a block device the major number
changes, include them for testing.

2 years agolvmdbustest: Use updated pyudev syntax
Tony Asleson [Mon, 8 Aug 2022 15:02:37 +0000 (10:02 -0500)]
lvmdbustest: Use updated pyudev syntax

Previous syntax has been deprecated.

2 years agovgremove: remove online files in run dir
David Teigland [Wed, 14 Sep 2022 14:13:58 +0000 (09:13 -0500)]
vgremove: remove online files in run dir

These files are automatically cleared on reboot given
that /run is tmpfs, and that remains the primary way
of clearing online files.

But, if there's extreme use of vgcreate+pvscan+vgremove
between reboots, then removing online files in vgremove
will limit the number of unused online files using space
in /run.

2 years agoconfigure: update
Marian Csontos [Wed, 14 Sep 2022 13:16:30 +0000 (15:16 +0200)]
configure: update

2 years agotests: skip new lvresize tests when missing new libblkid
David Teigland [Tue, 13 Sep 2022 20:37:10 +0000 (15:37 -0500)]
tests: skip new lvresize tests when missing new libblkid

2 years agolvresize: add new options and defaults for fs handling
David Teigland [Tue, 14 Jun 2022 20:20:21 +0000 (15:20 -0500)]
lvresize: add new options and defaults for fs handling

The new option "--fs String" for lvresize/lvreduce/lvextend
controls the handling of file systems before/after resizing
the LV.  --resizefs is the same as --fs resize.

The new option "--fsmode String" can be used to control
mounting and unmounting of the fs during resizing.

Possible --fs values:

checksize
  Only applies to reducing size; does nothing for extend.
  Check the fs size and reduce the LV if the fs is not using
  the affected space, i.e. the fs does not need to be shrunk.
  Fail the command without reducing the fs or LV if the fs is
  using the affected space.

resize
  Resize the fs using the fs-specific resize command.
  This may include mounting, unmounting, or running fsck.
  See --fsmode to control mounting behavior, and --nofsck to
  disable fsck.

resize_fsadm
  Use the old method of calling fsadm to handle the fs
  (deprecated.) Warning: this option does not prevent lvreduce
  from destroying file systems that are unmounted (or mounted
  if prompts are skipped.)

ignore
  Resize the LV without checking for or handling a file system.
  Warning: using ignore when reducing the LV size may destroy the
  file system.

Possible --fsmode values:

manage
  Mount or unmount the fs as needed to resize the fs,
  and attempt to restore the original mount state at the end.

nochange
  Do not mount or unmount the fs. If mounting or unmounting
  is required to resize the fs, then do not resize the fs or
  the LV and fail the command.

offline
  Unmount the fs if it is mounted, and resize the fs while it
  is unmounted. If mounting is required to resize the fs,
  then do not resize the fs or the LV and fail the command.

Notes on lvreduce:

When no --fs or --resizefs option is specified:
. lvextend default behavior is fs ignore.
. lvreduce default behavior is fs checksize
  (includes activating the LV.)

With the exception of --fs resize_fsadm|ignore, lvreduce requires
the recent libblkid fields FSLASTBLOCK and FSBLOCKSIZE.
FSLASTBLOCK*FSBLOCKSIZE is the last byte used by the fs on the LV,
which determines if reducing the fs is necessary.

2 years agolvresize: restructure code
David Teigland [Fri, 9 Sep 2022 21:07:07 +0000 (16:07 -0500)]
lvresize: restructure code

Rewrite top level resize function to prepare for adding
new fs resizing.

2 years agoremove libblkid flag BLKID_SUBLKS_FSINFO
David Teigland [Fri, 9 Sep 2022 21:14:27 +0000 (16:14 -0500)]
remove libblkid flag BLKID_SUBLKS_FSINFO

This flag is not needed in fs_block_size_and_type()
added in the previous commit.

2 years agofix fs block size detection
David Teigland [Fri, 9 Sep 2022 20:16:56 +0000 (15:16 -0500)]
fix fs block size detection

blkid_get_tag_value() is not a reliable way to query the fs
BLOCK_SIZE, so use the "probe" functions instead.

2 years agogitignore: update
Zdenek Kabelac [Mon, 5 Sep 2022 10:08:50 +0000 (12:08 +0200)]
gitignore: update

2 years agotests: cache use 300M XFS
Zdenek Kabelac [Tue, 6 Sep 2022 23:02:29 +0000 (01:02 +0200)]
tests: cache use 300M XFS

2 years agotests: fsadm 300m xfs
Zdenek Kabelac [Wed, 31 Aug 2022 10:22:59 +0000 (12:22 +0200)]
tests: fsadm 300m xfs

2 years agotests: writecache adapt to 300M XFS
Zdenek Kabelac [Tue, 6 Sep 2022 17:00:55 +0000 (19:00 +0200)]
tests: writecache adapt to 300M XFS

2 years agotests: use conv=fdatasync
Zdenek Kabelac [Tue, 6 Sep 2022 16:47:03 +0000 (18:47 +0200)]
tests: use conv=fdatasync

When we only need wait for result - avoid using slow 'oflag=sync'
with virtual layers

2 years agotests: add /dev requirement
Zdenek Kabelac [Tue, 6 Sep 2022 16:00:28 +0000 (18:00 +0200)]
tests: add /dev requirement

This test could only be run when user passes  LVM_TEST_DEVDIR=/dev
as it requires and expects actions to be going in this dir, skip
otherwise.

Also 'extend_filter' manages multiple args in on lvm.conf update.

2 years agotests: add thin requirement
Zdenek Kabelac [Tue, 6 Sep 2022 15:59:25 +0000 (17:59 +0200)]
tests: add thin requirement

2 years agotests: lvextend update for 300M XFS
Zdenek Kabelac [Wed, 31 Aug 2022 12:30:01 +0000 (14:30 +0200)]
tests: lvextend update for 300M XFS

2 years agotests: no caching for blkid in testing
Zdenek Kabelac [Wed, 31 Aug 2022 12:14:59 +0000 (14:14 +0200)]
tests: no caching for blkid in testing

2 years agotests: make damage optional
Zdenek Kabelac [Wed, 31 Aug 2022 12:07:46 +0000 (14:07 +0200)]
tests: make damage optional

Investigate how to damage thin-pool across different versions/platforms.
Until them - use  'should' for test result.

2 years agotests: check for at least 1G of RAM
Zdenek Kabelac [Wed, 31 Aug 2022 11:57:41 +0000 (13:57 +0200)]
tests: check for at least 1G of RAM

This test requires quite some RAM to be there.

2 years agotests: remove slash
Zdenek Kabelac [Wed, 31 Aug 2022 11:26:30 +0000 (13:26 +0200)]
tests: remove slash

2 years agotests: skip this test for 5.19
Zdenek Kabelac [Wed, 7 Sep 2022 12:54:39 +0000 (14:54 +0200)]
tests: skip this test for 5.19

mdraid has some breakage - so 5.19 is crashing
(possibly even some more older version - that can be added as well)
Test seems to pass with 6.0-rc kernel.

2 years agotests: vdo emulation without vdo binary
Zdenek Kabelac [Tue, 6 Sep 2022 14:44:24 +0000 (16:44 +0200)]
tests: vdo emulation without vdo binary

Avoid inserting 'vdo' binary into path - and use
alias and VDO_BINARY shell vars for emulation.

2 years agotests: rework makefile
Zdenek Kabelac [Thu, 1 Sep 2022 08:06:14 +0000 (10:06 +0200)]
tests: rework makefile

Improve dependency tracking
Use 'foreach()' with better tracing support
Link whole 'shell' dir instead of linking individual *.sh files

2 years agomake: update make.tmpl
Zdenek Kabelac [Mon, 5 Sep 2022 13:56:58 +0000 (15:56 +0200)]
make: update make.tmpl

Add new define 'newline' for use in 'foreach()'
Add new $(SHOW) for makefile printing output
Add 'make print-VAR' for easier debugging of Makefiles' variables.

2 years agopython: variable without destdir
Zdenek Kabelac [Tue, 6 Sep 2022 14:09:39 +0000 (16:09 +0200)]
python: variable without destdir

PYTHON_PREFIX without $(DESTDIR)

2 years agogcc: eliminate warnings
Zdenek Kabelac [Mon, 5 Sep 2022 14:22:32 +0000 (16:22 +0200)]
gcc: eliminate warnings

Gcc starts to show new warning - although unlikely to be able to hit
initialize variables to 0.

2 years agoreport: fix lv_active column type from STR to BIN
Peter Rajnoha [Tue, 6 Sep 2022 12:40:06 +0000 (14:40 +0200)]
report: fix lv_active column type from STR to BIN

Fix lv_active to be of BIN type instead of STR. This allows lv_active to
follow the report/binary_values_as_numeric setting as well as --binary
cmd line switch. Also, it makes it possible to use -S|--select with
either textual or numeric representation of the value, like 'lvs -S
active=active' but also 'lvs -S active=1'.

2 years agovgimportdevices: fix locking when creating devices file
David Teigland [Tue, 30 Aug 2022 19:40:48 +0000 (14:40 -0500)]
vgimportdevices: fix locking when creating devices file

Take the devices file lock before creating a new devices file.
(Was missed by the change to preemptively create the devices
file prior to setup_devices(), which was done to improve the
error path.)

2 years agovgimportdevices: change result when devices are not added
David Teigland [Mon, 29 Aug 2022 20:17:36 +0000 (15:17 -0500)]
vgimportdevices: change result when devices are not added

When using --all, if one VG is skipped, continue adding
other VGs, and do not return an error from the command
if some VGs are added. (A VG is skipped if it's missing PVs.)

If the command fails during devices file setup or device
scanning, then remove the devices file if it has been
newly created by the command, and exit with an error.

If devices from a named VG are not imported (e.g. the
VG is missing devices), then remove the devices file if
it has been newly created by the command, and exit with
an error.

If --all VGs are being imported, and no devices are found
to include in the devices file, then remove the devices
file if it has been newly created by the command, and
exit with an error.

2 years agomm: use mallinfo2 when available
Zdenek Kabelac [Tue, 30 Aug 2022 11:48:18 +0000 (13:48 +0200)]
mm: use mallinfo2 when available

Switch to mallinfo2() from a deprecated mallinfo() glibc call
since struct size members where to small for 64b CPUs.

2 years agomm: preallocate memory only with glibc
Zdenek Kabelac [Fri, 19 Aug 2022 14:15:17 +0000 (16:15 +0200)]
mm: preallocate memory only with glibc

Use mallinfo() only with glibc.

2 years agoconfigure: remove some obsolete or duplicate checks
Zdenek Kabelac [Tue, 30 Aug 2022 11:36:52 +0000 (13:36 +0200)]
configure: remove some obsolete or duplicate checks

As autoupdate suggested, drop unneeded checks.

2 years agoconfigure: check for mallinfo2
Zdenek Kabelac [Tue, 30 Aug 2022 11:28:24 +0000 (13:28 +0200)]
configure: check for mallinfo2

2 years agothin: rename internal function
Zdenek Kabelac [Wed, 24 Aug 2022 13:02:07 +0000 (15:02 +0200)]
thin: rename internal function

Names matching internal code layout.
Functionc in thin_manip.c uses thin_pool in its name.
Keep 'pool' only for function working for both cache and thin pools.

No change of functionality.

2 years agoreport: values: add note about self-decriptive values to report
Peter Rajnoha [Fri, 26 Aug 2022 12:51:31 +0000 (14:51 +0200)]
report: values: add note about self-decriptive values to report

2 years agoargs: add ARG_NONINTERACTIVE for cmds not supported in lvm shell
Peter Rajnoha [Fri, 26 Aug 2022 10:17:45 +0000 (12:17 +0200)]
args: add ARG_NONINTERACTIVE for cmds not supported in lvm shell

Certain args can't be used in lvm shell ("interactive mode") because
they are not supported there. Add ARG_NONINTERACTIVE flag to mark
such args and error out if we're in interactive mode and at the same
time we detect use of such argument.

Currently, this is the case for --reportformat arg - we don't support
changing the format per command in lvm shell. The whole shell is running
under a reportformat chosen at shell's start.

2 years agolibdm: report: fix escaping of JSON quote char in reported fields
Peter Rajnoha [Wed, 24 Aug 2022 10:08:51 +0000 (12:08 +0200)]
libdm: report: fix escaping of JSON quote char in reported fields

Commit 73ec3c954b21522352b6f5cce9a700d6bf30ccf4 added a way to print
only a part of the report string (repstr) to support decoding individual
string list items out of repstr.

The repstr is normally printed through _safe_repstr_output so that any
JSON_QUOTE character ('"') found within the repstr is escaped to not
interfere with value quoting in JSON format.

However, the commit 73ec3c954b21522352b6f5cce9a700d6bf30ccf4 missed
checking the 'len' argument passed to _safe_repstr_output function when
adding the rest of the repstr after all previous JSON_QUOTE characters
were escaped (when calling the last dm_pool_grow_object). When 'len'
is 0, we need to calculate the 'len' ourselves in the function by
simply calling strlen. This is because 'len' is passed to the function
only if we're taking a part of repstr, not as a whole.

2 years agoshell: add pre-cmd log report object type and enable lastlog for it
Peter Rajnoha [Mon, 22 Aug 2022 11:59:08 +0000 (13:59 +0200)]
shell: add pre-cmd log report object type and enable lastlog for it

If we failed or logged anything before we actually execute given command
in lvm shell, we couldn't report the log using lastlog command after.
This patch adds specific 'pre-cmd' log report object type to identify
such log messages and enables lastlog to report even this log.

2 years agodevices file: fix pvcreate --uuid matching pvid entry with no device id
David Teigland [Fri, 19 Aug 2022 18:31:22 +0000 (13:31 -0500)]
devices file: fix pvcreate --uuid matching pvid entry with no device id

pvcreate with --uuid would segfault if a devices file entry matched
the specified pvid, but the devices file entry had no device_id, which
could happen if the entry has a devname idtype.

2 years agodevices: drop double // from sysfs path
Zdenek Kabelac [Wed, 10 Aug 2022 13:09:34 +0000 (15:09 +0200)]
devices: drop double // from sysfs path

dm_sysfs_dir() comes internally as  /sys/.

2 years agodmsetup: check also for ouf of range value
Zdenek Kabelac [Thu, 18 Aug 2022 11:56:03 +0000 (13:56 +0200)]
dmsetup: check also for ouf of range value

Check errno result from strtoull().

2 years agomm: remove libaio from being skipped
Zdenek Kabelac [Thu, 18 Aug 2022 12:31:27 +0000 (14:31 +0200)]
mm: remove libaio from being skipped

Since libaio is now used also in critical section,
keep the libaio locked in memory.

2 years agovdo: extend volume and pool without flush
Zdenek Kabelac [Fri, 19 Aug 2022 12:48:01 +0000 (14:48 +0200)]
vdo: extend volume and pool without flush

When the volume size is extended, there is no need to flush
IO operations (nothing can be targeting new space yet).
VDO target is supported as target that can safely work with
this condition.

Such support is also needed, when extending VDOPOOL size
while the pool is reaching its capacity - since this allows
to continue working without reaching 'out-of-space' condition
due to flushing of all in flight IO.

2 years agovdo: reset errno before strtoull
Zdenek Kabelac [Thu, 18 Aug 2022 11:55:29 +0000 (13:55 +0200)]
vdo: reset errno before strtoull

Missed errno reset in commit ebad057579aeff0980a1b8af7eaacd56e62ed0c9.

2 years agoconfig: check for possible mempool errors in _out_line_fn
Peter Rajnoha [Wed, 17 Aug 2022 10:51:42 +0000 (12:51 +0200)]
config: check for possible mempool errors in _out_line_fn

2 years agoconfig: remove unnecessary copy of config line's space prefix before printing
Peter Rajnoha [Wed, 17 Aug 2022 08:11:05 +0000 (10:11 +0200)]
config: remove unnecessary copy of config line's space prefix before printing

When we wanted to insert '#' before a config line (to comment it out),
we used dm_pool_strndup to temporarily copy the space prefix first so
we can assemble the final line with:

   "<space_prefix># <key>=<value>":

out of original:

  "<space_prefix><key>=<value>".

The space_prefix copy is not necessary, we can just use fprintf's
precision modifier "%.*s" to print the exact part if we alrady
know space_prefix length.

2 years agolvmconfig: add --valuesonly option
Peter Rajnoha [Tue, 16 Aug 2022 14:56:06 +0000 (16:56 +0200)]
lvmconfig: add --valuesonly option

The new --valuesonly option causes the lvmconfig output to contain only
values without keys for each config node. This is practical mainly in
case where we use lvmconfig in scripts and we want to assign the value
to a different custom key or simply output the value itself without the
key.

For example:

  # lvmconfig --type full activation/raid_fault_policy
  raid_fault_policy="warn"

  # lvmconfig --type full activation/raid_fault_policy --valuesonly
  "warn"

  # my_var=$(lvmconfig --type full activation/raid_fault_policy --valuesonly)

  # echo $my_var
  "warn"

2 years agoreport: report numeric values (not string synonyms) for NUM and BIN fields with json_...
Peter Rajnoha [Mon, 15 Aug 2022 09:40:52 +0000 (11:40 +0200)]
report: report numeric values (not string synonyms) for NUM and BIN fields with json_std format

Internally, NUM and BIN fields are marked as DM_REPORT_FIELD_TYPE_NUM_NUMBER
through libdevmapper API. The new 'json_std' format mandates that the report
string representing such a value must be a number, not an arbitrary string.
This is because numeric values in 'json_std' format do not have double quotes
around them. This practically means, we can't use string synonyms
("named reserved values") for such values and the report string must always
represent a proper number.

With 'json' and 'basic' formats, this is not an issue because 'basic' format
doesn't have any structure or typing at all and 'json' format puts all values
in quotes, including numeric ones.

2 years ago_vg_read_raw_area: fix segfault caused by using null pointer
Wu Guanghao [Mon, 15 Aug 2022 14:39:02 +0000 (09:39 -0500)]
_vg_read_raw_area: fix segfault caused by using null pointer

When we tested lvm2, the kernel injected various random faults.

(gdb) bt
...
(gdb) p vg
$1 = (struct volume_group *) 0x0
(gdb) p use_previous_vg
$2 = (unsigned int *) 0x0

Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
2 years agoautoreconf: support newer archs
Zdenek Kabelac [Mon, 15 Aug 2022 09:22:53 +0000 (11:22 +0200)]
autoreconf: support newer archs

Update to more recent version of configure script to support more
new architecture types like RISCV64. Tools in use ATM:

autoconf-2.71-3.fc37.noarch
autoconf-archive-2022.02.11-3.fc37.noarch
automake-1.16.5-9.fc37.noarch

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

2 years agovdo: fix --vdosettings parser
Zdenek Kabelac [Mon, 15 Aug 2022 11:14:03 +0000 (13:14 +0200)]
vdo: fix --vdosettings parser

Parser was incorrectly parsing vdo_use_features - move the skip
of 'use_' prefix into internal loop which handles skipping of '_'.

2 years agovdo: use only verbose log level for reformating
Zdenek Kabelac [Mon, 15 Aug 2022 11:08:59 +0000 (13:08 +0200)]
vdo: use only verbose log level for reformating

When lvcreate is makeing VDO pool and user has not specified -V size,
ATM we actually run  'vdoformat' twice to get properly 'extent' aligned
size matching lvm2 properties - so the 2nd. run of vdoformat actually
can stay with 'log_verbose()' so the standard printed result
is not showing confusing info (which is now also correctly using
print_unless_silent)

2 years agolvconvert: correct test support for vdo-pool
Zdenek Kabelac [Thu, 11 Aug 2022 09:44:58 +0000 (11:44 +0200)]
lvconvert: correct test support for vdo-pool

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