+ if (defined $slot and !exists $state->{'slots'}->{$slot}) {
+ return $self->make_error("failed", $params{'res_cb'},
+ reason => "invalid",
+ message => "invalid slot '$slot'");
+ }
+
+ if (!defined $slot) {
+ my $all_empty = 1;
+ if (exists $params{'except_slots'}) {
+ for my $xslot (keys %{ $params{'except_slots'} }) {
+ if ($state->{'slots'}->{$xslot}->{'state'} ne Amanda::Changer::SLOT_EMPTY) {
+ $all_empty = 0;
+ }
+ }
+ if ($all_empty) {
+ return $self->make_error("failed", $params{'res_cb'},
+ reason => "notfound",
+ message => "all slots are empty");
+ }
+ }
+ return $self->make_error("failed", $params{'res_cb'},
+ reason => "notfound",
+ message => "all slots have been loaded");
+ }