mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
lvresize: support passing --yes to fsadm
Since fsadm now needs --yes to pass prompting operations, we need to pass --yes from lvresize to fsadm.
This commit is contained in:
parent
48f06005ab
commit
e3f63693a4
@ -4578,6 +4578,7 @@ enum fsadm_cmd_e { FSADM_CMD_CHECK, FSADM_CMD_RESIZE };
|
||||
static int _fsadm_cmd(enum fsadm_cmd_e fcmd,
|
||||
struct logical_volume *lv,
|
||||
uint32_t extents,
|
||||
int yes,
|
||||
int force,
|
||||
int *status)
|
||||
{
|
||||
@ -4585,7 +4586,7 @@ static int _fsadm_cmd(enum fsadm_cmd_e fcmd,
|
||||
struct cmd_context *cmd = vg->cmd;
|
||||
char lv_path[PATH_MAX];
|
||||
char size_buf[SIZE_BUF];
|
||||
const char *argv[FSADM_CMD_MAX_ARGS + 2];
|
||||
const char *argv[FSADM_CMD_MAX_ARGS + 4];
|
||||
unsigned i = 0;
|
||||
|
||||
argv[i++] = find_config_tree_str(cmd, global_fsadm_executable_CFG, NULL);
|
||||
@ -4596,6 +4597,9 @@ static int _fsadm_cmd(enum fsadm_cmd_e fcmd,
|
||||
if (verbose_level() >= _LOG_NOTICE)
|
||||
argv[i++] = "--verbose";
|
||||
|
||||
if (yes)
|
||||
argv[i++] = "--yes";
|
||||
|
||||
if (force)
|
||||
argv[i++] = "--force";
|
||||
|
||||
@ -5498,7 +5502,7 @@ int lv_resize(struct logical_volume *lv,
|
||||
|
||||
if (lp->resizefs) {
|
||||
if (!lp->nofsck &&
|
||||
!_fsadm_cmd(FSADM_CMD_CHECK, lv, 0, lp->force, &status)) {
|
||||
!_fsadm_cmd(FSADM_CMD_CHECK, lv, 0, lp->yes, lp->force, &status)) {
|
||||
if (status != FSADM_CHECK_FAILS_FOR_MOUNTED) {
|
||||
log_error("Filesystem check failed.");
|
||||
return 0;
|
||||
@ -5508,7 +5512,7 @@ int lv_resize(struct logical_volume *lv,
|
||||
|
||||
/* FIXME forks here */
|
||||
if ((lp->resize == LV_REDUCE) &&
|
||||
!_fsadm_cmd(FSADM_CMD_RESIZE, lv, lp->extents, lp->force, NULL)) {
|
||||
!_fsadm_cmd(FSADM_CMD_RESIZE, lv, lp->extents, lp->yes, lp->force, NULL)) {
|
||||
log_error("Filesystem resize failed.");
|
||||
return 0;
|
||||
}
|
||||
@ -5589,7 +5593,7 @@ out:
|
||||
display_lvname(lv));
|
||||
|
||||
if (lp->resizefs && (lp->resize == LV_EXTEND) &&
|
||||
!_fsadm_cmd(FSADM_CMD_RESIZE, lv, lp->extents, lp->force, NULL))
|
||||
!_fsadm_cmd(FSADM_CMD_RESIZE, lv, lp->extents, lp->yes, lp->force, NULL))
|
||||
return_0;
|
||||
|
||||
ret = 1;
|
||||
|
@ -649,6 +649,7 @@ struct lvresize_params {
|
||||
int use_policies;
|
||||
|
||||
alloc_policy_t alloc;
|
||||
int yes;
|
||||
int force;
|
||||
int nosync;
|
||||
int nofsck;
|
||||
|
@ -147,6 +147,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,
|
||||
lp->argv = ++argv;
|
||||
|
||||
lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, 0);
|
||||
lp->yes = arg_is_set(cmd, yes_ARG);
|
||||
lp->force = arg_is_set(cmd, force_ARG);
|
||||
lp->nofsck = arg_is_set(cmd, nofsck_ARG);
|
||||
lp->nosync = arg_is_set(cmd, nosync_ARG);
|
||||
|
Loading…
Reference in New Issue
Block a user