diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2011-10-28 20:28:00 +0000 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2011-10-28 20:28:00 +0000 |
commit | a1d5aaf725ad8de72f605abea6614ba8938c5beb (patch) | |
tree | f018288aff5fa78b043e7b2a4af8dddb2c59c8c9 /tools | |
parent | 2721175d557b506515a9fc439f4a89a717e7a1d5 (diff) | |
download | lvm2-a1d5aaf725ad8de72f605abea6614ba8938c5beb.tar.gz lvm2-a1d5aaf725ad8de72f605abea6614ba8938c5beb.tar.xz lvm2-a1d5aaf725ad8de72f605abea6614ba8938c5beb.zip |
Thin pool activation change
To ensure we properly handle LV cluster locking - explicitely do
not allow to change the availability of the thin pool that is in use
for some thin LV.
As soon as the thin volume is created the only way to activate pool
is via implicit dependency.
Ignore thinpool open count for lv/vgchange operations.
Diffstat (limited to 'tools')
-rw-r--r-- | tools/lvchange.c | 6 | ||||
-rw-r--r-- | tools/toollib.c | 5 | ||||
-rw-r--r-- | tools/vgchange.c | 4 |
3 files changed, 15 insertions, 0 deletions
diff --git a/tools/lvchange.c b/tools/lvchange.c index 1a5cce6b..09377ab1 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -532,6 +532,12 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv, return ECMD_FAILED; } + if (lv_is_used_thin_pool(lv) && + (arg_count(cmd, available_ARG))) { + log_error("Can't change pool volume \"%s\".", lv->name); + return ECMD_FAILED; + } + if (lv_is_cow(lv) && !lv_is_virtual_origin(origin_from_cow(lv)) && arg_count(cmd, available_ARG)) { log_error("Can't change snapshot logical volume \"%s\"", diff --git a/tools/toollib.c b/tools/toollib.c index aba52dc2..21967473 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -126,6 +126,11 @@ int process_each_lv_in_vg(struct cmd_context *cmd, if (lv_is_virtual_origin(lvl->lv) && !arg_count(cmd, all_ARG)) continue; + /* Only unused thin pool can change its availability */ + if (!lvargs_supplied && lv_is_used_thin_pool(lvl->lv) && + arg_count(cmd, available_ARG)) + continue; + /* * Only let hidden LVs through it --all was used or the LVs * were specifically named on the command line. diff --git a/tools/vgchange.c b/tools/vgchange.c index fd4e4208..8cb0e230 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -100,6 +100,10 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd, if (!lv_is_visible(lv)) continue; + /* Never manipulate with thin pools in use */ + if (lv_is_used_thin_pool(lv)) + continue; + /* If LV is sparse, activate origin instead */ if (lv_is_cow(lv) && lv_is_virtual_origin(origin_from_cow(lv))) lv = origin_from_cow(lv); |