diff --git a/iscsi-server/iscsi-server-lib.pl b/iscsi-server/iscsi-server-lib.pl index c3b665811..c1e70a2b7 100644 --- a/iscsi-server/iscsi-server-lib.pl +++ b/iscsi-server/iscsi-server-lib.pl @@ -265,5 +265,43 @@ else { } } +# find_extent_users(&config, &extent|&device) +# Returns a list of all targets or devices using some extent or device +sub find_extent_users +{ +my ($conf, $obj) = @_; +my $name = $obj->{'type'}.$obj->{'num'}; +my @rv; +foreach my $c (@$conf) { + if ($c->{'type'} eq 'target' && $c->{'export'} eq $name) { + push(@rv, $c); + } + elsif ($c->{'type'} eq 'device' && + &indexof($name, @{$c->{'extents'}}) >= 0) { + push(@rv, $c); + } + } +return @rv; +} + +# describe_object(&object) +# Returns a human-readable description of some extent, device or target +sub describe_object +{ +my ($obj) = @_; +if ($obj->{'type'} eq 'extent') { + return &text('desc_extent', &mount::device_name($obj->{'device'})); + } +elsif ($obj->{'type'} eq 'device') { + return &text('desc_device', "$obj->{'type'}$obj->{'num'}"); + } +elsif ($obj->{'type'} eq 'target') { + return &text('desc_target', $obj->{'network'}); + } +else { + return "Unknown $obj->{'type'} object"; + } +} + 1; diff --git a/iscsi-server/lang/en b/iscsi-server/lang/en index d051cc282..923e7d7fb 100644 --- a/iscsi-server/lang/en +++ b/iscsi-server/lang/en @@ -42,10 +42,12 @@ extent_other=Other file or device extents_rusure=Are you sure you want to delete the shared device $1? Its contents will be preserved, but it will no longer be accessible to iSCSI clients. extent_sure=Delete Device extent_err=Failed to save device to share +extent_derr=Failed to delete device to share extent_eother=File to share does not exist extent_estart=Start of extent must be a number extent_esize=Size of extent must be a number extent_esizemax=End of extent cannot be larger than the device size of $1 +extent_einuse=This device cannot be deleted, as it is in use by : $1 devices_title=Devices Combinations devices_none=No device combinations have been created yet. @@ -68,3 +70,6 @@ targets_network=Share with network targets_add=Add a new sharing target. targets_delete=Delete Selected Targets +desc_extent=Device to share $1 +desc_device=Device combination $1 +desc_target=Sharing target $1