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

1739 Commits

Author SHA1 Message Date
Tony Asleson
2918994873 lvmdbusd: WS, imports, grammar 2022-09-16 10:49:37 -05:00
Tony Asleson
b0c7220dbb 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.
2022-09-16 10:49:37 -05:00
Tony Asleson
a5e6947d74 lvmdbusd: Set LVM_COMMAND_PROFILE=lvmdbusd
We need this to prevent lvm from interleaving the JSON output with errors
written to stderr.
2022-09-16 10:49:37 -05:00
Tony Asleson
ec50979b03 lvmdbusd: Correct typos 2022-09-16 10:49:37 -05:00
Tony Asleson
3d8882db83 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.
2022-09-16 10:49:37 -05:00
Tony Asleson
60e4ba36e0 lvmdbusd: Remove unused locking functionality
I don't think we have ever utilized this, remove.
2022-09-16 10:49:37 -05:00
Tony Asleson
cfc87157a4 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.
2022-09-16 10:49:37 -05:00
Tony Asleson
068073e924 lvmdbusd: Correct typos 2022-09-16 10:49:36 -05:00
Tony Asleson
abf22df46c 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.
2022-09-16 10:49:36 -05:00
Tony Asleson
6b9cc7432e lvmdbusd: Remove exclusionary language 2022-09-16 10:49:36 -05:00
Tony Asleson
c13efb2ffc lvmdbusd: Remove unneeded command line args 2022-09-16 10:49:36 -05:00
Tony Asleson
b3d8366ff2 lvmdbusd: Add SIGUSR2 to dump flight recorder 2022-09-16 10:49:36 -05:00
Tony Asleson
05f7fa5a85 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.
2022-09-16 10:49:36 -05:00
Tony Asleson
3fdf449348 lvmdbusd: Add lockfile
The daemon cannot handle multiple copies of itself running at the
same time, ensure this cannot happen.
2022-09-16 10:49:36 -05:00
Tony Asleson
1a4384979c lvmdbusd: Move arg. setup/checking to function 2022-09-16 10:49:36 -05:00
Tony Asleson
3eb19c4b7a lvmdbusd: Remove addl. checks on --nojson
We check earlier that if you specify --nojson we will exit.
2022-09-16 10:49:36 -05:00
Tony Asleson
01ef2f2525 lvmdbusd: Remove try/except for mkfifo
We should never run into this error condition when using tempfile.mkdtemp.
2022-06-30 10:55:16 -05:00
Tony Asleson
0d957dcacc lvmdusd: Remove non lvm JSON output support 2022-06-30 10:55:16 -05:00
Tony Asleson
d393436727 lvmdbusd: Correct grammar in lvm shell proxy comments 2022-06-30 10:55:16 -05:00
Tony Asleson
6914942685 lvmdbusd: Don't require "lvm> " prompt for shell
Depending on how lvm is compiled, it may not present the "lvm> " prompt
when using the lvm shell.  Don't require it to be present.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2090391
2022-06-30 10:55:16 -05:00
Tony Asleson
eee89a941e lvmdbusd: Job prop. Get/GetAll exec. immediately
This allows API user the ability to check on the status of a long running
job without blocking in the request queue.
2022-06-30 10:55:16 -05:00
Tony Asleson
7a2090655d lvmdbusd: Remove the use of sub shell for lvm shell
This reduces the number of processes and improves security.
2022-06-30 10:55:16 -05:00
Tony Asleson
51d9b686c0 lvmdbusd: Add debug output for which lvm binary is used 2022-06-30 10:55:16 -05:00
Tony Asleson
b3407b16c1 lvmdbusd: re-work lvm shell main
Add an optional single argument "bisect" to use with git bisect for
automation.  Normal case is no arguments when running stand-alone.
2022-06-30 10:55:16 -05:00
Tony Asleson
58c6c9e9aa lvmdbusd: Simplify child process env
We don't need to duplicate the entire env from the parent, supply only what
is needed.
2022-06-30 10:55:16 -05:00
Tony Asleson
37733cd4eb lvmdbusd: Correct conditional for lvm child process running
Poll returns None when process is running, else exit value.  If poll returns
0 we will fail to exit the select loop.
2022-06-30 10:55:16 -05:00
David Teigland
d14245c724 lvmlockd: return error from vgcreate init_vg_sanlock
in vgcreate for shared sanlock vg, if sanlock_write_resource
returns an unexpected error, then make init_vg_sanlock fail
which will cause the vgcreate to fail.
2022-04-08 11:34:04 -05:00
Zdenek Kabelac
62f11b0b0b gcc: increate buffer sizes
Make all possible string buffers to fit so they are not shortened in the
middle.
2022-01-26 15:09:58 +01:00
Zdenek Kabelac
cf68bf7b6c gcc: snprintf may need here upto 18 bytes
Although hypothetical case....
2022-01-26 15:09:58 +01:00
David Teigland
42a16aa6f3 lvmlockd: cleanup after sanlock_rem_lockspace error
When storage is lost under a sanlock VG, and kill_vg/drop_vg
are used, sanlock_rem_lockspace() may return an error, but
the cleanup steps should still be performed.  Without the
cleanup, gl_lsname_sanlock was not cleared.  This caused
future lock requests to fail with ENOLS, but the NO_GL_LS
flag was not set due to gl_lsname_sanlock being set.
This caused lockd_global(sh) in lvm commands to fail when
they could succeed.

Fix from guozhonghua216
2022-01-04 14:53:47 -06:00
Zdenek Kabelac
65ba4964df cov: do not drop already known error state
Do not try to 'discover' another error state, when ENOMEM
is already detected.
2021-10-15 23:40:56 +02:00
Vojtech Trefny
61bd5e5023 lvmdbusd: Use ID_FS_TYPE UDev property in udevwatch
'.ID_FS_TYPE_NEW' is a custom property added by an LVM UDev rule
which is now being removed and 'ID_FS_TYPE' has the same value.

Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
2021-10-07 12:42:44 -05:00
Zdenek Kabelac
ee15065a0f gcc: match types 2021-09-22 17:18:50 +02:00
Zdenek Kabelac
7bd55f8c15 cov: check strchr for NULL
Although unlikely, ensuring coverity we not use NULL.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
377e326156 cov: ensuring buffer is zeroed 2021-09-21 21:03:47 +02:00
Zdenek Kabelac
4ef8f7cde6 gcc-fanalyzer: remove unneded zeroing
Since we zallocate array here, we don't need to set to NULL
and clean gcc warning about strdup leakage.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
462ac47003 clang: check for buffer existance
Make obvious to analyzer we can't get NULL here.
2021-09-21 21:03:47 +02:00
Zdenek Kabelac
1b52451996 cov: mask some warning about leakage
Mask false-positive leak report.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
efaab93491 cov: ignore syscall 2021-09-20 14:26:09 +02:00
Zdenek Kabelac
376e707232 cov: better handle reallocation of adapt_file
If the option would be given more then once.
2021-09-20 14:26:09 +02:00
Zdenek Kabelac
909401226c gcc-fanalyzer: rewrite _fetch_string
Slightly more optimal code, that is less confusing analyzers.
2021-09-20 14:18:13 +02:00
Zdenek Kabelac
93d565eda9 gcc-fanalyzer: use zeroed memory
Analyzer here was rather confused about possiblity of loosing previously
assigned device pointers - fixed by passing zero initialize memory
before first assign.
2021-09-20 13:58:57 +02:00
Zdenek Kabelac
ed59b50512 cleanup: free already does NULL check
Drop extra check for NULL before calling free().
Also drop zeroing data that will be free().
2021-09-15 15:24:56 +02:00
Zdenek Kabelac
73087c2c0f clang: free on arg parsing
If the parameter would be given twice, the 1st. alloc memleaks.
2021-09-15 15:24:56 +02:00
Zdenek Kabelac
3b2a4e3e6f cov: make it aware we need these headers for muslC 2021-09-13 12:34:41 +02:00
Zdenek Kabelac
a14371e495 cov: hide false positive warning
Here we have valid use case of strncpy() which just need
to fill precise buffer size - so no explicit \0 on buffer
end is needed.
2021-09-13 12:34:41 +02:00
Zdenek Kabelac
63930f576a cov: add some initializers 2021-09-13 12:34:41 +02:00
Zdenek Kabelac
aa522d5862 cov: fix copy from tmp_name buffer
Mask for strncpy() Coverity report warning would
actually need to copy buffer from 'tmp_name' instead of 'str'.

But replace it directly with single 'strncpy()' again for better readbility,
just mask out the warning reported for this strncpy instance
(so we do not need to put comment fro every call of strcpy_name_len).
2021-09-13 12:34:41 +02:00
David Teigland
62c599f781 cov: lvmlockd read_adopt_file free structs on error path 2021-08-30 13:48:42 -05:00
David Teigland
0d572d14ad cov: lvmlockd: rewrite string copies to avoid warnings
- Use a new function for all instances of copying
  a null-terminated string into a fixed size struct
  field that is not null-terminated.

- use memcpy when copying between struct fields of
  the same size
2021-08-16 11:31:09 -05:00