[Stgt-devel] [PATCH] improved delete option for removing targets in tgt-admin

FUJITA Tomonori fujita.tomonori
Thu Jul 31 05:00:39 CEST 2008


On Wed, 30 Jul 2008 13:18:27 +0200
Tomasz Chmielewski <mangoo at wpkg.org> wrote:

> This patch adds a better --delete option which is used for removing targets.
> 
> It works similarly to --offline and --ready options:
> 
>       --delete <value>          delete all or selected targets
>                                 The target will be deleted only if it's not used
>                                 (no initiator is connected to it).
>                                 If you want to delete targets which are in use,
>                                 you have to add "--force" flag
> 
> Example usage:
>       --delete help           - display this help
>       --delete ALL            - delete all targets
>       --delete tid=4          - delete target 4 (target with tid 4)
>       --delete iqn.2008-08.com.example:some.target - delete this target
> 
> 
> Basically, it will remove a target if it's not in use; if you still want to remove the target even though it's in use, you have to add --force.
> 
> Because of this, I rename the previous --force into --ignore-errors (previously, --force was used to continue execution even if tgtadm exited with non-zero code).
> 
> Also, "-d" (previously, a short for --delete) is gone and is not an option anymore. This is because --delete is potentially a dangerous operation so some extra typing could be justified here. Moreover, lots of programs use "-d" to enable debugging, so we don't want to use it.
> 
> Currently, --delete is very quiet; if you want some output, please add a -v/--verbose option.
> 
> 
> If you want to use --force option with --delete, you have to use tgt snapshot from today (30-Jul-2008), or apply 3b4b9bb9d3255e0c84812d263f56cc7e9cc98cd6 ("use decimal notation for the id of I_T nexus in the show option").

Looks good changes, as I said before. Applied, thanks a lot.

BTW, cid is not always zero. So you need more tricks about it.



More information about the stgt mailing list