]> sourceware.org Git - lvm2.git/commitdiff
Thin creation without activation
authorZdenek Kabelac <zkabelac@redhat.com>
Sun, 30 Oct 2011 22:07:38 +0000 (22:07 +0000)
committerZdenek Kabelac <zkabelac@redhat.com>
Sun, 30 Oct 2011 22:07:38 +0000 (22:07 +0000)
All thins are created with the next activation and VG is updated
without messages. Only some basic commands works.
(i.e. lvcreate -an  -V10 -T mvg/pool)
There can be some combination to confuse this system.

This functionality for snapshots is going to be interesting.

lib/metadata/lv_manip.c
tools/lvchange.c
tools/vgchange.c

index 3ad1215e0a48bd24a39ad903426a3b8bab0d5704..c0020e2cc4bb0719dd1378c479762e10e44948a0 100644 (file)
@@ -4194,8 +4194,12 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
 
        init_dmeventd_monitor(lp->activation_monitoring);
 
-       if (seg_is_thin_pool(lp) || seg_is_thin(lp)) {
-               if (!activate_lv_excl(cmd, lv)) {
+       if (seg_is_thin(lp)) {
+               if ((lp->activate == CHANGE_AY) ||
+                   (lp->activate == CHANGE_ALY))
+                        lp->activate = CHANGE_AE;
+               if ((lp->activate == CHANGE_AE) &&
+                   !activate_lv_excl(cmd, lv)) {
                        log_error("Aborting. Failed to activate thin %s.",
                                  lv->name);
                        goto deactivate_and_revert_new_lv;
@@ -4222,7 +4226,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg, struct l
                          lp->snapshot ? "snapshot exception store" :
                                         "start of new LV");
                goto deactivate_and_revert_new_lv;
-       } else if (seg_is_thin_volume(lp)) {
+       } else if (seg_is_thin_volume(lp) && (lp->activate == CHANGE_AE)) {
                /* FIXME: for now we may drop any queued thin messages
                 * since we are sure everything was activated already */
                if (!detach_pool_messages(first_seg(lv)->pool_lv)) {
index c58a9e38098bbef73dd444725fd90d81bddb73aa..42933b6264c74272010c59aac050e0ddb1e7b200 100644 (file)
@@ -142,6 +142,10 @@ static int lvchange_availability(struct cmd_context *cmd,
                                    "exclusively", lv->name);
                        if (!activate_lv_excl(cmd, lv))
                                return_0;
+                       /* Drop any left thin messages after activation */
+                       if (lv_is_thin_volume(lv) &&
+                           !detach_pool_messages(first_seg(lv)->pool_lv))
+                               return_0;
                } else if (activate == CHANGE_ALY) {
                        log_verbose("Activating logical volume \"%s\" locally",
                                    lv->name);
index 39d58f1460a17a13f06405808fbd7e995acfbe05..6004371dbf5a03eae054e1f87aab23f3edf628a3 100644 (file)
@@ -157,6 +157,12 @@ static int _activate_lvs_in_vg(struct cmd_context *cmd,
                                stack;
                                continue;
                        }
+                       /* Drop any left thin messages after activation */
+                       if (lv_is_thin_volume(lv) &&
+                           !detach_pool_messages(first_seg(lv)->pool_lv)) {
+                               stack;
+                               continue;
+                       }
                } else if (activate == CHANGE_ALY) {
                        if (!activate_lv_local(cmd, lv)) {
                                stack;
This page took 0.042081 seconds and 5 git commands to generate.