1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

thin: add lvconvert pool metadata spare

Support poolmetadataspare when convering volumes into thin pool.
Same rules applied as with lvcreate.
This commit is contained in:
Zdenek Kabelac 2013-06-25 13:35:12 +02:00
parent 3075784955
commit aab53f46ee
2 changed files with 15 additions and 2 deletions

View File

@ -170,6 +170,7 @@ xx(lvconvert,
"\t[--poolmetadata ThinMetadataLogicalVolume[Path] |\n"
"\t [--poolmetadatasize size]\n"
"\t [-r|--readahead ReadAheadSectors|auto|none]\n"
"\t [--poolmetadataspare {y|n}]\n"
"\t [--stripes Stripes [-I|--stripesize StripeSize]]]\n"
"\t[-T|--thin ExternalLogicalVolume[Path]\n"
"\t [--originname NewExternalOriginVolumeName]]\n"
@ -180,8 +181,9 @@ xx(lvconvert,
merge_ARG, mirrorlog_ARG, mirrors_ARG, name_ARG, noudevsync_ARG,
readahead_ARG, regionsize_ARG, repair_ARG, replace_ARG, snapshot_ARG, splitmirrors_ARG,
trackchanges_ARG, type_ARG, stripes_long_ARG, stripesize_ARG, test_ARG,
chunksize_ARG, discards_ARG, poolmetadata_ARG, poolmetadatasize_ARG,
originname_ARG, thin_ARG, thinpool_ARG,
chunksize_ARG, discards_ARG, originname_ARG,
poolmetadata_ARG, poolmetadatasize_ARG, poolmetadataspare_ARG,
thin_ARG, thinpool_ARG,
use_policies_ARG, force_ARG, zero_ARG)
xx(lvcreate,

View File

@ -21,6 +21,7 @@ struct lvconvert_params {
int snapshot;
int merge;
int merge_mirror;
int poolmetadataspare;
int thin;
int yes;
int zero;
@ -253,6 +254,9 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
} else if (arg_count(cmd, discards_ARG)) {
log_error("--discards is only valid with --thinpool.");
return 0;
} else if (arg_count(cmd, poolmetadataspare_ARG)) {
log_error("--poolmetadataspare is only valid with --thinpool.");
return 0;
}
/*
@ -486,6 +490,9 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd,
return_0;
}
/* TODO: default in lvm.conf ? */
lp->poolmetadataspare = arg_int_value(cmd, poolmetadataspare_ARG,
DEFAULT_POOL_METADATA_SPARE);
lp->force = arg_count(cmd, force_ARG);
lp->yes = arg_count(cmd, yes_ARG);
@ -2158,6 +2165,10 @@ static int _lvconvert_thinpool(struct cmd_context *cmd,
return 0;
}
if (!handle_pool_metadata_spare(pool_lv->vg, metadata_lv->le_count,
lp->pvh, lp->poolmetadataspare))
return_0;
old_name = data_lv->name; /* Use for pool name */
/*
* Since we wish to have underlaying devs to match _tdata