1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-26 17:25:10 +03:00

lvmlockd: enable mirror split and merge with dlm lock_type

This commit is contained in:
David Teigland 2018-05-24 15:02:35 -05:00
parent 3a4fe54ca1
commit db8d3bdfa9
4 changed files with 31 additions and 6 deletions

View 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

View 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)

View 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

View 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;
}