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

127 Commits

Author SHA1 Message Date
Alasdair Kergon
08f1ddea6c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
Alasdair Kergon
77d308ef77 Fix --[vg]metadatacopies arg processing 2010-06-30 20:21:03 +00:00
Alasdair Kergon
d67c40f9e8 Update partial mode warning message. 2010-06-30 16:43:09 +00:00
Dave Wysochanski
a9d8bf269a Allow 'all' and 'unmanaged' values for --vgmetadatacopies.
Allowing an 'all' and 'unmanaged' value is more intuitive, and
provides a simple way for users to get back to original LVM behavior
of metadata written to all PVs in the volume group.

If the user requests "--vgmetadatacopies unmanaged", this instructs
LVM not to manage the ignore bits to achieve a specific number of
metadata copies in the volume group.  The user is free to use
"pvchange --metadataignore" to control the mdas on a per-PV basis.
If the user requests "--vgmetadatacopies all", this instructs LVM
to do 2 things: 1) clear all ignore bits, and 2) set the "unmanaged"
policy going forward.

Internally, we use the special MAX_UINT32 value to indicate 'all'.
This 'just' works since it's the largest value possible for the
field and so all 'ignore' bits on all mdas in the VG will get
cleared inside _vg_metadata_balance().  However, after we've
called the _vg_metadata_balance function, we check for the special
'all' value, and if set, we write the "unmanaged" value into the
metadata.  As such, the 'all' value is never written to disk.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:40:01 +00:00
Dave Wysochanski
7088fb9260 Ensure --metadatacopies parameter gets interpreted based on command.
Now that we have both --pvmetadatacopies and --vgmetadatacopies,
we need to make sure --metadatacopies gets interpreted correctly.

For pv commands, --metadatacopies should imply --pvmetadatacopies,
and for vg commands, --vgmetadatacopies.

Note: this will change the behavior of vgcreate with --metadatacopies
to be a synonym for --vgmetadatacopies.  Previously, --metadatacopies
would apply to any PVs given with vgcreate that needed an implicit
pvcreate.  As a result, one small change is needed to one of the nightly
tests - t-vgcreate-usage.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:39:39 +00:00
Peter Rajnoha
d50c6d4bf5 Add new --sysinit option for vgchange and lvchange.
A shortcut for --ignorelockingfailure, --ignoremonitoring, --poll n options
and LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES environment variable used all at
once in initialisation scripts (e.g. rc.sysinit or initrd).
2010-05-06 11:15:55 +00:00
Petr Rockai
9409998d71 Suppress duplicate error messages about read failures and missing devices. 2010-05-05 22:37:52 +00:00
Peter Rajnoha
c7fe469700 And be consistent with return code as well (previous commit). 2010-04-30 13:47:11 +00:00
Peter Rajnoha
5ff4274f9b Don't run any complex initialisation for the "version" lvm2 command.
We can use it even in read-only environment where a try to initialise
file-based locking fails (not to mention other processing related with
lvm2 init). Simply, we want to output the version only, nothing else.
And this should always work.
2010-04-30 13:28:44 +00:00
Alasdair Kergon
54d7741a3e Remove no-longer-used arg_ptr_value.
Fix -M and --type to use strings not pointers that change on config refresh.
2010-04-29 01:38:12 +00:00
Peter Rajnoha
310efa7b96 UDEV_SYNC_SUPPORT, not UDEV_SYNC! 2010-03-23 15:13:03 +00:00
Peter Rajnoha
91345610f8 Strictly require libudev if udev_sync is used.
This prevents some confusion when libudev was not found so udev_sync was disabled
automatically. Configure was successful though giving only a tiny warning.

Also, if "dmsetup udevcreatecookie" is used, never return 0x000000 as a result if
udev is not running and keep the output blank.
2010-03-23 14:43:18 +00:00
Peter Rajnoha
3c134e0165 Don't use LVM_UDEV_DISABLE_CHECKING environment variable anymore.
Set the state automatically based on udev and libdevmapper dev path comparison.
If these paths differ, disable udev checking.
2010-02-15 16:26:48 +00:00
Mike Snitzer
5bc2af2688 Add %ORIGIN support to lv{create,extend,reduce,resize} --extents option
Allow the number of logical extents to be expressed (for a snapshot) as
a percentage of the total space in the Origin Logical Volume with the
suffix %ORIGIN.

Update the relevant man pages accordingly.  Eliminate inconsistencies
between the man pages and tools/commands.h

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-02-03 03:58:08 +00:00
Milan Broz
98d85f25be Move error message to locking constructor and print
more descriptive message if locking fails instead of
"Locking type -1 initialisation failed."

Use read-only locking instead of misleading ignorelocking option
in message.
2010-01-22 09:45:29 +00:00
Zdenek Kabelac
d40821aabc Reset released pointer and counters.
DSO is currently not dl_close-ing pluing during it is unregister handling,
so clear structure and related counter, so there are no memory problems.
Futher fixes are needed.
2010-01-21 13:41:39 +00:00
Mike Snitzer
94d4a90f27 Only allow one return from poll_daemon(). If a child polldaemon was
successfully created it must _exit() once it completes.

Update _become_daemon() to differentiate between a failed fork() and a
successful fork().

Added lvm_return_code() to lvmcmdline.[ch]
2010-01-11 19:19:17 +00:00
Peter Rajnoha
a750353641 Add support to disable udev checking: LVM_UDEV_DISABLE_CHECKING=1 env. var.
LVM_UDEV_DISABLE_CHECKING=1 applies for /dev/<vgname> content only.
We still need to define DM_UDEV_DISABLE_CHECKING=1 for /dev/mapper content.
2010-01-11 15:40:03 +00:00
Petr Rockai
550cae2340 #define an INTERNAL_ERROR macro and use it throughout LVM. 2009-12-16 19:22:11 +00:00
Alasdair Kergon
a8fb89adaf Tidy some uses of arg_count and introduce arg_is_set. 2009-11-03 15:50:42 +00:00
Dave Wysochanski
0ddb66efba Add --pvmetadatacopies as a synonym for --metadatacopies in various commands.
Going forward, we would like to allow users to specify the total
number of metadatacopies in a VG rather than on a per-PV basis.  In
order to facilitate that, introduce --pvmetadatacopes to replace
--metadatacopies everywhere.  We still allow --metadatacopies for
pv commands, but require --pvmetadatacopies for vg commands.
Eventually we will introduce --vgmetadatacopies.  Once we do that,
we should either deprecate --metadatacopies or make it a synonym based
on the command (pvmetadatacopies for pv commands, and vgmetadatacopies
for vg commands).  The latter option would likely just require a simple
'strncpy' check against cmd->command->name to qualify the merge_synonym
call.

Update nightly tests to cover the pvmetadatacopies synonym.

Note that this patch is the result of an eariler review comment for
the implicit pvcreate patches.  Should apply cleanly on top of the
implicit pvcreate patches (I applied after patch 10/10 in that series).

NOTE: This patch will require --pvmetadatacopies for vgconvert as
--metadatacopies is no longer accepted.
2009-10-05 20:55:56 +00:00
Alasdair Kergon
651ff9b328 Add lots of missing stack debug messages to tools.
Make readonly locking available as locking type 4.
Fix readonly locking to permit writeable global locks (for vgscan). (2.02.49)
2009-09-14 22:47:49 +00:00
Alasdair Kergon
cf8235e0aa Add activation/udev_sync to lvm.conf. 2009-08-04 15:36:13 +00:00
Dave Wysochanski
9085c301e0 Rename _override_settings into override_config_tree_from_string and move.
Move _override_settings from tools/lvmcmdline.c into lib/config/config.c
and export so we can re-use in liblvm.
2009-07-27 21:01:56 +00:00
Dave Wysochanski
776ac1562e Refactor _override_settings to take the new config string as input.
We will re-use this function from liblvm.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-27 21:01:36 +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
Alasdair Kergon
7f355587f5 Make cmd->cmd_line const. 2009-07-13 19:49:48 +00:00
Dave Wysochanski
6cf4278659 Fix compile warning in lvmcmdline.c - use C99 PRIu64 for uint64_t.
Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-07 01:51:00 +00:00
Mike Snitzer
c1060e13a7 Allow commandline sizes to be specified in terms of bytes and sectors.
Update the man pages to document size units uniformly.
2009-07-06 19:13:26 +00:00
Alasdair Kergon
154753db8b Make --snapshot optional with lvcreate --virtualsize.
Generalise --virtualoriginsize to --virtualsize.
2009-05-27 16:30:29 +00:00
Milan Broz
212a510f04 Do not use pointer from released memory pool (cmd->cmd_line). 2009-04-02 14:59:48 +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
Dave Wysochanski
76cc7b2754 Move locking_type reading inside init_locking().
No functional change.
2009-02-03 16:23:19 +00:00
Peter Rajnoha
ed96a9feb4 Fix incorrect return value in help function. 2008-12-19 14:43:02 +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
0fa2c4ed7f Move arg_* functions from toollib.c to lvmcmdline.c.
In preparation for removing cmd->args.
IMO, it makes more sense to put these accessor functions
in the same location as the static array _the_args.
Next patch will update arg_* functions to use _the_args[]
directly and remove cmd->args.
2008-12-17 16:45:32 +00:00
Dave Wysochanski
24bf9537a7 Create _init_globals() and call from bottom of create_toolcontext().
Move init_full_scan_done(0) and init_mirror_in_sync(0) from init_lvm()
after call to create_toolcontext() to _init_globals(), called from bottom
of create_toolcontext().  No functional change.

Author: Dave Wysochanski <dwysocha@redhat.com>
Acked-by: James Cameron <james.cameron@hp.com>
Acked-by: Alasdair G Kergon <agk@redhat.com>
2008-12-12 03:30:41 +00:00
Dave Wysochanski
9a04baa27c Move initialization of cmd->fmt into init_formats().
init_formats() sets up the command formats, and currently sets cmd->fmt_backup
but does not set cmd->fmt to a default value.  This seems incorrect so we
set it to cmd->default_settings.fmt before returning.

The call we remove here may set cmd->fmt based on a command line setting.
But it is safe to remove this, because the only caller of init_lvm() that
cares about the cmdline override is the cmdline tools (clvmd does not care),
called from lvm2_main().  After lvm2_main() calls init_lvm(), it later calls
lvm_run_command().  In lvm_run_command(), we have a call to _apply_settings(),
which has the identical assignment of cmd->fmt that this patch removes.
2008-12-11 03:36:16 +00:00
Dave Wysochanski
3368322e0d Remove redundant init_msg_prefix() and init_cmd_name().
This is very obvious - _init_logging() makes the identical init_msg_prefix()
and init_cmd_name() calls with cmd->default_settings so these calls are
clearly redundant after calling create_toolcontext().
2008-12-11 03:34:43 +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
058f3d3523 Move init_test() from _apply_settings into _init_logging().
This one we actually need to move.  _init_logging() is called from
    create_toolcontext(), which makes this call:
        /* Test mode */
        cmd->default_settings.test =
            find_config_tree_int(cmd, "global/test", 0);

But it does not call init_test().  So we need an init_test() somewhere.
The most logical place is to put it inside _init_logging(), since this
is where the config value is read and default_settings are set.  Placing
the init_test() call here matches what is done with other variables and
seems to make sense.
2008-12-11 03:31:47 +00:00
Dave Wysochanski
b0eb2d3ac5 Remove handles_missing_pvs assignment after call to create_toolcontext().
This variable is set at the top of create_toolcontext() to 0.
Nothing later in create_toolcontext() changes the value.
In init_lvm(), nothing between create_toolcontext() call and this assignment
changes the value.  Thus, the assignment is redundant.
2008-12-11 03:31:10 +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