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
Alasdair G Kergon
89f635a075
dmeventd: Include shutdown threads in responses.
...
When responding to DM_EVENT_CMD_GET_REGISTERED_DEVICE no longer
ignore threads that have already been unregistered but which
are still present.
This means the caller can unregister a device and poll dmeventd
to ensure the monitoring thread has gone away before removing
the device. If a device was registered and unregistered in quick
succession and then removed, WAITEVENT could run in parallel with
the REMOVE.
Threads are moved to the _thread_registry_unused list when they
are unregistered.
2014-11-04 16:58:14 +00:00
Alasdair G Kergon
6b25faa218
dmeventd: Remove redundant checks.
...
The status of threads in _thread_registry is always DM_THREAD_RUNNING
(zero).
DM_EVENT_REGISTRATION_PENDING is never stored in thread->events.
2014-11-04 16:55:42 +00:00
Zdenek Kabelac
6d7f260f92
dmeventd: fix test for select return value
...
Do not call read when select return -1 && EINTR.
Also check for return valuer from read() and
abort write function when unexpected error happens.
2014-08-19 14:33:06 +02:00
Petr Rockai
5dc6671bb5
dmeventd: Call lvscan --cache in the RAID plugin.
2014-07-22 22:48:21 +02:00
Zdenek Kabelac
cbdf63fdd2
cleanup: indent in devmapper-event
...
Drop header inclusion - this file is already included.
Shorten code.
2014-04-30 10:26:30 +02:00
Zdenek Kabelac
816cc94ac1
devmapper-event: always initialize timeout
...
Always pass fully initialized timeval struct to select.
2014-04-30 10:26:29 +02:00
Zdenek Kabelac
7a1777302f
cleanup: dmeventd simplify restart message parsing
...
Since we already check every characted in the message,
skip extra callback to strlen, and do the implicit
message length checking.
2014-04-18 16:53:29 +02:00
Zdenek Kabelac
1f701c7bf6
cleanup: dmeventd drop setting of size
...
Size is not used when msg->data is NULL.
2014-04-18 16:52:59 +02:00
Zdenek Kabelac
78c6dea48e
cleanup: dmeventd improve _handle_request
...
Let the compiler resolve cmd lookup and leave it to optimize it as it
needs.
2014-04-18 16:52:45 +02:00
Zdenek Kabelac
0927605ec3
cleanup: dmeventd improve _clien_write code
...
Switch to allocate buffer from heap, since it might be potentially
bigger when extremaly large set of volumes would be monitored.
In case of allocation failure send ENOMEM message.
Also implicitelly ignore msg->size when msg->data is NULL.
2014-04-18 16:52:35 +02:00
Zdenek Kabelac
3febd2c9d4
cleanup: dmeventd set next_time when registering
...
Don't change next_time, when thread is already registered.
2014-04-18 16:52:11 +02:00
Zdenek Kabelac
dc21bbfabd
cleanup: dmeventd improve _get_status
...
Use directly dm_asprintf() to allocate buffer with message,
and properly detect failing on replacement of snprintf()
which also returns -1 on error.
2014-04-18 16:51:54 +02:00
Zdenek Kabelac
0503af8466
cleanup: dmeventd simplify buffer write loop
2014-04-18 16:50:55 +02:00
Zdenek Kabelac
13d05211d0
cleanup: dmeventd simplify status processing
...
Since we always know the string length, use simplier memcpy.
2014-04-18 16:38:52 +02:00
Zdenek Kabelac
4fb588c34e
cleanup: dmeventd reorder _fill_device_data
...
Just simplify the function.
2014-04-18 16:38:51 +02:00
Zdenek Kabelac
6b701c3a48
cleanup: dmeventd abstract lvm2cmd interface
...
Keep lvm2cmd interface hidden inside dmeventd_lvm
and use regular 1/0 return codes, this we may
avoid using lvm2cmd.h in other lvm2 plugins.
2014-04-18 16:38:51 +02:00