mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvchange --refresh
This commit is contained in:
parent
f22969328b
commit
71b9fadf65
@ -29,6 +29,7 @@ arg(removemissing_ARG, '\0', "removemissing", NULL)
|
||||
arg(abort_ARG, '\0', "abort", NULL)
|
||||
arg(addtag_ARG, '\0', "addtag", tag_arg)
|
||||
arg(deltag_ARG, '\0', "deltag", tag_arg)
|
||||
arg(refresh_ARG, '\0', "refresh", NULL)
|
||||
arg(mknodes_ARG, '\0', "mknodes", NULL)
|
||||
arg(minor_ARG, '\0', "minor", minor_arg)
|
||||
|
||||
|
@ -67,6 +67,7 @@ xx(lvchange,
|
||||
"\t[-P|--partial] " "\n"
|
||||
"\t[-p|--permission r|rw]\n"
|
||||
"\t[-r|--readahead ReadAheadSectors]\n"
|
||||
"\t[--refresh]\n"
|
||||
"\t[-t|--test]\n"
|
||||
"\t[-v|--verbose]\n"
|
||||
"\t[--version]" "\n"
|
||||
@ -74,7 +75,7 @@ xx(lvchange,
|
||||
|
||||
autobackup_ARG, available_ARG, contiguous_ARG, force_ARG,
|
||||
ignorelockingfailure_ARG, major_ARG, minor_ARG, partial_ARG, permission_ARG,
|
||||
persistent_ARG, readahead_ARG, addtag_ARG, deltag_ARG,
|
||||
persistent_ARG, readahead_ARG, refresh_ARG, addtag_ARG, deltag_ARG,
|
||||
test_ARG)
|
||||
|
||||
xx(lvcreate,
|
||||
|
@ -105,6 +105,16 @@ static int lvchange_availability(struct cmd_context *cmd,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lvchange_refresh(struct cmd_context *cmd, struct logical_volume *lv)
|
||||
{
|
||||
log_verbose("Refreshing logical volume \"%s\" (if active)", lv->name);
|
||||
if (!lock_vol(cmd, lv->lvid.s, LCK_LV_SUSPEND | LCK_LV_HOLD) ||
|
||||
!unlock_vol(cmd, lv->lvid.s))
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int lvchange_contiguous(struct cmd_context *cmd,
|
||||
struct logical_volume *lv)
|
||||
{
|
||||
@ -428,6 +438,10 @@ static int lvchange_single(struct cmd_context *cmd, struct logical_volume *lv,
|
||||
if (!lvchange_availability(cmd, lv))
|
||||
return ECMD_FAILED;
|
||||
|
||||
if (arg_count(cmd, refresh_ARG))
|
||||
if (!lvchange_refresh(cmd, lv))
|
||||
return ECMD_FAILED;
|
||||
|
||||
return ECMD_PROCESSED;
|
||||
}
|
||||
|
||||
@ -437,16 +451,17 @@ int lvchange(struct cmd_context *cmd, int argc, char **argv)
|
||||
&& !arg_count(cmd, permission_ARG) && !arg_count(cmd, readahead_ARG)
|
||||
&& !arg_count(cmd, minor_ARG) && !arg_count(cmd, major_ARG)
|
||||
&& !arg_count(cmd, persistent_ARG) && !arg_count(cmd, addtag_ARG)
|
||||
&& !arg_count(cmd, deltag_ARG)) {
|
||||
&& !arg_count(cmd, deltag_ARG) && !arg_count(cmd, refresh_ARG)) {
|
||||
log_error("One or more of -a, -C, -j, -m, -M, -p, -r, "
|
||||
"--addtag or --deltag required");
|
||||
"--refresh, --addtag or --deltag required");
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
||||
if (arg_count(cmd, ignorelockingfailure_ARG) &&
|
||||
(arg_count(cmd, contiguous_ARG) || arg_count(cmd, permission_ARG) ||
|
||||
arg_count(cmd, readahead_ARG) || arg_count(cmd, persistent_ARG) ||
|
||||
arg_count(cmd, addtag_ARG) || arg_count(cmd, deltag_ARG))) {
|
||||
arg_count(cmd, addtag_ARG) || arg_count(cmd, deltag_ARG) ||
|
||||
arg_count(cmd, refresh_ARG))) {
|
||||
log_error("Only -a permitted with --ignorelockingfailure");
|
||||
return EINVALID_CMD_LINE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user