Zdenek Kabelac
e2ea2a8147
dmeventd: drop unneded test
...
Function is never called without device.uuid.
2015-10-22 22:34:29 +02:00
Zdenek Kabelac
941c6354db
dmeventd: wake up timer when setting new timeout
2015-10-22 22:34:29 +02:00
Zdenek Kabelac
02eb000f51
dmeventd: use dm_hold_control_dev
...
Need here to keep control device opened while there is 'any' dso
plugin loaded - otherwise there would a race closing controlfd
inside lvm2 plugin while some other monitoring thread would
tried to execute another WAITEVENT task.
2015-10-22 22:34:27 +02:00
Zdenek Kabelac
efc76ca33d
dmeventd: move dso handling into single code section
...
Move all DSO related function in front, so they could be easily
referenced from rest of code.
Add proper error paths with logging and error reporting.
Drop mutex locking when releasing DSO - since DSO is always
allocated and released in main 'event' processing thread.
2015-10-22 22:33:19 +02:00
Zdenek Kabelac
590091a4fa
dmeventd: using warning level
...
When dmevend notices problems, but continues to operate normally
change log level to warning.
2015-10-22 22:33:19 +02:00
Zdenek Kabelac
9488cbdd0b
dmeventd: no registering of 0 event mask
...
Whenever user tries to register 0 mask report this as EINVAL.
2015-10-22 22:33:19 +02:00
Zdenek Kabelac
fa9e41d2e3
dmeventd: thin plugin update
...
Use dm_make_percent for percentage calculation like lvm2 command.
Use a single call for resize.
2015-10-22 22:33:07 +02:00
Zdenek Kabelac
6b0bc5b2d9
dmeventd: snapshot plugin device removal
...
Add #ifdef-ed code to have ability to even remove unusable device.
For now purely experimental.
2015-10-22 22:29:53 +02:00
Zdenek Kabelac
7ff5b03e5e
dmeventd: snapshot plugin updates
...
Improve test for invalid snapshot.
Use dm_make_percent() to manipulate with exactly same percentage
as lvm2 command is using.
2015-10-22 22:29:50 +02:00
Zdenek Kabelac
91350f5c6a
dmeventd: mirror plugin update
...
Don't use --config - this requires reload of lvm.conf
2015-10-22 22:28:37 +02:00
Zdenek Kabelac
9c5c9e2355
dmeventd: raid plugin reporting
...
Fix raid logging introduced with last updating commit.
2015-10-22 22:28:37 +02:00
Zdenek Kabelac
cde12cbe9e
dmeventd: lvm2 plugin correctly debug
...
Fix debug message and report exit when really doing it.
Also add missing '_' to static function.
2015-10-22 22:28:37 +02:00
Zdenek Kabelac
ab6d16a8a5
dmeventd: check for malloc return
2015-10-22 22:28:37 +02:00
Zdenek Kabelac
a6d1c8ac65
dmeventd: use matching function
...
Respect lvm2_log_fn prototype. The idea of 'reusing' print_log with
plain cast is causing very strange crashes with some older 'gcc' compilers.
So just do it cleanly...
2015-10-14 14:25:27 +02:00
Zdenek Kabelac
3f1a3b7090
dmeventd: fix missing '!'
...
During recent code changes '!' was badly converted.
2015-10-13 22:10:47 +02:00
Zdenek Kabelac
ccc39be053
dmeventd: compilable without DEBUG CFLAG
...
Missed compilability without DEBUG.
2015-10-13 20:59:35 +02:00
Zdenek Kabelac
4b586ad3c2
dmeventd: rework raid plugin
...
Switch to per-thread mem-pool and lock only for lvm2 calls.
Use libdm parser for raid status line.
2015-10-13 16:02:19 +02:00
Zdenek Kabelac
256e432e78
dmeventd: less locking mirror
...
Rework mirror plugin to use per-thread mem-pool.
This allows to use locking only for lvm2 library calls.
2015-10-13 16:02:18 +02:00
Zdenek Kabelac
51ff7d5ed8
dmeventd: less locking for snapshot and thin
...
Use lvm lock for lvm library calls.
dm functions in-use are 'thread-safe' since we use
local per-thread mem pool.
2015-10-13 16:01:41 +02:00
Zdenek Kabelac
49e11102c7
dmeventd: add local mempool for raid and mirror
...
Using local mempools allows to drop locks when such memory is needed.
2015-10-13 15:56:23 +02:00
Zdenek Kabelac
a11cd2ca2d
dmeventd: use new macros to init mempool
...
For thin and snapshot use new macros
to simplify mempool init and destroy
2015-10-13 15:56:03 +02:00
Zdenek Kabelac
f9926e7e6c
dmeventd: introduce macro for init
...
Simplify commonly used pool creation.
2015-10-13 15:56:03 +02:00
Zdenek Kabelac
76ea01dd20
dmeventd: new initialization of plugin threads
...
Rework thread creation code to better use resources.
New code will not leak 'timeout' registered thread on error path.
Also if the thread already exist - avoid creation of thread
object and it's later destruction.
If the race is noticed during adding new monitoring thread,
such thread is put on cleanup list and -EEXIST is reported.
2015-10-13 15:55:05 +02:00
Zdenek Kabelac
09a8479cb7
cleanup: move system defines before structs
2015-10-13 15:22:58 +02:00
Zdenek Kabelac
0a633750f1
cleanup: avoid using private
...
Switch private to user.
2015-10-13 15:22:58 +02:00
Zdenek Kabelac
0e2261dbd1
cleanup: remove multilog
2015-10-13 15:22:57 +02:00
Zdenek Kabelac
842a7a17e3
cleanup: always set nsec
2015-10-13 15:22:57 +02:00
Zdenek Kabelac
8b9533f38f
dmeventd: support logging on stdout
...
Add new supported option '-l' log to stdout/stderr.
It has to be paired with '-f' (foreground run).
2015-10-13 15:22:57 +02:00
Zdenek Kabelac
903e9af1b2
cleanup: static with _
...
Document ? is printing to stderr.
2015-10-13 15:16:56 +02:00
Zdenek Kabelac
e261af52eb
dmeventd: handle snapshot overflow
...
When snapshot reports overflow, handle it in the same way as Invalid.
Until better ideas are implemented.
2015-10-13 15:15:44 +02:00
Zdenek Kabelac
0e27210308
dmeventd: add more debug messages
2015-10-13 15:15:43 +02:00
Zdenek Kabelac
13086c2523
dmeventd: drop changing logging
...
As we now use 'unified' logging macro system - we no longer need
to protect from change of logging function pointer - it's set
once at the start of dmeventd and not change anymore
(as lvm2 library no longer interferers here).
2015-10-13 15:15:43 +02:00
Zdenek Kabelac
42a9c8b4a6
dmeventd: enable new logging
2015-10-13 15:13:28 +02:00
Zdenek Kabelac
e50583d721
dmeventd: enable new logging
2015-10-13 15:09:35 +02:00
Zdenek Kabelac
c90363b585
dmeventd: use log_ macros in plugins
...
Convert from syslog to standard log_() macros in plugins.
2015-10-13 15:09:03 +02:00
Zdenek Kabelac
915f0faac1
dmeventd: syslog -> log_xxxxx
...
Convert logging of dmeventd to libdm logging macros.
2015-10-13 14:43:30 +02:00
Zdenek Kabelac
0641e3a5fd
libdmevent: add dm_event_log
...
Add dm_event_log() logging function.
Controled by dm_event_log_set().
2015-10-13 14:40:46 +02:00
Zdenek Kabelac
11a084cf42
dmeventd: log all commands with CMD: prefix
...
For easier grep of all processed command - add CMD: prefix to them.
Use >>> for entring command processing
and <<< when command is processed.
2015-10-13 14:40:46 +02:00
Zdenek Kabelac
d60794c3a3
dmeventd: fix loging report
...
msg.cmd holds return value from processing after _do_process_request,
so save it before call.
2015-10-13 14:40:46 +02:00
Zdenek Kabelac
7e1c08bb6a
dmeventd: correct ret code for fail
...
As _do_register_device() calls register_device() function that returns
1 success & 0 fail - ret = -ENOMEM for fail case instead of 0.
2015-10-13 14:38:49 +02:00
Zdenek Kabelac
2b9843c20b
dmeventd: reorder mempool allocation
...
Since lvm2_init() effectively detects memory leaks
allocate mempool after this initialization
(so it's not reported as leak).
2015-09-03 23:34:36 +02:00
Alasdair G Kergon
3934ade5a2
gitignore: Update for in-place build.
2015-07-27 13:18:35 +01:00
Alasdair G Kergon
dfe3eb12d0
include: Standardise around new tool.h.
2015-07-06 17:30:18 +01:00
Zdenek Kabelac
edbdbddfb6
dmeventd: better debug
...
Avoid using 'static' variable within threaded environmnent for debuging.
2015-06-15 14:46:44 +02:00
Zdenek Kabelac
3d5f7f90c8
dmeventd: drop stack
2015-06-15 14:46:44 +02:00
Zdenek Kabelac
9da07f1d3e
dmeventd: drop pthread_cancel
...
Drop unused pthread canceling as well as DEBUG printing in signal
handler.
2015-06-15 14:46:44 +02:00
Alasdair G Kergon
eeb498627c
libdm: Add dm_task_get_errno to return ioctl errno.
...
There are reports of unexplained ioctl failures when using dmeventd.
An explanation might be that the wrong value of errno is being used.
Change libdevmapper to store an errno set by from dm ioctl() directly
and provide it to the caller through a new dm_task_get_errno() function.
[Replaced f9510548667754d9209b232348ccd2d806c0f1d8]
2015-05-26 15:13:49 +01:00
Zdenek Kabelac
bff3a1651d
debug: use epoch for dmeventd logging
...
When LVM_LOG_FILE_EPOCH is set, route lvm command debug message
to lvm.conf log file instead of syslog.
2015-04-20 12:12:22 +02:00
Petr Rockai
eac4e1e939
dmeventd: Call lvscan --cache also for mirrors (in addition to RAID).
2015-01-14 18:05:44 +01:00
Alasdair G Kergon
160777bb3e
dmeventd: Add basic thread debugging messages.
...
Only with -DDEBUG.
2014-11-04 18:56:20 +00:00