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

1376 Commits

Author SHA1 Message Date
Zdenek Kabelac
f9c6c115d3 cleanup: easier code for raid plugin
Set bits only when then were not yet assigned.
2016-12-09 15:15:02 +01:00
Tony Asleson
c9848bb7ea lvmdbusd: Only allow 0..N for --blackboxsize argument 2016-11-30 16:47:39 -06:00
Tony Asleson
53ef496719 lvmdbusd: Emit signal on Job completion
Added a properties changed signal on the job dbus object so that client
can wait for a signal that the job is complete instead of polling or
blocking on the wait method.
2016-11-30 15:59:06 -06:00
Tony Asleson
1d52090953 lvmdbusd: Remove TODO on concurrent access to properties
As the code now uses a single thread to handle all changes to the
dbus model we no longer need to handle this potential race
condition.
2016-11-30 15:59:06 -06:00
Tony Asleson
37f05ccab1 lvmdbusd: Supress protected member access warning
We want _run to be protected so that users outside of the class
don't mistakenly use it.  It's for internal use only.
2016-11-30 15:59:06 -06:00
Tony Asleson
3bc69cb23c lvmdbusd: Add --blackboxsize command line argument
Allows the user to override the number of commands that get dumped
to the log when we encounter a lvm error.  Also useful during
development when you don't want to see the blackbox output.
2016-11-30 15:59:06 -06:00
Tony Asleson
b0757ac96e lvmdbusd: Remove unused variable
This variable has been un-used for a long time.
2016-11-30 15:59:06 -06:00
Tony Asleson
58f4d98af1 lvmdbusd: Remove debug log_error 2016-11-29 16:50:30 -06:00
Tony Asleson
617a819abc lvmdbusd: WS fix 2016-11-29 16:50:30 -06:00
Tony Asleson
d882edb32d lvmdbusd: Simplfy reading streams
Remove redundant code and make code paths the same for all streams.
2016-11-29 16:50:30 -06:00
Tony Asleson
25b5413f89 lvmdbusd: Make lvm shell read more robust
Make sure JSON is correct before we stop trying to read.
2016-11-29 16:50:30 -06:00
Zdenek Kabelac
4a59cfaa1d makefiles: drop file source and indent 2016-11-26 00:22:38 +01:00
Tony Asleson
064e24bc1e lvmdbusd: Only read whats buffered
When reading data from stdout & stderr we were reading until the
reading until we got None back which really isn't needed as the
read will return everything that is available.
2016-11-23 18:16:11 -06:00
Zdenek Kabelac
e38678be3f cleanup: single LVM_SYSTEM_DIR string 2016-11-23 17:55:03 +01:00
Zdenek Kabelac
5fd5cfe061 cleanup: use display_lvname and msg cleanup
Use display_lvname in tracing messages.
Add some missing 'dots' to messages.
2016-11-23 17:48:01 +01:00
Tony Asleson
0bbf631349 lvmdbusd: Remove extraneous finally
The print statement is incorrect.
2016-11-17 13:59:39 -06:00
Tony Asleson
3b4c5a2151 lvmdbusd: Fix source documentation 2016-11-17 13:58:17 -06:00
Tony Asleson
3a6c78e22a lvmdbusd: cmdhandler.py, fix imports
Use the correct py3 syntax for handling imports.  Also use print instead
of log_debug which in this context will produce no output.
2016-11-17 13:57:44 -06:00
Tony Asleson
19a0bf9df6 lvmdbusd: Remove debug JSON file 2016-11-17 11:45:11 -06:00
Tony Asleson
99806ec7ec lvmdbusd: Place Manager.UseLvmShell request on queue
We need to acquire a lock which can block us which in turn causes
the dbus request handling to block as well.  Place the request on
the work queue instead.
2016-11-17 11:35:16 -06:00
Tony Asleson
df92d330aa lvmdbusd: Extra report FD read on no data
Our expectation was that when using the lvm shell that when the lvm prompt
was read from stdout, that all other ouput had been written and flushed.
However, this doesn't appear to be the case.  Add extra read passes to
retrieve delayed report data.
2016-11-17 11:35:16 -06:00
Tony Asleson
a1805cf336 lvmdbusd: Bubble up invalid JSON
If we get invalid JSON, lets bubble that up to the user.
2016-11-17 11:35:16 -06:00
Tony Asleson
4f1171466f lvmdbusd: Remove un-used import 2016-11-17 11:35:16 -06:00
Tony Asleson
2fbb90e403 lvmdbusd: WS corrections
Fix mixed spaces & tabs and other ws issues.
2016-11-17 11:35:16 -06:00
Tony Asleson
dcdef9647b lvmdbusd: Add cfg.load to pv remove
The global dbus state does not match lvm with simply removing the pv
dbus object.
2016-11-17 11:35:16 -06:00
Tony Asleson
24fd1dd7a3 lvmdbusd: _lv_create, simplify return path 2016-11-17 11:35:16 -06:00
Tony Asleson
72a943f720 lvmdbusd: Long running operations use own thread
Anything that ends up using polld will be done in a unique thread
so that we don't hold off other operations from running concurrently.
2016-11-17 11:35:16 -06:00
Tony Asleson
fa444906bb lvmdbusd: Use one thread to fetch state updates
In preparation to have more than one thread issuing commands to lvm
at the same time we need to serialize updates to the dbus state and
retrieving the global lvm state.  To achieve this we have one thread
handling this with a thread safe queue taking and coalescing requests.
2016-11-17 11:35:16 -06:00
Tony Asleson
affe2cebf5 lvmdbus: Make bus name configurable
Add env LVM_DBUS_NAME to change what the bus name is.
2016-11-17 11:35:16 -06:00
Tony Asleson
461d340bd7 lvmdbusd: Remove the periodic timer task
This code is no longer needed because the back ground task has been
removed.  Will add back if we change the design and end up utilizing
multiple worker threads.
2016-11-03 18:38:10 -05:00
Tony Asleson
ee0c9e7b23 lvmdbusd: Take out background thread
There is no reason to create another background task when the task that
created it is going to block waiting for it to finish.  Instead we will
just execute the logic in the worker thread that is servicing the worker
queue.
2016-11-03 18:29:06 -05:00
Zdenek Kabelac
a9ee86ccf2 dmeventd: provide message context
Show device name with printed message.
Also use different level for printing error message and
standard informational message.
2016-11-03 17:49:07 +01:00
Zdenek Kabelac
0d95082aa9 cleanup: remove goto
Move goto path into 'if()' branch.
2016-11-03 17:49:07 +01:00
Zdenek Kabelac
9cbe4c1af9 log_info to log_very_verbose
Translate log_info() into log_very_verbose() which is macro
supposed to be used by our code.

log_info() is internal macro with eventually some 'symbolic' meaning
in syslogging daemons.
2016-11-03 17:49:07 +01:00
Zdenek Kabelac
cc19cc07f7 log_info to log_warn
Switch to log_warn level when we are reporting these message.
2016-11-03 17:49:07 +01:00
Zdenek Kabelac
e3775173b4 cleanup: log_info to log_error
Switch to more appropriate logging level.
2016-11-03 17:49:07 +01:00
Zdenek Kabelac
4b4d19e3aa dmeventd: separate dm and dmeventd logging
Ensure different logging function for dmeventd.c logging
and dm and lvm library.

We can recognize we want to show every log_info() and
log_notice() message from dmeventd.c code while not
exposing those from libdm/libdevmapper-event

Also switch to use log with errno - it's not changing
anything and doesn't bring any more features yet to dmeventd
logging but we just properly pass dm_errno_or_class properly
through the whole code stack for possible future use
(i.e. support of class logging for dmeventd).
2016-11-03 12:43:09 +01:00
Zdenek Kabelac
cd468b6218 dmeventd: debug only subsystemd with # sign
Reword the logging logic and try to restore previous logging
behavior for 'standalone' running daemon while preserving
debuggable feautures it has gained.

So actual rules:

dmeventd without any '-d' option will syslog all messages
from dmeventd.c it dmeventd plugins.

log_notice()==log_verbose()
log_info()==log_very_verbose()
But to show also log_debug() used has to give '-ddd'.

When user specified '-d, -dd, -ddd, -dddd' it
will also enable tracing of messages from libdm & lib
executed code - which is mainly useful for testing
i.e.: 'dmeventd -fldddd'
2016-11-03 12:43:09 +01:00
Zdenek Kabelac
33dd1f7747 dmeventd: abort on internal error
Provide same support for DM_ABORT_ON_INTERNAL_ERRORS we do have
with default libdm logging  as  dmeventd is libdm based tool.
2016-11-03 12:43:09 +01:00
Zdenek Kabelac
6af26273cb logging: add more log macros
Introduce macros:

log_level(), log_stderr(), log_once(), log_bypass_report()

For easier and more consisten way how to 'decoder' bits
of info from passed 'level'.

This patch fixes potential problem when 'level' of message
might not have always masked right bits.
2016-11-03 12:43:09 +01:00
Tony Asleson
96118a2508 lvmdbusd: Stop using threads for job wait
Instead of creating a thread to handle the case where a client
is calling job.Wait, we will utilize a timer.  This significantly
reduces the number of threads that get created and destroyed while
the service is running.
2016-11-02 16:39:13 -05:00
Tony Asleson
95abadd13c lvmdbusd: main.py: change debug msg text 2016-11-02 16:39:13 -05:00
Tony Asleson
60de09b00c lvmdbusd: Don't use dbus lib in worker thread
Simplify the code paths so that we don't utilize the dbus library code
when we are in worker thread context.

ref. https://bugs.freedesktop.org/show_bug.cgi?id=98521
2016-11-02 16:39:03 -05:00
Tony Asleson
38dd79307a lvmdbusd: Execute load in main thread
We will fetch the lvm state in non-main thread and only process the new
data with the main thread to prevent hanging the main thread event loop.

ref. https://bugs.freedesktop.org/show_bug.cgi?id=98521
2016-11-02 16:38:49 -05:00
Tony Asleson
24803bbaad lvmdbusd: Return results in main thread
Also introduce some additional new code to execute code other code
in main thread too.

ref. https://bugs.freedesktop.org/show_bug.cgi?id=98521
2016-11-02 16:38:00 -05:00
Tony Asleson
c8e8439b3d lvmdbusd: Use timer instead of thread
We had a thread sitting around for cleaning up other processes, changed to
a periodic timer task.
2016-11-02 16:35:45 -05:00
Tony Asleson
4fab833920 lvmdbusd: Remove log ouput when ec=0 & stderr != 0 bytes
lvm likes to log to stderr virtually all the time, this isn't
helpful.
2016-10-11 13:16:57 -05:00
Tony Asleson
2830f72288 lvmdbusd: Disable lvm abort on too much log output
The commit:
https://git.fedorahosted.org/cgit/lvm2.git/commit/?id=34c55d98eefd88f85476c0f62f0649c706bde6f0

introduced an abort if lvm logs too much.  In the case of utilizing
lvm shell this is a pretty normal occurance, so we will disable
when we use lvm shell.
2016-10-11 13:16:57 -05:00
Tony Asleson
9f0195ec1e lvmdbusd: Ensure tmp dir gets cleaned up
Regardless of the outcome of starting up the lvm shell process, lets
ensure we clean up the temp directory and pipe.
2016-10-10 16:31:00 -05:00
Tony Asleson
2e941beb44 lvmdbusd: Ensure lvm shell still exists 2016-10-10 16:31:00 -05:00