mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Thin updated support for thin pool percent
Support to check also for metadata percent (By checking whether seg pointer is set)
This commit is contained in:
parent
57979a273c
commit
9fae965546
@ -710,9 +710,11 @@ int lv_raid_percent(const struct logical_volume *lv, percent_t *percent)
|
||||
}
|
||||
|
||||
/*
|
||||
* Returns data or metadata percent usage, depends on metadata 0/1.
|
||||
* Returns 1 if percent set, else 0 on failure.
|
||||
*/
|
||||
int lv_thin_pool_percent(const struct logical_volume *lv, percent_t *percent)
|
||||
int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
|
||||
percent_t *percent)
|
||||
{
|
||||
int r;
|
||||
struct dev_manager *dm;
|
||||
@ -720,12 +722,13 @@ int lv_thin_pool_percent(const struct logical_volume *lv, percent_t *percent)
|
||||
if (!activation())
|
||||
return 0;
|
||||
|
||||
log_debug("Checking thin pool percent for LV %s/%s", lv->vg->name, lv->name);
|
||||
log_debug("Checking thin %sdata percent for LV %s/%s",
|
||||
(metadata) ? "meta" : "", lv->vg->name, lv->name);
|
||||
|
||||
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
|
||||
return_0;
|
||||
|
||||
if (!(r = dev_manager_thin_pool_percent(dm, lv, percent)))
|
||||
if (!(r = dev_manager_thin_pool_percent(dm, lv, metadata, percent)))
|
||||
stack;
|
||||
|
||||
dev_manager_destroy(dm);
|
||||
|
@ -101,7 +101,8 @@ int lv_snapshot_percent(const struct logical_volume *lv, percent_t *percent);
|
||||
int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
|
||||
int wait, percent_t *percent, uint32_t *event_nr);
|
||||
int lv_raid_percent(const struct logical_volume *lv, percent_t *percent);
|
||||
int lv_thin_pool_percent(const struct logical_volume *lv, percent_t *percent);
|
||||
int lv_thin_pool_percent(const struct logical_volume *lv, int metadata,
|
||||
percent_t *percent);
|
||||
|
||||
/*
|
||||
* Return number of LVs in the VG that are active.
|
||||
|
@ -874,7 +874,7 @@ static int _belong_to_vg(const char *vgname, const char *name)
|
||||
|
||||
int dev_manager_thin_pool_percent(struct dev_manager *dm,
|
||||
const struct logical_volume *lv,
|
||||
percent_t *percent)
|
||||
int metadata, percent_t *percent)
|
||||
{
|
||||
char *name;
|
||||
const char *dlid;
|
||||
@ -888,8 +888,8 @@ int dev_manager_thin_pool_percent(struct dev_manager *dm,
|
||||
return_0;
|
||||
|
||||
log_debug("Getting device status percentage for %s", name);
|
||||
if (!(_percent(dm, name, dlid, "thin-pool", 0, NULL, percent,
|
||||
NULL, 1)))
|
||||
if (!(_percent(dm, name, dlid, "thin-pool", 0,
|
||||
(metadata) ? lv : NULL, percent, NULL, 1)))
|
||||
return_0;
|
||||
|
||||
return 1;
|
||||
|
@ -56,7 +56,7 @@ int dev_manager_mirror_percent(struct dev_manager *dm,
|
||||
percent_t *percent, uint32_t *event_nr);
|
||||
int dev_manager_thin_pool_percent(struct dev_manager *dm,
|
||||
const struct logical_volume *lv,
|
||||
percent_t *percent);
|
||||
int metadata, percent_t *percent);
|
||||
int dev_manager_suspend(struct dev_manager *dm, struct logical_volume *lv,
|
||||
struct lv_activate_opts *laopts, int lockfs, int flush_required);
|
||||
int dev_manager_activate(struct dev_manager *dm, struct logical_volume *lv,
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved.
|
||||
* Copyright (C) 2004-2012 Red Hat, Inc. All rights reserved.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
@ -305,7 +305,16 @@ static int _adjust_policy_params(struct cmd_context *cmd,
|
||||
return 1; /* nothing to do */
|
||||
|
||||
if (lv_is_thin_pool(lv)) {
|
||||
if (!lv_thin_pool_percent(lv, &percent))
|
||||
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;
|
||||
}
|
||||
|
||||
if (!lv_thin_pool_percent(lv, 0, &percent))
|
||||
return_0;
|
||||
if (!(PERCENT_0 < percent && percent <= PERCENT_100) ||
|
||||
percent <= policy_threshold)
|
||||
|
Loading…
Reference in New Issue
Block a user