1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00

Add lvm_config_override - allow caller to override config, similar to --config.

Allowing the caller to override the LVM configuration with an API will
enable them to use things such as device filters.
While very flexible, there is some danger to this API in that it will
make it harder to debug setups that have a changing config and deduce
what might have happened.  At some point we may want to limit the scope
of this API but for now it is as open as the --config option to lvm commands.

Update exported symbols.  When I renamed lvm_reload_config to lvm_config_reload
I forgot to rename so I renamed that one here.

This I believe is the last liblvm API for now.  ;-)

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
This commit is contained in:
Dave Wysochanski 2009-07-27 21:02:17 +00:00
parent 9085c301e0
commit dce56c9761
3 changed files with 26 additions and 1 deletions

View File

@ -1,6 +1,7 @@
lvm_create
lvm_destroy
lvm_reload_config
lvm_config_reload
lvm_config_override
lvm_pv_get_name
lvm_pv_get_uuid
lvm_pv_get_mda_count

View File

@ -148,6 +148,22 @@ void lvm_destroy(lvm_t libh);
*/
int lvm_config_reload(lvm_t libh);
/**
* Override the LVM configuration with a configuration string.
*
* This API is equivalent to the --config option on lvm commands.
* FIXME: submit a patch to document the --config option
* Once this API has been used to over-ride the configuration,
* you should use lvm_config_reload to apply the new settings.
* \param libh
* Handle obtained from lvm_create.
* \param config_settings
* LVM configuration string to apply. See the lvm.conf file man page
* for the format of the config string.
* \return 0 (success) or -1 (failure).
*/
int lvm_config_override(lvm_t libh, const char *config_string);
/**
* Return stored error no describing last LVM API error.
*

View File

@ -72,6 +72,14 @@ int lvm_config_reload(lvm_t libh)
return 0;
}
int lvm_config_override(lvm_t libh, const char *config_settings)
{
struct cmd_context *cmd = (struct cmd_context *)libh;
if (override_config_tree_from_string(cmd, config_settings))
return -1;
return 0;
}
int lvm_errno(lvm_t libh)
{
return stored_errno();