diff --git a/WHATS_NEW b/WHATS_NEW index d2b530374..3855bb1fa 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.112 - ===================================== + Support --yes like --force in vg/lvremove to skip y|n prompt. Support --yes with lvconvert --splitsnapshot. Fix detection of unsupported thin external lvconversions. Fix detection of unsupported cache and thin pool lvconversions. diff --git a/tools/lvremove.c b/tools/lvremove.c index dfc435cf9..7d2fec149 100644 --- a/tools/lvremove.c +++ b/tools/lvremove.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2007 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -18,7 +18,15 @@ static int lvremove_single(struct cmd_context *cmd, struct logical_volume *lv, void *handle __attribute__((unused))) { - if (!lv_remove_with_dependencies(cmd, lv, (force_t) arg_count(cmd, force_ARG), 0)) + /* + * Single force is equivalent to sinle --yes + * Even multiple --yes are equivalent to single --force + * When we require -ff it cannot be replaces with -f -y + */ + force_t force = (force_t) arg_count(cmd, force_ARG) + ? : (arg_is_set(cmd, yes_ARG) ? DONT_PROMPT : PROMPT); + + if (!lv_remove_with_dependencies(cmd, lv, force, 0)) return_ECMD_FAILED; return ECMD_PROCESSED; diff --git a/tools/vgremove.c b/tools/vgremove.c index 52bdd2bc7..0bbca768d 100644 --- a/tools/vgremove.c +++ b/tools/vgremove.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. - * Copyright (C) 2004-2009 Red Hat, Inc. All rights reserved. + * Copyright (C) 2004-2014 Red Hat, Inc. All rights reserved. * * This file is part of LVM2. * @@ -19,15 +19,20 @@ static int vgremove_single(struct cmd_context *cmd, const char *vg_name, struct volume_group *vg, void *handle __attribute__((unused))) { + /* + * Single force is equivalent to sinle --yes + * Even multiple --yes are equivalent to single --force + * When we require -ff it cannot be replaces with -f -y + */ + force_t force = (force_t) arg_count(cmd, force_ARG) + ? : (arg_is_set(cmd, yes_ARG) ? DONT_PROMPT : PROMPT); unsigned lv_count, missing; - force_t force; if (!vg_check_status(vg, EXPORTED_VG)) return_ECMD_FAILED; lv_count = vg_visible_lvs(vg); - force = (force_t) arg_count(cmd, force_ARG); if (lv_count) { if (force == PROMPT) { if ((missing = vg_missing_pv_count(vg)))