mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
pvmove: Fix inability to specify LV name when moving RAID, mirror, or thin LV
Top-level LVs (like RAID, mirror or thin) are ignored when determining which portions of an LV to pvmove. If the user specified the name of an LV to move and it was one of the above types, it would be skipped. The code would never move on to check whether its sub-LVs needed moving because their names did not match what the user specified. The solution is to check whether a sub-LVs is part of the LV whose name was specified by the user - not just if there was a name match.
This commit is contained in:
parent
d34ab5e0d3
commit
caa77b33f2
@ -1,5 +1,6 @@
|
||||
Version 2.02.101 -
|
||||
===================================
|
||||
Fix inability to specify LV name when pvmove'ing a RAID, mirror, or thin-LV.
|
||||
Inform lvmetad about any lost PV label to make it in sync with system state.
|
||||
Support most of lvchange operations on stacked thin pool meta/data LVs.
|
||||
Add ability to pvmove RAID, mirror, and thin volumes.
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "tools.h"
|
||||
#include "polldaemon.h"
|
||||
#include "display.h"
|
||||
#include "metadata.h" /* for 'get_only_segment_using_this_lv' */
|
||||
|
||||
#define PVMOVE_FIRST_TIME 0x00000001 /* Called for first time */
|
||||
#define PVMOVE_EXCLUSIVE 0x00000002 /* Require exclusive LV */
|
||||
@ -209,6 +210,29 @@ static int _insert_pvmove_mirrors(struct cmd_context *cmd,
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Is 'lv' a sub_lv of the LV by the name of 'lv_name'?
|
||||
*
|
||||
* Returns: 1 if true, 0 otherwise
|
||||
*/
|
||||
static int sub_lv_of(struct logical_volume *lv, const char *lv_name)
|
||||
{
|
||||
struct lv_segment *seg;
|
||||
|
||||
/* Sub-LVs only ever have one segment using them */
|
||||
if (dm_list_size(&lv->segs_using_this_lv) != 1)
|
||||
return 0;
|
||||
|
||||
if (!(seg = get_only_segment_using_this_lv(lv)))
|
||||
return_0;
|
||||
|
||||
if (!strcmp(seg->lv->name, lv_name))
|
||||
return 1;
|
||||
|
||||
/* Continue up the tree */
|
||||
return sub_lv_of(seg->lv, lv_name);
|
||||
}
|
||||
|
||||
/* Create new LV with mirror segments for the required copies */
|
||||
static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
|
||||
struct volume_group *vg,
|
||||
@ -295,7 +319,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,
|
||||
if (lv == lv_mirr)
|
||||
continue;
|
||||
if (lv_name) {
|
||||
if (strcmp(lv->name, lv_name))
|
||||
if (strcmp(lv->name, lv_name) && !sub_lv_of(lv, lv_name))
|
||||
continue;
|
||||
lv_found = 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user