Imported Upstream version 3.3.2
[debian/amanda] / server-src / amcheck-device.pl
index 3a72bbe0053a0296889163fc22edb45fc589dc91..87331a6fa27a01d07a8f56243addd74e9fc6c232 100644 (file)
@@ -1,5 +1,5 @@
 #! @PERL@
-# Copyright (c) 2009, 2010 Zmanda Inc.  All Rights Reserved.
+# Copyright (c) 2009-2012 Zmanda Inc.  All Rights Reserved.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License version 2 as published
@@ -119,7 +119,12 @@ sub _user_msg_fn {
                 } elsif ($dev->status & $DEVICE_STATUS_VOLUME_UNLABELED and
                          $dev->volume_header and
                          $dev->volume_header->{'type'} == $Amanda::Header::F_WEIRD) {
-                    print STDERR " contains a non-Amanda volume; check and relabel it with 'amlabel -f'\n";
+                   my $autolabel = getconf($CNF_AUTOLABEL);
+                   if ($autolabel->{'non_amanda'}) {
+                       print STDERR " contains a non-Amanda volume\n";
+                   } else {
+                       print STDERR " contains a non-Amanda volume; check and relabel it with 'amlabel -f'\n";
+                   }
                 } elsif ($dev->status & $DEVICE_STATUS_VOLUME_ERROR) {
                     my $message = $dev->error_or_status();
                     print STDERR " Can't read label: $message\n";
@@ -184,7 +189,12 @@ sub do_check {
        if (defined $res->{'device'} and defined $res->{'device'}->volume_label()) {
            print "Will $modestr to volume '$label' in slot $slot.\n";
        } else {
-           print "Will $modestr label '$label' to new volume in slot $slot.\n";
+           my $header = $res->{'device'}->volume_header();
+           if ($header->{'type'} == $Amanda::Header::F_WEIRD) {
+               print "Will $modestr label '$label' to non-Amanda volume in slot $slot.\n";
+           } else {
+               print "Will $modestr label '$label' to new volume in slot $slot.\n";
+           }
        }
 
        $steps->{'check_access_type'}->();