1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

vg/lvremove: support --yes

Make --yes equivalent to DONT_PROMT (--force).

So user could use 'lvremove --yes vg/lvol1' skipping prompt.
This commit is contained in:
Zdenek Kabelac 2014-10-04 17:05:29 +02:00
parent fbf14b12d8
commit 79ca382b2c
3 changed files with 19 additions and 5 deletions

View File

@ -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.

View File

@ -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;

View File

@ -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)))