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

415 Commits

Author SHA1 Message Date
Alasdair Kergon
667c6be176 Clean up include files. 2010-01-18 21:07:24 +00:00
Jonathan Earl Brassow
98998134de Fix some compiler warnings. 2010-01-18 20:58:50 +00:00
Alasdair Kergon
3c4310d6ef Misc compilation clean-ups. 2010-01-18 20:08:44 +00:00
Jonathan Earl Brassow
27318b98a1 Make the intermachine communication structures architecture independant
to allow for mixed architecture clusters.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2010-01-15 19:49:35 +00:00
Jonathan Earl Brassow
3579eeb2b0 When moving the cluster log server into the LVM tree, the in memory
bitmap tracking was switched from the e2fsprogs implementation to
the device-mapper implementation (dm_bitset_t).  The latter has a
leading uin32_t field designed to hold the number of bits that are
being tracked.  The code was not properly handling this change in
all places.  Specifically, when getting the bitmap to/from disk.

Endian adjustments will likely need to be made on the accounting
field as well, since bitmaps are passed between machines on
start-up.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2010-01-15 18:48:24 +00:00
Jonathan Earl Brassow
e30f6c899d At some point "clustered_[core|disk]" was changed to "clustered-[core|disk]".
This patch makes the log server recognise the new format.

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
2010-01-15 16:03:19 +00:00
Zdenek Kabelac
5a4eeb69c4 Cleanup gcc warning: null argument where non-null required (arg.2)
As the const declaration of execvp is a bit weird, using local
dmeventdpath string.
2010-01-14 10:11:26 +00:00
Milan Broz
bf8c8a6d61 Remove empty "repaired" devices if empty in lvconvert.
The logic was that lvconvert repair volumes, marking
PV as MISSING and following vgreduce --removemissing
removes these missing devices.

Previously dmeventd mirror DSO removed all LV and PV
from VG by simply relying on
vgreduce --removemissing --force.

Now, there are two subsequent calls:
lvconvert --repair --use-policies
vgreduce --removemissing

So the VG is locked twice, opening space for all races
between other running lvm processes. If the PV reappears
with old metadata on it (so the winner performs autorepair,
if locking VG for update) the situation is even worse.


Patch simply adds removemissing PV functionality into
lvconcert BUT ONLY if running with --repair and --use-policies
and removing only these empty missing PVs which are
involved in repair.
(This combination is expected to run only from dmeventd.)
2010-01-06 13:26:21 +00:00
Milan Broz
0e06c92fdf Propagate commit and revert metadata event to other nodes in cluster.
This patch tries to correctly track changes in lvmcache related to commit/revert.

For vg_commit: if there is cached precommitted metadata, after successfull commit
these metadata must be tracked as committed.

For vg_revert: remote nodes must drop precommitted metadata and its flag in lvmcache.

(N.B. Patch do not touch LV locks here in any way.)

All this machinery is needed to properly solve remote node cache invalidaton which
cause several problems recently observed.
2010-01-05 16:09:33 +00:00
Milan Broz
c9118a1d20 Proper mask lock mode for vg lock.
Lock mode is int masked by LCK_TYPE_MASK, always.

Patch also remove uneccessary masking lock flag on sender side,
if masking is needed, it is don on client side already.
2010-01-05 16:07:56 +00:00
Milan Broz
d37be0b865 Add possibility to handle precommitted metadata in lvmcache.
- Add drop_precommitted flag to force drop precommitted metadata
 - add lvmcache_commit_metadata() which upgrades precommitted metadata in cache

No functional change in this patch - just preparation for following change.
2010-01-05 16:06:42 +00:00
Milan Broz
ac85c2e75b Move processing of VG locks to separate function (similar to LV locks).
And print some debugging info.

No functional change in this patch.
2010-01-05 16:05:12 +00:00
Milan Broz
d7f44761ab Properly decode flags even for VG locks.
And decode flags in humar readable form in client.
And clean some trailing whitespaces.

No functional change in this patch (only debugging messages changed).
2010-01-05 16:03:37 +00:00
Milan Broz
452bbb87a9 Fix missing include. 2009-12-09 19:30:56 +00:00
Milan Broz
27132718d4 Add memlock information to do_lock_lv debug output.
This helps a lot to detect that something strange happened.
2009-12-09 19:01:27 +00:00
Milan Broz
85fabd8116 Never ever use distributed lock for LV in non-clustered VG.
The LV locks make sense only for clustered LVs.

Properly check cluster flag and never issue cluster lock here.

There are several places in code, where it is already checked, this
patch add this check to all needed calls.

In previous code the lock behaviour was inconsistent,
for example, the pre/post callback can take lock even for local volume,
but deactivate call do not released this lock and it remains held forever.

The local LV lock request now just let run the underlying activation code
on local node, the same process like in local locking.

(Again, this is important for new mirror repair calls, here for local
mirrors but with cluster locking enabled.)
2009-12-09 19:00:16 +00:00
Milan Broz
4b3efd3537 Allow implicit lock conversion for pre/post callbacks.
This is unnoticed regression from commit 31672ff60e

The pre/post callback need to convert lock always, local node
is going to modify metadata in this case, it it fails conversion,
the call is ignored.

Also it fixes bug when the lock is not yet held, we cannot set LKF_CONVERT
in this case, it will fail because this lock do not exist.

Note that the automatic conversion is still disabled in activate
call, so the original fix (reactivation of exlusive LV) should
be still in place.
2009-12-09 18:55:53 +00:00
Milan Broz
4499aa2ea5 Allow implicit "convert" to the same lock mode.
(Code already not fail if unlocking not locked resource.)

This is needed in pre/post lock_lv call, where we can
request the same lock on local node becuase of suspend call.
2009-12-09 18:45:12 +00:00
Milan Broz
cc31b2bd3f Get rid of magic masks in cluster locking code - clvmd part.
- do_command and lock_vg expect flags (no change here)

Bug fixes:
- lock_vg should check for NONBLOCK on lock_cmd, flags have this bit masked-out

- do_pre/post_command expect do not mask flag at all, this causes that
the code inside is never run! (see following patches, these functions
expect plain command without flags)
2009-12-09 18:42:02 +00:00
Alasdair Kergon
32780caae3 Log failure type and recognise type 'F' (flush) in dmeventd mirror plugin. 2009-11-25 15:59:07 +00:00
Milan Broz
a4893bc377 Revert vg_read_internal change, clvmd cannot use vg_read now. (2.02.55) 2009-11-23 10:44:50 +00:00
Petr Rockai
090585a8f4 Un-export vg_read_internal. 2009-11-19 12:13:37 +00:00
Milan Broz
f145ddc9e7 Fix install_device-mapper Makefile target to not build dmeventd plugins. 2009-11-13 12:48:01 +00:00
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