1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

18699 Commits

Author SHA1 Message Date
Tony Asleson
f8876290bf lvmdbustest: Check for needed env. variables 2023-03-10 12:51:53 -06:00
Tony Asleson
568e8c71d7 lvmdbustest: Don't use hard coded /tmp for error inject log 2023-03-10 12:51:53 -06:00
Tony Asleson
66e79aab36 lvmdbusd: Add a retries during initial load
When the daemon is starting we do an initial fetch of lvm state.  If we
happened to get some type of failure with lvm during this time we would
exit.  During error injection testing this happened enough that
the unit tests were unable to finish.  Add retries to ensure we can get
started during error injection testing.
2023-03-10 12:51:53 -06:00
Tony Asleson
9c3b91a513 lvmdbustest: Shutdown cleanly with "exit"
Make the error injection wrapper handle the exit case, so that we can
clean up gracefully when instructed to do so.
2023-03-10 12:51:53 -06:00
Tony Asleson
9714f3ec4f lvmdbustest: Only inject 1 missing key error
Previously we were injecting a missing key in the lv, vg, and pv.
Given the order of processing in lvmdbusd, this prevented us from
exercising all the error paths.  Change to returning just 1 instead.
2023-03-10 12:51:53 -06:00
Tony Asleson
2359023009 lvmdbustest: Correctly set up env. for error injection 2023-03-10 12:51:53 -06:00
Tony Asleson
70a5ebc052 lvmdbustest: open log file with "a"
So we retain the log across fork & exec and lvm shell testing.
2023-03-10 12:51:53 -06:00
Tony Asleson
1949afa24b lvmdbusd: Handle missing key in get_key
When we sort the LVs, we can stumble on a missing key, protect against
this as well.

Seen in error injection testing:
Traceback (most recent call last):
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/fetch.py", line 198, in update_thread
    num_changes = load(*_load_args(queued_requests))
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/fetch.py", line 83, in load
    rc = MThreadRunner(_main_thread_load, refresh, emit_signal).done()
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/utils.py", line 726, in done
    raise self.exception
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/utils.py", line 732, in _run
    self.rc = self.f(*self.args)
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/fetch.py", line 40, in _main_thread_load
    (lv_changes, remove) = load_lvs(
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/lv.py", line 148, in load_lvs
    return common(
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/loader.py", line 37, in common
    objects = retrieve(search_keys, cache_refresh=False)
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/lv.py", line 72, in lvs_state_retrieve
    lvs = sorted(cfg.db.fetch_lvs(selection), key=get_key)
  File "/home/tasleson/projects/lvm2/daemons/lvmdbusd/lv.py", line 35, in get_key
    pool = i['pool_lv']
KeyError: 'pool_lv'
2023-03-10 12:51:53 -06:00
Tony Asleson
3d854b39bd lvmdbusd: Replace assert with exception
Instead of using an assert we will raise an LvmBug exception
2023-03-10 12:51:53 -06:00
David Teigland
e79c6feb08 tests: update missing-pv
add more checks and expand comments explaining behavior
2023-03-08 16:31:28 -06:00
David Teigland
69ea2e3f94 vg_read: keep MISSING_PV when device with no mda reappears
Remove old code that became incorrect at some point.
It's probably a fragment of an old condition that was left
behind because it wasn't understood.  We don't want to drop
the MISSING_PV flag just because the PV has no mda in use.
The device that was missing may have stale data, so the user
needs to decide if the device should be removed or restored.
2023-03-08 16:31:28 -06:00
David Teigland
937f1d3209 tests: vg-raid-takeover
Different sequences of steps that could be used to handle raid LVs
after VG takeover (what would happen in cluster failover) combined
with the loss of a disk.
2023-03-08 16:31:28 -06:00
David Teigland
aa85ed1784 vgchange: allow changing system ID with majority of PVs
when used with --majoritypvs.  This allows the fail-over
of a VG between systems by changing the VG system ID when
a PV is missing.
2023-03-08 16:30:54 -06:00
David Teigland
da44f2b6fe lvmlockd: clean up get_local_nodeid
Hard to see if fclose calls were correct, and coverity couldn't figure
it out either, so make it clear.
2023-03-08 11:11:32 -06:00
Peter Rajnoha
cd14d3fcc0
toollib: fix segfault if using -S|--select with log/report_command_log=1 setting
When we are using -S|--select for non-reporting tools while using command log
reporting (log/report_command_log=1 setting), we need to create an internal
processing handle to handle the selection itself. In this case, the internal
processing handle to execute the selection (to process the -S|--select) has
a parent handle (that is processing the actual non-reporting command).

When this parent handle exists, we can't destroy the command log report
in destroy_processing_handle as there's still the parent processing to
finish. The parent processing may still generate logs which need to be
reported in the command log report. If the command log report was
destroyed prematurely together with destroying the internal processing
handle for -S|--select, then any subsequent log request from processing
the actual command (and hence an attermpt to access the command log report)
ended up with a segfault.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=2175220
2023-03-07 15:29:54 +01:00
Tony Asleson
c8f2125b85 lvmdbusd: Add needed env. variables
When running lvmdb.py by itself for testing we need these.
2023-03-06 10:26:44 -06:00
Tony Asleson
df6120e9f7 lvmdbusd: Move cfg.lvmdebug data init
Move this to the cfg file itself, so that initialization runs when it
gets processed.
2023-03-06 10:25:22 -06:00
Tony Asleson
8e27dfd405 lvmdbustest: Test duplicate VG rename 2023-03-03 11:17:30 -06:00
Tony Asleson
3e616230f2 lvmdbustest: Add more info on asserts 2023-03-02 11:44:16 -06:00
Tony Asleson
95afd315b1 lvmdbustest: Don't hard code to /tmp
During lvm testing they use an alternative tmp directory.
2023-03-01 15:59:18 -06:00
Tony Asleson
50e6efafb9 lvmdbustest: Add more output for test_log_file_option 2023-03-01 15:52:23 -06:00
Tony Asleson
80f6655956 lvmdbustest.py: Increase udev timeout 2023-03-01 15:26:37 -06:00
Tony Asleson
4cbe789f9c lvmdbusd: Remove unused import 2023-02-27 09:57:18 -06:00
Tony Asleson
b0e75bd356 lvmdbusd: Add lock to prevent concurrent lvm shell access
There is a window of time where the following can occur.

1. An API request is in process to the lvm shell, we have written some
   command to the lvm shell and we are blocked on that thread waiting
2. A signal arrives to the daemon which causes us to exit.  The signal
   handling code path goes directly to the lvm shell and writes
   "exit\n".  This causes the lvm shell to simply exit.
3. The thread that was waiting for a response gets an EIO as the child
   process has exited.  This bubbles up a failure.

This is addressed by placing a lock in the lvm shell to prevent
concurrent access to the shell.  We also gather additional debug data
when we get an error in the lvm shell read path.  This should help if
the lvm shell exits/crashes on its own.
2023-02-27 09:07:43 -06:00
Tony Asleson
e3b7395af4 lvmdbustest.py: Remove use of root_dir in glob
This feature has only been in python since 10/2021.
2023-02-27 09:07:37 -06:00
David Teigland
1857eb9fe0 lvresize: fix check for mounted and renamed LV to handle spaces
Replace spaces with \040 in directory paths from getmntent (mtab).

The recent commit 5374a44c57 compares mount point directory paths
from /etc/mtab and /proc/mounts, in order to detect when a mounted
LV has been renamed.  The directory path comparison does not work
correctly when the path contains spaces because getmntent uses
ascii space chars and proc replaces spaces with \040.
2023-02-23 16:55:36 -06:00
Zdenek Kabelac
86ac529b99 configure: update 2023-02-23 16:46:35 +01:00
Zdenek Kabelac
551d27a327 WHATS_NEW: updates 2023-02-23 16:46:35 +01:00
Robin H. Johnson
c8868041d8 configure.ac: use pkg-config to detect static libs
Add some Gentoo based patches for better support of static linking.
This are not tested nor supported by upstream developers.
Usage requires presence of several libraries in their static form
which is however not commonly available.

Selinux modified by zkabelac to still work on older sofrware which
did not provided libselinux.pc at a time - see keep the old check
present and use pkg-config only when possible.
2023-02-23 16:46:35 +01:00
David Seifert
2b7fa40aac configure.ac: add STATIC_LDFLAGS
Add support for specif STATIC_LDFLAGS when linking static binaries.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
2b592a67d6 configure.ac: misc 2023-02-23 16:46:35 +01:00
Zdenek Kabelac
255e8c8eaa configure.ac: fail configure for missing libraries
When user enables lockd libraris, code needs to fail, when then are
missing. Also when notify-dbus support if enabled, and libsystemd is
missing, abort configuration.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
ad66600e48 configure.ac: update dlm check
Check for pkg-config --libs libdlm_lt  and test if the returned value
contains word 'pthread' - if so, it's likely a buggy result from
incorrect config file and use directly  -ldlm_lt for this case.
2023-02-23 16:46:35 +01:00
David Seifert
d91bc6904d makefiles: add pthread to libdevmapper pkgconfig
Add pthread to pkg_config file.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
e0c95f15a7 makefiles: avoid grep
Avoid getting annoyting grep warning and use just awk to get the
value.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
c1cecc3dc5 aux: lvmdbus checks for JSONDecodeError
Skip lvmdbus testing with too old python.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
d11e12264f tests: add missing quotes
Add quotes around paths and also add fixme for checking
system is actually usable for a test with all running
services.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
f5acdc2d79 tests: use aux mdadm wrapper
Wrapper takes care of proper MD device name around its various
incarnations.
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
d7c4fb7743 tests: remove option chunk for mdadm raid1
Not sure why, but --chunk specification for mdadm raid1 is no longer
'wanted' ???
2023-02-23 16:46:35 +01:00
Zdenek Kabelac
6943afe9d5 tests: add fixme 2023-02-23 16:01:50 +01:00
Zdenek Kabelac
d5c0b68dde tests: some skips with 6.2 kernel
Fix did not managed to get to final release so skip test on this kernel.
2023-02-23 16:01:50 +01:00
David Teigland
25cb6a042f vgimport: invalidate hints
There may be some unconventional methods of sharing disks with vgimport
where hints could cause confusion.  Hints should be disabled when
sharing disks, or pvscan --cache used to regenerate hints as needed,
but invalidating hints from vgimport might help reduce confusion.
2023-02-22 16:19:48 -06:00
Marian Csontos
0f6da9926d post-release 2023-02-21 15:36:24 +01:00
Marian Csontos
f7dd2562c5 pre-release 2023-02-21 15:33:32 +01:00
Tony Asleson
993bd2ffc8 lvmdbustest: Check and remove lvm debug collection files
In setup/teardown ensure we check for and remove any lvm debug
collection, to prevent FS from filling up.
2023-02-20 12:01:53 -06:00
Tony Asleson
e18d60b336 lvmdbusd: Disable collecting lvm debug data by default 2023-02-20 12:01:53 -06:00
Tony Asleson
5561281f0a lvmdbusd: Fix grammar 2023-02-20 12:01:53 -06:00
Zdenek Kabelac
a861f0425e configure: update 2023-02-17 00:08:50 +01:00
Zdenek Kabelac
13b216fbdf tests: safety first... 2023-02-17 00:08:50 +01:00
Zdenek Kabelac
1788b4b3aa tests: lvmdbus testing use --debug optinally now
To shorten down logging output of lvmdbus - use for now lvmdbus
with --debug option only when LVM_DEBUG_LVMDBUS=1 is set.
2023-02-17 00:08:50 +01:00