]> sourceware.org Git - lvm2.git/commitdiff
Suppress 'removed' messages displayed when internal LVs are removed.
authorAlasdair Kergon <agk@redhat.com>
Wed, 27 May 2009 18:19:21 +0000 (18:19 +0000)
committerAlasdair Kergon <agk@redhat.com>
Wed, 27 May 2009 18:19:21 +0000 (18:19 +0000)
Fix lvchange -a and -p for sparse LVs.
Fix lvcreate --virtualsize to activate the new device immediately.

WHATS_NEW
lib/metadata/lv_manip.c
tools/lvchange.c
tools/lvcreate.c
tools/toollib.c

index b5ba17d459e58f43213a3e571fa27f78996854db..9a3446ef5ca8bc57d58125c0fa1200d89a825968 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,8 +1,11 @@
 Version 2.02.48 - 
 ===============================
+  Suppress 'removed' messages displayed when internal LVs are removed.
+  Fix lvchange -a and -p for sparse LVs.
+  Fix lvcreate --virtualsize to activate the new device immediately.
   Make --snapshot optional with lvcreate --virtualsize.
   Generalise --virtualoriginsize to --virtualsize.
-  Skip virtual origins in process_each_lv_in_vg().
+  Skip virtual origins in process_each_lv_in_vg() without --all.
   Fix counting of virtual origin LVs in vg_validate.
   Attempt to load dm-zero module if zero target needed but not present.
 
index eeb4710151ab54c797b5737fe906f33f08a9549a..3f770996e85af85b16ea4a3a1091098ac6f231c8 100644 (file)
@@ -2037,6 +2037,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
                }
 
                if (lv_is_active(lv) && (force == PROMPT) &&
+                   lv_is_visible(lv) &&
                    yes_no_prompt("Do you really want to remove active "
                                  "%slogical volume %s? [y/n]: ",
                                  vg_is_clustered(vg) ? "clustered " : "",
@@ -2083,7 +2084,9 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv,
                        log_error("Failed to resume %s.", origin->name);
        }
 
-       log_print("Logical volume \"%s\" successfully removed", lv->name);
+       if (lv_is_visible(lv))
+               log_print("Logical volume \"%s\" successfully removed", lv->name);
+
        return 1;
 }
 
index 4a314a3b1073fd96fe0a804436c39fabaa2b07f3..bbeca5bd792531d189e553012cdeee8677da7960 100644 (file)
@@ -540,6 +540,7 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
 {
        int doit = 0, docmds = 0;
        int archived = 0;
+       struct logical_volume *origin;
 
        if (!(lv->vg->status & LVM_WRITE) &&
            (arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
@@ -584,7 +585,12 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
                return ECMD_FAILED;
        }
 
-       if (!(lv_is_visible(lv))) {
+       /* If LV is sparse, activate origin instead */
+       if (arg_count(cmd, available_ARG) && lv_is_cow(lv) &&
+           lv_is_virtual_origin(origin = origin_from_cow(lv)))
+               lv = origin;
+
+       if (!(lv_is_visible(lv)) && !lv_is_virtual_origin(lv)) {
                log_error("Unable to change internal LV %s directly",
                          lv->name);
                return ECMD_FAILED;
index b7dce37b5d07230b7b280042ed156c2acd05b5e2..208299d289d6a40dffdc954cc3b365e55e06cc94 100644 (file)
@@ -910,12 +910,16 @@ static int _lvcreate(struct cmd_context *cmd, struct volume_group *vg,
                        return 0;
                }
 
+               /* A virtual origin must be activated explicitly. */
                if (lp->voriginsize &&
-                   !(org = _create_virtual_origin(cmd, vg, lv->name,
-                                                  lp->permission,
-                                                  lp->voriginextents))) {
+                   (!(org = _create_virtual_origin(cmd, vg, lv->name,
+                                                   lp->permission,
+                                                   lp->voriginextents)) ||
+                    !activate_lv(cmd, org))) {
                        log_error("Couldn't create virtual origin for LV %s",
                                  lv->name);
+                       if (org && !lv_remove(org))
+                               stack;
                        goto deactivate_and_revert_new_lv;
                }
 
index fed240658f2b6ddd0a19a01ba548a3cae53a24a8..7c9ff447b22714341e1883db4375e7e9a548e158 100644 (file)
@@ -122,7 +122,7 @@ int process_each_lv_in_vg(struct cmd_context *cmd,
                if (lvl->lv->status & SNAPSHOT)
                        continue;
 
-               if (lv_is_virtual_origin(lvl->lv))
+               if (lv_is_virtual_origin(lvl->lv) && !arg_count(cmd, all_ARG))
                        continue;
 
                /* Should we process this LV? */
This page took 0.053722 seconds and 5 git commands to generate.