From: Zdenek Kabelac <zkabelac@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH 4/5] lvm2app: Move core lv re-size code (v2)
Date: Fri, 15 Mar 2013 09:17:01 +0100 [thread overview]
Message-ID: <5142D8FD.5000107@redhat.com> (raw)
In-Reply-To: <1363284884-20506-4-git-send-email-tasleson@redhat.com>
Dne 14.3.2013 19:14, Tony Asleson napsal(a):
> Moved to allow use from command line and for library use.
>
> Signed-off-by: Tony Asleson <tasleson@redhat.com>
> ---
> lib/metadata/lv_manip.c | 734 +++++++++++++++++++++++++++++++++++++
> lib/metadata/metadata-exported.h | 46 +++
> tools/lvresize.c | 773 +--------------------------------------
> 3 files changed, 781 insertions(+), 772 deletions(-)
>
> diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
> index ad8160e..a6825ed 100644
> --- a/lib/metadata/lv_manip.c
> +++ b/lib/metadata/lv_manip.c
> @@ -27,6 +27,8 @@
> #include "activate.h"
> #include "str_list.h"
> #include "defaults.h"
> +#include "lvm-exec.h"
> +#include "errors.h"
hmmm - now the 'error.h' change.
So far nothing in the /lib was using this. The API here is - 1 Ok, 0 False.
> +static int _adjust_policy_params(struct cmd_context *cmd,
> + struct logical_volume *lv, struct lvresize_params *lp)
> +{
> + percent_t percent;
> + int policy_threshold, policy_amount;
> +
> + if (lv_is_thin_pool(lv)) {
> + policy_threshold =
> + find_config_tree_int(cmd, activation_thin_pool_autoextend_threshold_CFG) * PERCENT_1;
> + policy_amount =
> + find_config_tree_int(cmd, activation_thin_pool_autoextend_percent_CFG);
> + if (!policy_amount && policy_threshold < PERCENT_100)
> + return 0;
> + } else {
> + policy_threshold =
> + find_config_tree_int(cmd, activation_snapshot_autoextend_threshold_CFG) * PERCENT_1;
> + policy_amount =
> + find_config_tree_int(cmd, activation_snapshot_autoextend_percent_CFG);
> + }
> +
> + if (policy_threshold >= PERCENT_100)
> + return 1; /* nothing to do */
> +
> + if (lv_is_thin_pool(lv)) {
> + if (!lv_thin_pool_percent(lv, 1, &percent))
> + return_0;
> + if (percent > policy_threshold) {
> + /* FIXME: metadata resize support missing */
> + log_error("Resize for %s/%s is not yet supported.",
> + lp->vg_name, lp->lv_name);
> + return ECMD_FAILED;
> + }
However now the code inside /lib would have start to generate errors not
really related to current /lib functionality - i.e. command failure,
> +
> + if (lp->ac_stripesize &&
> + !_validate_stripesize(cmd, vg, lp))
> + return EINVALID_CMD_LINE;
> +
command line args parsing problems and many other pieces which so far belongs
to /tools. So the plain code move doesn't work here.
The issue is of course bigger - since the current 1/0 internal lvm logic
doesn't support well the public API where you really want to know the 'reason'
for failure - which ATM is just logged with log_error() deeply from
liblvm/libdm code.
We need here some decision - I guess - the best would be probably to define
the list of error codes we want to expose to the lvm2api users first.
Should the API user know about dm errors?
Parameter errors ?
Memory errors ?
Internal errors ?
Zdenek
next prev parent reply other threads:[~2013-03-15 8:17 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-14 18:14 [PATCH 1/5] lvm2app: Implementation of pv resize (v6) Tony Asleson
2013-03-14 18:14 ` [PATCH 2/5] lvm2app: Move percent_of_extents to lvm-percent.[h|c] Tony Asleson
2013-03-14 18:14 ` [PATCH 3/5] lvm2app: Rework argument handling for lv resize Tony Asleson
2013-03-14 18:14 ` [PATCH 4/5] lvm2app: Move core lv re-size code (v2) Tony Asleson
2013-03-15 8:17 ` Zdenek Kabelac [this message]
2013-03-15 16:30 ` Tony Asleson
2013-03-14 18:14 ` [PATCH 5/5] lvm2app: Implement lv resize (v2) Tony Asleson
-- strict thread matches above, loose matches on Subject: below --
2013-03-13 22:13 [PATCH 1/5] lvm2app: Implementation of pv resize (v6) Tony Asleson
2013-03-13 22:13 ` [PATCH 4/5] lvm2app: Move core lv re-size code (v2) Tony Asleson
2013-03-14 14:12 ` Zdenek Kabelac
2013-03-14 15:12 ` Tony Asleson
2013-03-14 15:14 ` Zdenek Kabelac
2013-03-14 15:29 ` Tony Asleson
2013-03-14 15:39 ` Zdenek Kabelac
2013-03-14 14:17 ` Zdenek Kabelac
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5142D8FD.5000107@redhat.com \
--to=zkabelac@redhat.com \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.