1 # Copyright (c) 2009, 2010 Zmanda, Inc. All Rights Reserved.
3 # This program is free software; you can redistribute it and/or modify it
4 # under the terms of the GNU General Public License version 2 as published
5 # by the Free Software Foundation.
7 # This program is distributed in the hope that it will be useful, but
8 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # You should have received a copy of the GNU General Public License along
13 # with this program; if not, write to the Free Software Foundation, Inc.,
14 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 # Contact information: Zmanda Inc., 465 S. Mathilda Ave., Suite 300
17 # Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
19 package Amanda::Changer::null;
24 @ISA = qw( Amanda::Changer );
26 use File::Glob qw( :glob );
28 use Amanda::Config qw( :getconf );
39 This changer always returns reservations for null devices. It is useful to add
40 a null device to a RAIT device configuration. It takes no arguments.
42 Note that this changer's constructor is guaranteed not to return an error.
44 See the amanda-changers(7) manpage for usage information.
50 my ($config, $tpchanger) = @_;
52 return bless ({}, $class);
58 return if $self->check_error($params{'res_cb'});
60 $params{'res_cb'}->(undef, Amanda::Changer::null::Reservation->new()) if $params{'res_cb'};
65 my ($key, %params) = @_;
67 return if $self->check_error($params{'info_cb'});
69 if ($key eq 'num_slots') {
71 } elsif ($key eq 'fast_search') {
75 $params{'info_cb'}->(undef, %results) if $params{'info_cb'};
81 return if $self->check_error($params{'finished_cb'});
83 $params{'finished_cb'}->() if $params{'finished_cb'};
86 package Amanda::Changer::null::Reservation;
88 @ISA = qw( Amanda::Changer::Reservation );
92 my $self = Amanda::Changer::Reservation::new($class);
94 $self->{'device'} = Amanda::Device->new("null:");
95 $self->{'this_slot'} = "null";