1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-03 05:18:29 +03:00

activation: use improved lv_info

Call lv_info() with info == NULL to query for local active presence.
This commit is contained in:
Zdenek Kabelac 2013-09-19 22:18:16 +02:00
parent 3b604e5c8e
commit 1fdead8d97

View File

@ -738,7 +738,7 @@ int lv_snapshot_percent(const struct logical_volume *lv, percent_t *percent)
int r;
struct dev_manager *dm;
if (!activation())
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
log_debug_activation("Checking snapshot percent for LV %s/%s", lv->vg->name, lv->name);
@ -760,7 +760,6 @@ int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
{
int r;
struct dev_manager *dm;
struct lvinfo info;
/* If mirrored LV is temporarily shrinked to 1 area (= linear),
* it should be considered in-sync. */
@ -769,16 +768,11 @@ int lv_mirror_percent(struct cmd_context *cmd, const struct logical_volume *lv,
return 1;
}
if (!activation())
if (!lv_info(cmd, lv, 0, NULL, 0, 0))
return 0;
log_debug_activation("Checking mirror percent for LV %s/%s", lv->vg->name, lv->name);
if (!lv_info(cmd, lv, 0, &info, 0, 0))
return_0;
if (!info.exists)
return 0;
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@ -804,15 +798,12 @@ int lv_raid_dev_health(const struct logical_volume *lv, char **dev_health)
*dev_health = NULL;
if (!activation())
return_0;
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
log_debug_activation("Checking raid device health for LV %s/%s",
lv->vg->name, lv->name);
if (!lv_is_active_locally(lv))
return 0;
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@ -835,15 +826,12 @@ int lv_raid_mismatch_count(const struct logical_volume *lv, uint64_t *cnt)
*cnt = 0;
if (!activation())
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
log_debug_activation("Checking raid mismatch count for LV %s/%s",
lv->vg->name, lv->name);
if (!lv_is_active_locally(lv))
return_0;
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@ -866,15 +854,12 @@ int lv_raid_sync_action(const struct logical_volume *lv, char **sync_action)
*sync_action = NULL;
if (!activation())
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0))
return 0;
log_debug_activation("Checking raid sync_action for LV %s/%s",
lv->vg->name, lv->name);
if (!lv_is_active_locally(lv))
return_0;
if (!(dm = dev_manager_create(lv->vg->cmd, lv->vg->name, 1)))
return_0;
@ -906,7 +891,7 @@ int lv_raid_message(const struct logical_volume *lv, const char *msg)
return 0;
}
if (!lv_is_active_locally(lv)) {
if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0)) {
log_error("Unable to send message to an inactive logical volume.");
return 0;
}