]> sourceware.org Git - lvm2.git/commitdiff
lvmlockd: enable mirror split and merge with dlm lock_type
authorDavid Teigland <teigland@redhat.com>
Thu, 24 May 2018 20:02:35 +0000 (15:02 -0500)
committerDavid Teigland <teigland@redhat.com>
Wed, 30 May 2018 14:25:45 +0000 (09:25 -0500)
lib/metadata/mirror.c
lib/metadata/raid_manip.c
man/lvmlockd.8_main
tools/lvconvert.c

index 054ca9995fb7047f350454c4ad7d31babd61a2cb..25948ad453e558295f13f7fce9c4e05e74a41021 100644 (file)
@@ -424,6 +424,11 @@ revert_new_lv:
 static int _activate_lv_like_model(struct logical_volume *model,
                                   struct logical_volume *lv)
 {
+       /* FIXME: run all cases through lv_active_change when clvm variants are gone. */
+
+       if (is_lockd_type(lv->vg->lock_type))
+               return lv_active_change(lv->vg->cmd, lv, CHANGE_AEY, 0);
+
        if (lv_is_active_exclusive(model)) {
                if (!activate_lv_excl(lv->vg->cmd, lv))
                        return_0;
@@ -705,6 +710,9 @@ static int _split_mirror_images(struct logical_volume *lv,
                return 0;
        }
 
+       if (!strcmp(lv->vg->lock_type, "dlm"))
+               new_lv->lock_args = lv->lock_args;
+
        if (!dm_list_empty(&split_images)) {
                /*
                 * A number of images have been split and
index 703f285476aef8a1400fec9b730a390c90f421c4..0c631b481efc910381fc6a962fe3e63b0a21e543 100644 (file)
@@ -21,6 +21,7 @@
 #include "activate.h"
 #include "lv_alloc.h"
 #include "lvm-string.h"
+#include "lvmlockd.h"
 
 typedef int (*fn_on_lv_t)(struct logical_volume *lv, void *data);
 static int _eliminate_extracted_lvs_optional_write_vg(struct volume_group *vg,
@@ -3315,7 +3316,7 @@ int lv_raid_split(struct logical_volume *lv, int yes, const char *split_name,
        dm_list_init(&removal_lvs);
        dm_list_init(&data_list);
 
-       if (is_lockd_type(lv->vg->lock_type)) {
+       if (lv->vg->lock_type && !strcmp(lv->vg->lock_type, "sanlock")) {
                log_error("Splitting raid image is not allowed with lock_type %s.",
                          lv->vg->lock_type);
                return 0;
@@ -3394,6 +3395,9 @@ int lv_raid_split(struct logical_volume *lv, int yes, const char *split_name,
 
        lvl->lv->name = split_name;
 
+       if (!strcmp(lv->vg->lock_type, "dlm"))
+               lvl->lv->lock_args = lv->lock_args;
+
        if (!vg_write(lv->vg)) {
                log_error("Failed to write changes for %s.",
                          display_lvname(lv));
@@ -3419,7 +3423,13 @@ int lv_raid_split(struct logical_volume *lv, int yes, const char *split_name,
         * the original RAID LV having possibly had sub-LVs that have been
         * shifted and renamed.
         */
-       if (!activate_lv_excl_local(cmd, lvl->lv))
+
+       /* FIXME: run all cases through lv_active_change when clvm variants are gone. */
+
+       if (is_lockd_type(lvl->lv->vg->lock_type)) {
+               if (!lv_active_change(lv->vg->cmd, lvl->lv, CHANGE_AEY, 0))
+                       return_0;
+       } else if (!activate_lv_excl_local(cmd, lvl->lv))
                return_0;
 
        dm_list_iterate_items(lvl, &removal_lvs)
@@ -3473,7 +3483,7 @@ int lv_raid_split_and_track(struct logical_volume *lv,
        int s;
        struct lv_segment *seg = first_seg(lv);
 
-       if (is_lockd_type(lv->vg->lock_type)) {
+       if (lv->vg->lock_type && !strcmp(lv->vg->lock_type, "sanlock")) {
                log_error("Splitting raid image is not allowed with lock_type %s.",
                          lv->vg->lock_type);
                return 0;
@@ -3574,6 +3584,10 @@ int lv_raid_merge(struct logical_volume *image_lv)
                return 0;
        }
 
+       /* Ensure primary LV is not active elsewhere. */
+       if (!lockd_lv(vg->cmd, lvl->lv, "ex", 0))
+               return_0;
+
        lv = lvl->lv;
        seg = first_seg(lv);
        for (s = 0; s < seg->area_count; ++s)
index 6f982bd19bfbe6d76a61c001c15edf1fb816a003..90a07c70bbefd084d49fa64c12f1e55f5f2692e3 100644 (file)
@@ -852,7 +852,10 @@ using lvcreate to create cache pools or cache LVs (use lvconvert)
 using external origins for thin LVs
 .br
 \[bu]
-splitting mirrors and snapshots from LVs
+splitting snapshots from LVs
+.br
+\[bu]
+splitting mirrors in sanlock VGs
 .br
 \[bu]
 pvmove of entire PVs, or under LVs activated with shared locks
index 72f840ab03b829f3234afc5308d9eb5847ddf9e7..e59a772b920036298d449c743f38b9e34f687484 100644 (file)
@@ -716,8 +716,8 @@ static int _lvconvert_mirrors_parse_params(struct cmd_context *cmd,
        *old_mimage_count = lv_mirror_count(lv);
        *old_log_count = _get_log_count(lv);
 
-       if (is_lockd_type(lv->vg->lock_type) && lp->keep_mimages) {
-               /* FIXME: we need to create a lock for the new LV. */
+       if (lv->vg->lock_type && !strcmp(lv->vg->lock_type, "sanlock") && lp->keep_mimages) {
+               /* FIXME: we need to create a sanlock lock on disk for the new LV. */
                log_error("Unable to split mirrors in VG with lock_type %s", lv->vg->lock_type);
                return 0;
        }
This page took 0.049789 seconds and 5 git commands to generate.