Tony Asleson [Fri, 28 Jun 2013 21:25:28 +0000 (17:25 -0400)]
liblvm: Moved additional pv resize code
The pv resize code required that a lvm_vg_write be done
to commit the change. When the method to add the ability
to list all PVs, including ones that are not assocated with
a VG we had no way for the user to make the change persistent.
Thus additional resize code was move and now liblvm calls into
a resize function that does indeed write the changes out, thus
not requiring the user to explicitly write out he changes.
Tony Asleson [Tue, 8 Jan 2013 22:39:00 +0000 (16:39 -0600)]
lvm2app: Rework argument handling for lv resize
Extend the lv resize parameter structure to contain everything
the re-size functions need so that the command line does not
need to be present for lower level calls when we call from
library functions.
Peter Rajnoha [Wed, 26 Jun 2013 14:27:28 +0000 (16:27 +0200)]
config: add validation for configuration profiles
Besides the classical configuration checks (type checking and
checking whether the item is recognized by lvm tools) for profiles,
do an extra check whether the configuration setting is customizable
by a profile at all. Give a warning message if not.
Peter Rajnoha [Wed, 26 Jun 2013 12:53:57 +0000 (14:53 +0200)]
config: make it possible to run several instances of configuration check at once
Before, the status of the configuration check (config_def_check fn call)
was saved directly in global configuration definitinion array (as part
of the cfg_def_item_t/flags)
This patch introduces the "struct cft_check_handle" that defines
configuration check parameters as well as separate place to store
the status (status here means CFG_USED and CFG_VALID flags, formerly
saved in cfg_def_item_t/flags). This struct can hold config check
parameters as well as the status for each config tree separately,
thus making it possible to run several instances of config_def_check
without interference.
Peter Rajnoha [Wed, 26 Jun 2013 10:29:19 +0000 (12:29 +0200)]
toolcontext: add a few comments for struct cmd_context and rename config_valid -> config_initialized
Just to make it more clear and also not to confuse
config_valid with check against config definition
(and its 'valid' flag within the config defintion tree).
Peter Rajnoha [Tue, 25 Jun 2013 10:32:09 +0000 (12:32 +0200)]
metadata: add support for storing profile name in metadata (during vgcreate/lvcreate)
If "vgcreate/lvcreate --profile <profile_name>" is used, the profile
name is automatically stored in metadata for making it possible to
load it automatically next time the VG/LV is used.
Peter Rajnoha [Tue, 25 Jun 2013 10:28:36 +0000 (12:28 +0200)]
metadata: read VG/LV profile name from metadata if it exists and load it
This is per VG/LV profile loading on demand. The profile itself is saved
in struct volume_group/logical_volume as "profile" field so we can
reference it whenever needed.
So if the profile is used, it overloads the lvm.conf (and any
existing tag configs). However, if "--config" is used to define
a custom configuration on command line, this overloads even the
profile config!
Peter Rajnoha [Tue, 25 Jun 2013 10:27:04 +0000 (12:27 +0200)]
config: add support for loading profiles
This patch adds --profile arg to lvm cmds and adds config/profile_dir
configuration setting to select the directory where profiles are stored
By default it's /etc/lvm/profile.
The profiles are added by using new "add_profile" fn and then loaded
using the "load_profile" fn. All profiles are stored in a cmd context
within the new "struct profile_params":
...where "dir" is the directory with profiles, "global_profile" is
the profile that is set globally via the --profile arg (IOW, not
set per VG/LV basis based on metadata record) and the "profiles"
is the list with loaded profiles.
Configuration profiles are selected configuration items that can
be loaded dynamically on demand and overlayed over existing
configuration on demand (either on cmd line by selecting the profile
name to be used globally or retrieved from metadata and used per
VG/LV basis only).
The default directory where profiles are stored is configurable
at compile time with --with-default-profile-subdir.
Peter Rajnoha [Tue, 25 Jun 2013 10:25:43 +0000 (12:25 +0200)]
config: add config_source_t type to identify configuration source
A helper type that helps with identification of the configuration source
which makes handling the configuration cascade a bit easier, mainly
removing and adding configuration trees to cascade dynamically.
Currently, the possible types are:
CONFIG_UNDEFINED - configuration is not defined yet (not initialized)
CONFIG_FILE - one file configuration
CONFIG_MERGED_FILES - configuration that is a result of merging more files into one
CONFIG_STRING - configuration string typed on cmd line directly
CONFIG_PROFILE - profile configuration (the new type of configuration, patches will follow...)
Also, generalize existing "remove_overridden_config_tree" to work with
configuration type identification in a cascade. Before, it was just
the CONFIG_STRING we used. Now, we need some more to add in a
cascade (like the CONFIG_PROFILE). So, we have:
In the last update not all code paths have set the archived flag.
If we run in test mode or without archiving enabled - set the bit
as well - so test whether archiving has been called succesfully
will be ok. (in relase fix).
Zdenek Kabelac [Sun, 30 Jun 2013 16:01:19 +0000 (18:01 +0200)]
archiver: do not archive vg more then once
Do not keep multiple archives for the executed command.
Reuse the ALLOCATABLE_PV from pv status for
ARCHIVED_VG vg status. Mark VG with the bit with the
first archivation.
Peter Rajnoha [Thu, 27 Jun 2013 14:03:35 +0000 (16:03 +0200)]
metadata: log_debug only when BA found in metadata
...not the other way round as it was before. This way it makes
more sense as BA use is exceptional and it's useless to
contaminate the log with messages about BA not being found
in metadata.
Zdenek Kabelac [Thu, 18 Feb 2010 15:38:32 +0000 (16:38 +0100)]
debug: add pointer to -DDEBUG_POOL compilation
Show 'at' pointer address with pool name.
It's useful for debugging to be able to locate pointer address in the
debug trace log. It's only available when compiled with extra debug
compilation flag DEBUG_POOL in make.tmpl.
Zdenek Kabelac [Thu, 20 Jun 2013 12:08:25 +0000 (14:08 +0200)]
cleanup: use log_print instead of log_error
Since reduce the message has informational character and doesn't lead
to exit of the command - reduce the log level to info print as we
use for other similar types.
Jonathan Brassow [Wed, 19 Jun 2013 22:50:10 +0000 (17:50 -0500)]
RAID/MIRROR: Honor mirror_segtype_default when upconverting linear LVs
If the user would upconvert a linear LV to a mirror without specifying
the segment type ("--type mirror" vs "--type raid1"), the "mirror"
segment type would be chosen without consulting the 'default_mirror_segtype'
setting in lvm.conf. This is now used as the basis for determining
which should be used if left unspecified.
Zdenek Kabelac [Tue, 18 Jun 2013 19:50:29 +0000 (21:50 +0200)]
vgcfgrestore: fix crash on restore of wrong vgname
When vgname has not existed in metadata, it has crashed on double free
in format_instance destroy() - since VG was created, used FID and was
released - which also released FID, so further use was accessing bad
memory.
Fix it for this code path before release_vg() so FID will exists
when _vg_read_file_name() returns NULL.
Jonathan Brassow [Mon, 17 Jun 2013 18:03:15 +0000 (13:03 -0500)]
RAID: Remove optimization using static vars in lv_raid_dev_health
Revert commit 37ffe6a. If static variables are to be used then we
will put them elsewhere and limit the optimization to reporting
code, rather that have it be used in the general case.