Try this patch, chg-robot retry the mtx command if it failed with 'No Sense'.

Jean-Louis

On 01/06/2014 01:04 PM, Steven Backus wrote:
The complete output of mtx is not logged, run it on the command line to
get the complete output:
     /usr/sbin/mtx -f /dev/changer nobarcode status
   Storage Changer /dev/sg6:1 Drives, 7 Slots ( 0 Import/Export )
Data Transfer Element 0:Full (Storage Element 1 Loaded)
       Storage Element 1:Empty
       Storage Element 2:Full
       Storage Element 3:Full
       Storage Element 4:Full
       Storage Element 5:Full
       Storage Element 6:Full
       Storage Element 7:Full


'it always works the 2nd time', Did it always works the 3rd and 4th
time?
Yes, after the first fail, it always works.  Then several days
later I try switching tapes and it fails again the first time and
always works again after that.

When is the first time?
The "first time" is Monday morning after I've done a dump to the
holding disk.  I do 6 amdumps during the week:

M degraded
T flush to tape
W degraded
Th degraded
F flush to tape
S degraded

Steve

diff --git a/perl/Amanda/Changer/robot.pm b/perl/Amanda/Changer/robot.pm
index 9dbf8e1..0cafec0 100644
--- a/perl/Amanda/Changer/robot.pm
+++ b/perl/Amanda/Changer/robot.pm
@@ -2266,12 +2266,15 @@ sub status {
 	    my ($exitstatus, $output) = @_;
 	    if ($exitstatus != 0) {
 		my $err = $output;
+		for my $line (split '\n', $output) {
+		    debug("mtx: $line");
+		}
 		# if it's a regular SCSI error, just show the sense key
 		my ($sensekey) = ($err =~ /mtx: Request Sense: Sense Key=(.*)\n/);
 		$err = "SCSI error; Sense Key=$sensekey" if $sensekey;
 		$counter--;
-		if ($sensekey eq "Not Ready" and $counter > 0) {
-		    debug("$output");
+		if (($sensekey eq "Not Ready" and $counter > 0) ||
+		    ($sensekey eq "No Sense" and $counter > 0)) {
 		    return Amanda::MainLoop::call_after(1000, $run_mtx);
 		}
 		return $status_cb->("error from mtx: " . $err, {});

Reply via email to