[Stgt-devel] [PATCH 2/7] Add option to delete all the targets

FUJITA Tomonori fujita.tomonori
Fri Jul 25 12:54:11 CEST 2008


On Fri, 25 Jul 2008 12:46:40 +0200
Tomasz Chmielewski <mangoo at wpkg.org> wrote:

> Doron Shoham schrieb:
> > Add -d flag.
> > Delete all the targets and backup the current conf file
> 
> (...)
> 
> > +# Delete all the targets and backup the current conf file
> > +sub delete {
> > +	print "deleting targets...\n";
> > +	print "a copy of the conf file is on:/etc/tgt/targets.conf.bkp\n";
> > +	`mv $configfile /etc/tgt/targets.conf.bkp`;
> > +	open FILE, ">", "$configfile" or die $!;
> > +	print FILE "<target>\n";
> > +	print FILE "</target>\n";
> 
> It essentially removes our config file if we accidentally run this 
> command twice in a row.
> I wouldn't be very happy if I lost configuration of dozens of targets...
> 
> 
> Why are we touching the config file here anyway?
> IMO, "-d" flag should just remove all targets from a running tgtd; it 
> shouldn't try to backup or modify the config file.

Agreed, I prefer to have an explicit option to touch (update) my
ocnfiguration file; other options just change my running targets'
configurations.



More information about the stgt mailing list