1 # Copyright (c) 2009-2012 Zmanda, Inc. All Rights Reserved.
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc.,
15 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
18 # Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
20 package Amanda::Changer::null;
25 @ISA = qw( Amanda::Changer );
27 use File::Glob qw( :glob );
29 use Amanda::Config qw( :getconf );
40 This changer always returns reservations for null devices. It is useful to add
41 a null device to a RAIT device configuration. It takes no arguments.
43 Note that this changer's constructor is guaranteed not to return an error.
45 See the amanda-changers(7) manpage for usage information.
51 my ($config, $tpchanger) = @_;
53 return bless ({}, $class);
59 return if $self->check_error($params{'res_cb'});
61 $params{'res_cb'}->(undef, Amanda::Changer::null::Reservation->new()) if $params{'res_cb'};
66 my ($key, %params) = @_;
68 return if $self->check_error($params{'info_cb'});
70 if ($key eq 'num_slots') {
72 } elsif ($key eq 'fast_search') {
76 $params{'info_cb'}->(undef, %results) if $params{'info_cb'};
82 return if $self->check_error($params{'finished_cb'});
84 $params{'finished_cb'}->() if $params{'finished_cb'};
87 package Amanda::Changer::null::Reservation;
89 @ISA = qw( Amanda::Changer::Reservation );
93 my $self = Amanda::Changer::Reservation::new($class);
95 $self->{'device'} = Amanda::Device->new("null:");
96 $self->{'this_slot'} = "null";