1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-17 06:04:23 +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:
Zdenek Kabelac 2017-06-21 14:02:57 +02:00
parent 48f06005ab
commit e3f63693a4
3 changed files with 10 additions and 4 deletions

View File

@ -4578,6 +4578,7 @@ enum fsadm_cmd_e { FSADM_CMD_CHECK, FSADM_CMD_RESIZE };
static int _fsadm_cmd(enum fsadm_cmd_e fcmd, static int _fsadm_cmd(enum fsadm_cmd_e fcmd,
struct logical_volume *lv, struct logical_volume *lv,
uint32_t extents, uint32_t extents,
int yes,
int force, int force,
int *status) int *status)
{ {
@ -4585,7 +4586,7 @@ static int _fsadm_cmd(enum fsadm_cmd_e fcmd,
struct cmd_context *cmd = vg->cmd; struct cmd_context *cmd = vg->cmd;
char lv_path[PATH_MAX]; char lv_path[PATH_MAX];
char size_buf[SIZE_BUF]; char size_buf[SIZE_BUF];
const char *argv[FSADM_CMD_MAX_ARGS + 2]; const char *argv[FSADM_CMD_MAX_ARGS + 4];
unsigned i = 0; unsigned i = 0;
argv[i++] = find_config_tree_str(cmd, global_fsadm_executable_CFG, NULL); 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) if (verbose_level() >= _LOG_NOTICE)
argv[i++] = "--verbose"; argv[i++] = "--verbose";
if (yes)
argv[i++] = "--yes";
if (force) if (force)
argv[i++] = "--force"; argv[i++] = "--force";
@ -5498,7 +5502,7 @@ int lv_resize(struct logical_volume *lv,
if (lp->resizefs) { if (lp->resizefs) {
if (!lp->nofsck && 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) { if (status != FSADM_CHECK_FAILS_FOR_MOUNTED) {
log_error("Filesystem check failed."); log_error("Filesystem check failed.");
return 0; return 0;
@ -5508,7 +5512,7 @@ int lv_resize(struct logical_volume *lv,
/* FIXME forks here */ /* FIXME forks here */
if ((lp->resize == LV_REDUCE) && 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."); log_error("Filesystem resize failed.");
return 0; return 0;
} }
@ -5589,7 +5593,7 @@ out:
display_lvname(lv)); display_lvname(lv));
if (lp->resizefs && (lp->resize == LV_EXTEND) && 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; return_0;
ret = 1; ret = 1;

View File

@ -649,6 +649,7 @@ struct lvresize_params {
int use_policies; int use_policies;
alloc_policy_t alloc; alloc_policy_t alloc;
int yes;
int force; int force;
int nosync; int nosync;
int nofsck; int nofsck;

View File

@ -147,6 +147,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,
lp->argv = ++argv; lp->argv = ++argv;
lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, 0); 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->force = arg_is_set(cmd, force_ARG);
lp->nofsck = arg_is_set(cmd, nofsck_ARG); lp->nofsck = arg_is_set(cmd, nofsck_ARG);
lp->nosync = arg_is_set(cmd, nosync_ARG); lp->nosync = arg_is_set(cmd, nosync_ARG);