1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 11:55:55 +03:00
Commit Graph

392 Commits

Author SHA1 Message Date
Alasdair Kergon
cb63efc6f9 Fix clvmd segfault when refresh_toolcontext fails. (brassow, bz 506986) 2009-10-22 17:45:23 +00:00
Petr Rockai
241e84f79d Only announce mirror monitoring to syslog after initialisation succeeds. 2009-10-22 10:40:41 +00:00
Alasdair Kergon
ae1e83aa94 Attempt to build dmeventd.static. 2009-10-13 02:35:26 +00:00
Alasdair Kergon
902c4069dc More build cleanups (linker parameter ordering). 2009-10-13 01:31:10 +00:00
Christine Caulfield
c503c83c78 Make clvmd return 0 on success rather than 1. 2009-10-12 08:33:30 +00:00
Alasdair Kergon
79aa89a62a Extra libs must be appended, not defined first. 2009-10-09 16:04:54 +00:00
Alasdair Kergon
437219e27d More makefile cleaning up and fixing. (gentoo) 2009-10-05 13:46:00 +00:00
Alasdair Kergon
db8b5af9d9 Allow for a build directory separate from the source. 2009-10-02 19:10:31 +00:00
Christine Caulfield
29846c24a8 Stop clvmd from automatically doing lock conversions. Now, if a lock
is granted at one mode and an attempt to convert it wthout the LCK_CONVERT
flag set then it will return errno=EBUSY.

This fixes a pretty bad bug in which an LV could be activated exclusively on
one node and lvchange -ay on another would convert it to shared!

It might break some things in other areas, but I doubt it.
2009-10-01 14:14:17 +00:00
Alasdair Kergon
cf8ee443e5 Fix dmeventd _temporary_log_fn parameters. (2.02.50) 2009-09-17 10:37:23 +00:00
Alasdair Kergon
d0800aba01 missing (C) reminders 2009-09-15 12:51:28 +00:00
Alasdair Kergon
90c8088760 More cmirror makefile fixes from Fabio. 2009-09-14 22:57:46 +00:00
Dave Wysochanski
2433909e20 Add daemons/cmirrord files to git - somehow got messed up with cvs rename.
When clogd was renamed to cmirrord, somehow git got the remove of the old
files but not the add of the new files.  This patch adds the new files.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-09-04 20:44:58 +02:00
Alasdair Kergon
2bda19e999 rename clogd dir to cmirrord 2009-09-02 17:36:46 +00:00
Fabio M. Di Nitto
c99b9fa946 Fix cmirrod build directory while we wait to do a proper rename of the
directory and move files.
2009-09-02 11:49:03 +00:00
Fabio M. Di Nitto
f8d076d827 Drop clogd Makefile from CVS since it's always autogenerated from Makefile.in
at configure time.
2009-09-01 19:13:38 +00:00
Christine Caulfield
b45e346f7a Add some code to clvmd to look in the corosync confdb to see what cluster
interface it should be using, it can still be overriden with -I.

If corosync isn't running or there is no information then the usual
checking will happen.

This code only builds if corosync is available.
2009-09-01 09:48:01 +00:00
Alasdair Kergon
66fd45290c change clogd to cmirrord
make pidfile locn configurable
2009-08-28 20:51:40 +00:00
Alasdair Kergon
a946372e50 Rewrite clvmd configuration code. 2009-08-28 19:22:05 +00:00
Jonathan Earl Brassow
226e79e7b7 cluster log daemon (clogd): Adjust for kernel CTR arg reordering
We have moved the internally generated mirror-device-size
parameter from the end of the CTR string to the begining.
This change adjusts for that.
2009-08-28 05:27:09 +00:00
Jonathan Earl Brassow
afa8ea4078 Cluster log server (clogd): Add new build files.
Might be a good idea to add the new files to the repository.  :(
2009-08-13 20:51:41 +00:00
Jonathan Earl Brassow
3c14bcca33 cluster log daemon (clogd): Add to LVM build system
This check-in includes the touch-ups, make file changes, copyrights,
and other necessities to include the cluster log daemon into the
build system.

[autoconf still needs to be run to generate the 'configure' and
'Makefile' files.]
2009-08-13 16:34:07 +00:00
Jonathan Earl Brassow
8f26e18c13 Cluster log daemon (clogd): use LVM bitops in place of ext2 bitops
Eliminate dependency on outside library, since the same functionality
exists in our tree.

[It is important that the bitops work in the same way, as the bitmaps
must remain backwards compatible.  I haven't tested every architecture,
but the x86* archs work.  My test involved using the old ext2fsprogs
bitops, memcpy'ing the bits over to the LVM bitset array and ensuring
that only the bits set via the old methods were set.]
2009-08-13 16:31:01 +00:00
Christine Caulfield
defed336ae Fix compilation warning in clvmd.c 2009-08-13 10:39:41 +00:00
Christine Caulfield
ee1e49ec53 Fix locking in clvmd
The changes to remove LCK_NONBLOCK from the LVM locks broke clvmd because the
code was clearly wrong but working anyway! The constant was being masked rather
than the variable that was supposed to match against it.
2009-08-05 14:18:35 +00:00
Jonathan Earl Brassow
664ef2f993 Remove old custom list macros and replace with libdevmapper list
macros.
2009-07-28 21:14:12 +00:00
Jonathan Earl Brassow
5c8922b724 Making adjustments to go along with the changes to the kernel.
A patch to the kernel, adding the 'luid' field to dm_ulog_request,
will allow us to properly identify log instances.  We will now
be able to definitively identify which logs are to be removed/
suspended/resumed.  This replaces the old faulty behavior of
assuming the logs were the same if they had the same UUID and
incrementing/decrementing a reference count.
2009-07-28 15:55:50 +00:00
Alasdair Kergon
c07d773e67 All LV locks are non-blocking so remove LCK_NONBLOCK from separate macros. 2009-07-24 18:15:06 +00:00
Jonathan Earl Brassow
31add81f69 After rebasing the cluster logging code, adjustments need to be
made to compensate for the changes in the kernel-side component
that recently went upstream.  (Things like: renamed structures,
removal of structure fields, and changes to arguments passed
between userspace and kernel.)
2009-07-21 15:34:53 +00:00
Jonathan Earl Brassow
a9f628b78d Rebasing the cluster log daemon code from the most current
sources in the 'cluster' tree.  There have been a number of
bug fixes and I don't want to loose them.
2009-07-21 15:32:13 +00:00
Alasdair Kergon
d917192f00 Add lvm_errno and lvm_errmsg to liblvm to obtain failure information.
Change create_toolcontext to still return an object if it fails part-way.
Add EUNCLASSIFIED (-1) as the default LVM errno code.
2009-07-16 00:36:59 +00:00
Alasdair Kergon
d614646157 Store any errno and error messages issued while processing each command.
(Enabled by default while we test it, but in due course we'll only store
the error messages when we need to.)
2009-07-15 23:57:54 +00:00
Alasdair Kergon
b8f47d5f69 Use log_error macro consistently throughout in place of log_err. 2009-07-15 20:02:46 +00:00
Mikulas Patocka
3395d72881 Change exit() to _exit() in the child process. exit flushes stdio file buffers,
_exit doesn't. If there were some open files, an error in exec and subsequent
exit() would cause the buffers to be flushed twice.

Example:

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>

int main()
{
	printf("buu");
	if (!fork()) {
		execl("/bin/true-not-exists", "/bin/true", NULL);
		exit(1);
	}
	wait(NULL);
	return 0;
}

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com

---
 daemons/dmeventd/libdevmapper-event.c |    2 +-
 lib/misc/lvm-exec.c                   |    2 +-
 test/harness.c                        |    3 ++-
 tools/dmsetup.c                       |    2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)
2009-07-13 21:26:41 +00:00
Alasdair Kergon
7f355587f5 Make cmd->cmd_line const. 2009-07-13 19:49:48 +00:00
Alasdair Kergon
476d463348 pre-release tidy up 2009-06-30 18:39:31 +00:00
Petr Rockai
1f164ad9d0 - Ignore suspended devices during repair (Milan).
- Call vgreduce --removemissing (without --force) automatically to clean up bad
  PVs (Milan).
2009-06-15 14:47:39 +00:00
Milan Broz
01fb9ca9a0 Do not fork daemon when dmeventd cannot be found. 2009-06-15 12:29:41 +00:00
Milan Broz
8bc510ba12 Destroy toolcontext on exit in clvmd (fixes memory pool leaks). 2009-06-15 12:15:23 +00:00
Milan Broz
5cc66af8d6 Re-instate partial activation support in clustered mode. (mornfall) 2009-06-12 08:30:19 +00:00
Milan Broz
c26488d348 Use lvconvert --repair instead of vgreduce in mirror dmeventd DSO (mornfall)
Introduce lvconvert --use_policies (mornfall)
2009-06-04 12:01:15 +00:00
Christine Caulfield
dbbf3d1bb8 Fix clvmd-corosync to match the new corosync API. 2009-06-03 13:42:02 +00:00
Alasdair Kergon
450928e304 Revert:
Use lvconvert --repair in dmeventd mirror DSO.
for now.

It replaces bad behaviour in one set of circumstances with bad behaviour
in a different set.  We think the behaviour needs to be more configurable.
2009-05-20 22:24:48 +00:00
Milan Broz
fa6dca9f28 Add infrastructure for queriying for remote locks.
Current code, when need to ensure that volume is not
active on remote node, it need to try to exclusive
activate volume.

Patch adds simple clvmd command which queries all nodes
for lock for given resource.

The lock type is returned in reply in text.

(But code currently uses CR and EX modes only.)
2009-05-19 10:38:58 +00:00
Milan Broz
ac0034c20f Use lvconvert --repair in dmeventd DSO (mornfall)
This means two things:

1) Non-mirrored LVs will be no longer affected by mirror monitoring. (Before,
if you had a LV that went partially missing on a VG where a mirror leg failed,
this LV would be removed automatically by dmeventd... Probably not an
unrecoverable dataloss bug, but still quite unpleasant.)

2) If enough parallel PV space is available at the time of the mirror failure,
the failed devices will be automatically replaced using this spare space. Which
(and whether) free space may be used is still not configurable, but is a
planned feature. Since it is relatively easy to undo the action by converting
the mirror manually, I don't consider this to be a showstopper. In fact, I
think the compromise is much better than what we have now.
2009-05-19 10:25:16 +00:00
Milan Broz
0b502933c5 Introduce lvm2_install target.
Buildsystem support device-mapper only install,
but generic install tagret includes both dm+lvm2.

For distribution which uses separate install_device-mapper,
there is no way how to install lvm2 only
(so after installing lvm2 for packaging purposes
built system must remove installed device-mapper files).

Fix it by allowing lvm2_install target, similarily like
install_cluster for clvmd.

(install = install_device-mapper + install_lvm2)
2009-05-11 10:28:45 +00:00
Milan Broz
be82186cba Do not use generic install if running install_device-mapper.
It propagates into subdirs which includes DSOs which requires
lvm2 build (only install_device-mapper should propagate there).
2009-05-11 10:12:35 +00:00
Dave Wysochanski
efa62ff443 Remove some trailing whitespace so git won't complain. 2009-04-22 12:46:25 +00:00
Milan Broz
293b6f7eaa Clean a lot of extra extra whitespaces. 2009-04-22 10:38:16 +00:00
Milan Broz
dfbc015c69 Fix remote metadata backup for clvmd
Run backup of metadata on remote nodes in the
same place like local node - when calling backup().

Introduce backup_locally() which calls only
local backup if needed.

Remote backup is now trigerred by LCK_VG_BACKUP flag
combination (special VG lock).

This lock type will call check_current_backup()
(including backup_locally() call) and updates
metadata on all nodes.

(Patch fixes non-functional remote backup,
current call during VG lock never triggers.)
2009-04-22 09:39:45 +00:00
Jonathan Earl Brassow
9b76dcc190 - Updating cluster log with latest code changes/bug fixes before
altering to new kernel structures.
2009-04-21 19:16:22 +00:00
Milan Broz
c4ff133840 Tidy lv_hash[_lock] use inside clvmd.
- Rename unlock_all to destroy_lvhash,
this function is called in cluster shutdown
unlocks everything and clean up allocated info space.

 - Tidy lv_hash_lock use
.
Except adding free(lvi) in lv_has destructror
there is no functional change.
2009-04-21 13:11:28 +00:00
Milan Broz
095bbca691 Properly release VG memory pool in activation code and clvmd. 2009-04-10 10:00:04 +00:00
Zdenek Kabelac
beeae21dbb Do not create some dm and lvm static librarie when they are not requested
by configure option
Add dependency for static dmeventd library
2009-04-08 14:04:35 +00:00
Christine Caulfield
3330038ebc Make sure clvmd-corosync releases the lockspace when it exits.
patch from Xinwei Hu
2009-04-01 07:51:05 +00:00
Christine Caulfield
c35df82da9 Block SIGINT & SIGTERM in clvmd subthreads so they don't delay shutdown.
Patch from Xinwei Hu, Thanks
2009-03-24 11:49:15 +00:00
Milan Broz
01a3cb443e Fix clvmd build after liblvm commit. 2009-03-10 12:10:12 +00:00
Christine Caulfield
436cd05156 Fix unlocks in clvmd-corosync.
The DLM unlock returns EUNLOCK in the lksb on success, not 0
2009-03-06 11:29:38 +00:00
Milan Broz
fe3a28e2cc Fix possible increasing in memory allocation if refreshing_context
(for example when CLVMD_CMD_LOCK_VG for is called during vgscan).

If clvmd calls LV lock, it calls
    /* clean the pool for another command */
	dm_pool_empty(cmd->mem);
to clean up memory pool after command.

Unfortunately, do_refresh_cache() do not call this
and because during it operation it allocates some memory,
the pool increases.

Also do_refresh_cache should use lvm_lock
(it manipulates with lvm internal data).

The same applies for lvm_backup command.

Signed-off-by: Milan Broz <mbroz@redhat.com>
2009-03-05 16:25:35 +00:00
Alasdair Kergon
edf47283de Use pkgconfig to obtain corosync library details during configuration. (kabi) 2009-02-25 22:41:12 +00:00
Christine Caulfield
b36d715a92 Fix error returns in clvmd-corosync interface to DLM.
Thanks to Xinwei Hu for spotting this.
2009-02-25 14:33:00 +00:00
Alasdair Kergon
ec6a6fbef2 Move tools/version.h to lib/misc/lvm-version.h.
Split LVM_VERSION into MAJOR, MINOR, PATCHLEVEL, RELEASE and RELEASE_DATE.
2009-02-22 22:11:58 +00:00
Alasdair Kergon
7ac8b7c340 Add system_dir parameter to create_toolcontext() and call it system_dir
everywhere for consistency.
2009-02-22 21:14:37 +00:00
Christine Caulfield
9c61679e6f Add a fully-functional get_cluster_name() to clvmd corosync interface. 2009-02-11 10:13:20 +00:00
Christine Caulfield
0f1917afa7 Remove duplicate cpg_initialize from clvmd startup. 2009-02-10 13:22:18 +00:00
Christine Caulfield
2095de1af2 Allow clvmd to start up if its lockspace already exists. 2009-02-10 11:52:40 +00:00
Christine Caulfield
fd5c5a9703 Allow clvmd to be built with all cluster managers & select one on cmdline. 2009-02-02 14:34:24 +00:00
Alasdair Kergon
8544a8a254 Rename vg_read() to vg_read_internal(). (mornfall) 2009-01-26 19:01:32 +00:00
Christine Caulfield
f2042acc7f Add a corosync/DLM cluster service to clvmd.
It's not integrated in the configure system yet though.
2009-01-22 10:21:12 +00:00
Jonathan Earl Brassow
bf0378593c Initial import of the cluster log daemon from the 'cluster' repository.
There is a rudimentary make file in place so people can build by hand
from 'LVM2/daemons/clogd'.  It is not hooked into the main build system
yet.  I am checking this in to provide people better access to the
source code.

There is still work to be done to make better use of existing code in
the LVM repository.  (list.h could be removed in favor of existing list
implementations, for example.  Logging might also be removed in favor
of what is already in the tree.)

I will probably defer updating WHATS_NEW_DM until this code is linked
into the main build system (unless otherwise instructed).
2009-01-08 17:12:33 +00:00
Dave Wysochanski
0296197999 Create global is_static() to eliminate from the library init function.
Very simple / crude method of removing 'is_static' from initialization.
Why should we require an application tell us whether it is linked
statically or dynamically to libLVM?  If the application is linked
statically, but libraries exist and dlopen() calls succeed, why
do we care if it's statically linked?
2008-12-18 05:27:17 +00:00
Dave Wysochanski
c5c13fe776 Remove struct arg * from struct cmd_context and create_toolcontext().
This allows us to remove one argument from create_toolcontext() and
moves it closer to a generic library init function.

In the arg_*() functions, we just use _the_args() directly.
For now we leave the first parameter to these
arg_*() functions (struct cmd_context *) because
of the number of files involved in removing the
parameter.
2008-12-17 16:46:45 +00:00
Dave Wysochanski
f059ab7150 Remove redundant set_activation() call after create_toolcontext() calls.
Very similar argument to removal of init_debug() and other calls.

create_toolcontext() calls _process_config() which sets
cmd->default_settings.activation, then calls
set_activation(cmd->default_settings.activation).  Later, create_toolcontext()
sets cmd->current_settings = cmd->default_settings.  So these calls
set_activation(cmd->current_settings.activation) are redundant.
2008-12-11 03:34:12 +00:00
Dave Wysochanski
a51b3f838d Remove backup_enable() calls after create_toolcontext() calls.
Identical argument to previous patch which removed archive_enable() calls.
We add a new parameter to backup_init() which sets the enable value based
on the cmd->default_settings.backup value.  This value was used to set
cmd->current_settings.backup, used in the removed backup_enable() call.
2008-12-11 03:33:35 +00:00
Dave Wysochanski
4fa2c7f8b6 Remove archive_enable() calls after create_toolcontext() calls.
_init_backup() calls archive_init(), which originally set 'enabled' to
a hardcoded '1' value.  This seems incorrect based on my read of other
areas of the code so here we add a 'enabled' paramter to archive_init().
We pass in cmd->default_settings.archive, which is obtained from the
config tree.  Later in create_toolcontext, cmd->current_settings is
set to cmd->default_settings.  The archive_enable() call we remove
here was using cmd->current_settings to set the 'archive' enable
value.  The final value of cmd->archive_params->enabled should thus
be equivalent to the original code.
2008-12-11 03:32:56 +00:00
Dave Wysochanski
6f4c0fb93d Remove init_verbose() calls immediately after create_toolcontext() calls.
The rationale for removing init_verbose() call is very similar to removing
init_debug() call.  create_toolcontext() calls _init_logging() which
makes these calls:
        /* Verbose level for tty output */
        cmd->default_settings.verbose =
            find_config_tree_int(cmd, "log/verbose", DEFAULT_VERBOSE);
        init_verbose(cmd->default_settings.verbose + VERBOSE_BASE_LEVEL);

And being that create_toolcontext() copies default_settings into
current_settings at the bottom, the init_verbose() call we are removing:
        init_verbose(cmd->current_settings.verbose + VERBOSE_BASE_LEVEL);

is redundant.
2008-12-11 03:30:19 +00:00
Dave Wysochanski
fb19b83ff2 Remove init_debug() calls immediately after create_toolcontext() call.
We can safely remove because create_toolcontext() calls _init_logging(),
which makes these calls:
        /* Debug level for log file output */
        cmd->default_settings.debug =
            find_config_tree_int(cmd, "log/level", DEFAULT_LOGLEVEL);
        init_debug(cmd->default_settings.debug);

Then at the bottom of create_toolcontext() we do this:
        cmd->current_settings = cmd->default_settings;

So the call we are removing from init_lvm() functions (clvmd and lvmcmdline):
        init_debug(cmd->current_settings.debug);

Just sets the value of debug based on 'cmd->current_settings.debug'.
Since cmd->current_settings is equivalent to cmd->default_settings, and
init_debug() was called with cmd->default_settings, the call we remove is
redundant.
2008-12-11 03:29:37 +00:00
Christine Caulfield
acc4138895 Fix a starup race in clvmd that could result in huge waits for the first command to be processed. 2008-11-21 13:48:00 +00:00
Alasdair Kergon
77b69aa724 make install_device-mapper 2008-11-04 17:25:32 +00:00
Alasdair Kergon
7f78616f3d clvmd 2008-11-04 16:41:47 +00:00
Alasdair Kergon
a479de2e75 dmeventd 2008-11-04 15:55:27 +00:00
Alasdair Kergon
56d8844068 more fixes 2008-11-04 15:07:45 +00:00
Alasdair Kergon
d4b9af444c more tweaks for dmeventd - not finished yet 2008-11-03 23:01:21 +00:00
Alasdair Kergon
2c44337bd5 Right, a simple build (without options) is working again. 2008-11-03 22:14:30 +00:00
Alasdair Kergon
b7edb5bfa7 dmeventd plugins move 2008-10-31 22:29:44 +00:00
Milan Broz
ffc4a05bda Fix snapshot monitoring library to not cancel monitoring invalid snapshot.
snapshot DSO unregistered itself when snapshot changed state to invalid.

This can cause a race (and several timeouts), when for example another snapshot
is added and in the middle of operation (suspend/resume) the monitoring thread
unregister itself.

Fix it by keeping the snapshot monitored after invalidation - just reset
threshold to not really print any messages to syslog.
2008-10-13 12:06:30 +00:00
Alasdair Kergon
68f2de6d4a Add usrlibdir & usrsbindir to configure. 2008-10-07 19:11:59 +00:00
Milan Broz
550463b5e1 Fix mirror DSO to call vgreduce with proper parameters. 2008-09-25 15:52:29 +00:00
Alasdair Kergon
6e410af1d6 fix last release 2008-09-19 15:44:03 +00:00
Alasdair Kergon
8c5bcdabab Improve the way VGs with PVs missing are handled so manual intervention
is required in fewer circumstances.  (mornfall)
2008-09-19 06:42:00 +00:00
Petr Rockai
8153260792 Add #include <signal.h> to dmeventd.c, fixes compilation on NetBSD. 2008-07-09 13:26:07 +00:00
Petr Rockai
2a9a80c9bb Fix dmeventd regression where mirror and snapshot monitoring libraries
failed to link against liblvm2cmd.

Dmeventd DSOs *require* lvm2cmd to be linked in.

For the future:
1) AC_SUBST does not create Makefile variables, only @foo@-style substitutions
2) When using `test', whitespace around `=' is essential:
    test a=b is true, as is test a=a
2008-07-09 09:59:42 +00:00
Zdenek Kabelac
c454025a0f Added generation of the versioned libdevmapper-event.so for LVM's test 2008-06-27 15:36:51 +00:00
Jim Meyering
aa4d1e3106 avoid link failure when configuring without --enable-cmdlib
* configure.in (LVM2CMD_LIB): Define if --enable-cmdlib.
* dmeventd/mirror/Makefile.in (CLDFLAGS): Use $(LVM2CMD_LIB) rather
than hard-coding -llvm2cmd.
* dmeventd/snapshot/Makefile.in (CLDFLAGS): Likewise.
2008-06-23 09:25:08 +00:00
Christine Caulfield
f3c3494c86 Make clvmd return immediately if other nodes are down in an openais cluster. 2008-06-20 12:46:21 +00:00
Christine Caulfield
7515a2cacc Make clvmd return immediately if other nodes are down in a gulm cluster.
bz#447799
2008-06-20 10:58:28 +00:00
Christine Caulfield
b1f8aa24ca Don't call openlog for every invocation of debuglog.
Patch from Masatake YAMATO
2008-06-13 07:44:14 +00:00
Alasdair Kergon
cbb0489782 cleaner LCK_LV decoding 2008-06-06 16:37:51 +00:00
Alasdair Kergon
e350c2f648 Decode numbers in clvmd debugging output. 2008-06-05 14:24:28 +00:00
Alasdair Kergon
25fbec5be1 revert accidental checkin 2008-05-19 20:06:34 +00:00