mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-17 18:51:27 +00:00
- Adds rename_group functionality with renameGroup().
git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@1100 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -52,7 +52,7 @@ $IOTYPE_PHYSICAL = 100;
|
||||
$IOTYPE_VIRTUAL = 101;
|
||||
$IOTYPE_PERFORMANCE = 102;
|
||||
|
||||
$VERSION = 0.8.0;
|
||||
$VERSION = 0.8.1;
|
||||
|
||||
my $_SCST_MIN_MAJOR_ = 1;
|
||||
my $_SCST_MIN_MINOR_ = 0;
|
||||
@@ -247,6 +247,39 @@ sub removeGroup {
|
||||
return $self->groupExists($group);
|
||||
}
|
||||
|
||||
sub renameGroup {
|
||||
my $self = shift;
|
||||
my $oldName = shift;
|
||||
my $newName = shift;
|
||||
|
||||
if ($self->groupExists($oldName)) {
|
||||
$self->{'error'} = "renameGroup(): Group '$oldName' doesn't exist";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 2 if ($self->groupExists($newName));
|
||||
|
||||
my $io = new IO::File $_SCST_IO_, O_WRONLY;
|
||||
|
||||
if (!$io) {
|
||||
$self->{'error'} = "renameGroup(): Failed to open handler IO '$_SCST_IO_'";
|
||||
return 1;
|
||||
}
|
||||
|
||||
my $cmd = "rename_group $oldName $newName\n";
|
||||
|
||||
if ($self->{'debug'}) {
|
||||
print "DBG($$): $_SCST_IO_ -> $cmd\n";
|
||||
} else {
|
||||
print $io $cmd;
|
||||
}
|
||||
|
||||
close $io;
|
||||
|
||||
return 0 if ($self->{'debug'});
|
||||
return !$self->groupExists($newName);
|
||||
}
|
||||
|
||||
sub sgvStats {
|
||||
my $self = shift;
|
||||
my $io = new IO::File $_SCST_SGV_STATS_, O_RDONLY;
|
||||
@@ -1195,6 +1228,11 @@ Returns: (int) $success
|
||||
Removes a group from SCST's configuration. Returns 0 upon success, 1 if
|
||||
unsuccessfull and 2 if group does not exist.
|
||||
|
||||
=item SCST::SCST->renameGroup();
|
||||
|
||||
Renames an already existing group. Returns 0 upon success, 1 if unsuccessfull
|
||||
or 2 if the new group name already exists.
|
||||
|
||||
=item SCST::SCST->sgvStats();
|
||||
|
||||
Returns a hash of stats gathered from /proc/scsi_tgt/sgv.
|
||||
|
||||
Reference in New Issue
Block a user