NBU

 view release on metacpan or  search on metacpan

bin/js.pl  view on Meta::CPAN

	  $MBytes += $job->dataWritten / 1024;
	}
      }
    }
    elsif ($state eq "A") {
      my $op = $job->operation;
      if ($opts{'x'}) {
	print " operation=\"$op\" elapsed=\"".dispInterval($job->elapsedTime)."\"";
      }
      else {
        print " $op ".dispInterval($job->busy);
      }
    }

    if ($state ne "Q") {
      if (defined($job->filesWritten)) {
	if ($opts{'x'}) {
	  print " files=\"".$job->filesWritten."\"";
	}
	else {
          printf(" %7d", $job->filesWritten);

bin/robot-status.pl  view on Meta::CPAN

  next unless (defined($robot));
  print "Robot ".$robot->id;
  print " controlled from ".$robot->host->name if (defined($robot->host));
  print "\n";
  for my $drive (sort {$a->robotDriveIndex <=> $b->robotDriveIndex} $robot->drives) {
    print "  ".($drive->down ? "v" : "^");
    printf(" %2u", $drive->robotDriveIndex);
    printf(" %-8s", $drive->name);
    printf(" (%2u)", $drive->id) if ($opts{'v'});
    if ($opts{'t'}) {
      if ($drive->busy) {
	print " (".$drive->mount->volume->id.")";
      }
      else {
	print " (      )";
      }
    }
    print " SN:".$drive->serialNumber if ($opts{'s'});
    print " Cleaned: ".substr(localtime($drive->lastCleaned), 4) if ($opts{'c'});
    print ": ".$drive->comment if ($opts{'v'});

lib/NBU/Drive.pm  view on Meta::CPAN

      $driveNamePool{$drive->{NAME} = $name} = $drive;
      $drive->{LASTCLEANED} = $lastCleaned;
      $drive->{COMMENT} = $comment;

      $drive->{CONTROL} = $control;
      $drive->{STATUS} = ($control !~ /DOWN/) ? "UP" : "DOWN";

      $drive->{INUSE} = ($state & 0x000f);

      #
      # If the drive is busy, and the media has no recorded ID yet, but it
      # does have an external ID, then this media is being used for the first
      # time and it will have its external ID recorded henceforth.  So here we
      # simply jump the gun a little...
      if ($drive->busy && ($rvsn eq "-") && ($evsn ne "-")) {
        $rvsn = $evsn;
      }
      if ($rvsn ne "-") {
	# Unfortunately there is no way to find out which job is using this drive :-(
	if (defined(my $volume = NBU::Media->new($rvsn))) {
	  my $mount = NBU::Mount->new(undef, $volume, $drive, time);
          $drive->use($mount, time);
	}
else {die("Cannot located media $rvsn?\n");}
      }

lib/NBU/Drive.pm  view on Meta::CPAN


    my $drive = NBU::Drive->byIndex($id, $server);

    $drive->comment($comment);
    $drive->{LASTCLEANED} = $lastCleaned;

    $drive->{INUSE} = ($state & 0x000f);

    $drive->status($control);

    if ($drive->busy) {
      my $mount = $drive->mount;
      if (($rvsn eq "-") && ($evsn ne "-")) {
        $rvsn = $evsn;
      }

      if ($rvsn eq "-") {
        $drive->free(time);
      }
      elsif ($mount->volume->rvsn ne $rvsn) {
        $drive->free(time);
	$mount = NBU::Mount->new(undef, NBU::Media->new($rvsn), $drive, time);
	$drive->use($mount, time);
      }
    }
    elsif (!$drive->busy && ($rvsn ne "-")) {
      my $mount = NBU::Mount->new(undef, NBU::Media->new($rvsn), $drive, time);
      $drive->use($mount, time);
    }
  }
  close($pipe);
}

sub pool {
  my $proto = shift;

lib/NBU/Drive.pm  view on Meta::CPAN

  if (@_) {
    if ($self->{STATUS} ne "DOWN") {
      system($NBU::prefix."volmgr/bin/vmoprcmd -down ".$self->id." -h ".$self->host->name."\n");
      $self->updateStatus($self->host);
    }
  }

  return $self->{STATUS} eq "DOWN";
}

sub busy {
  my $self = shift;

  return $self->{INUSE};
}

sub index {
  my $self = shift;

  return $self->id(@_);
}

lib/NBU/Drive.pm  view on Meta::CPAN

  $mount->usedBy(\%use);

  $self->{INUSE} = $use{'START'} = $tm;
  push @$uses, \%use;
  return $self;
}

sub mount {
  my $self = shift;

  if ($self->busy) {
    my $uses = $self->usage;
    my $use = $$uses[@$uses - 1];
    return $$use{'MOUNT'};
  }

  return undef;
}

sub free {
  my $self = shift;

lib/NBU/Drive.pm  view on Meta::CPAN

sub usage {
  my $self = shift;

  if (!$self->{USES}) {
    $self->{USES} = [];
  }

  return $self->{USES};
}

sub busyStats {
  my $self = shift;
  my $asOf = shift;
  my $endOfPeriod = shift;

  my $stepSize = 5 * 60;
  $stepSize = shift if (@_);

  my $usage = $self->usage;

  my $step = $asOf;

lib/NBU/Job.pm  view on Meta::CPAN


  return (($self->{STATE} == 3) || ($self->{STATE} == 5));
}

sub queued {
  my $self = shift;

  return (($self->{STATE} == 0) || ($self->{STATE} == 2));
}

sub busy {
  my $self = shift;

  if (!$self->{STARTOP}) {
#print STDERR "Job ".$self->id." has no start op?\n";
    return undef;
  }
  else  {
    return $asOf - $self->{STARTOP};
  }
}

lib/NBU/Path.pm  view on Meta::CPAN


  return $self->{FP};
}

sub host {
  my $self = shift;

  return $self->{HOST};
}

sub busy {
  my $self = shift;

  return $self->{INUSE};
}

sub use {
  my $self = shift;
  my ($mount, $tm) = @_;

  my $uses = $self->usage;

lib/NBU/Path.pm  view on Meta::CPAN

  $use{'START'} = $tm;
  push @$uses, \%use;
  return $self;
}

sub mount {
  my $self = shift;

#
# This should really return a list of *ALL* active mounts!
  if ($self->busy) {
    my $uses = $self->usage;
    my $use = $$uses[@$uses - 1];
    return $$use{'MOUNT'};
  }

  return undef;
}

sub free {
  my $self = shift;

lib/NBU/Path.pm  view on Meta::CPAN

sub usage {
  my $self = shift;

  if (!$self->{USES}) {
    $self->{USES} = [];
  }

  return $self->{USES};
}

sub busyStats {
  my $self = shift;
  my $asOf = shift;
  my $endOfPeriod = shift;

  my $stepSize = 5 * 60;
  $stepSize = shift if (@_);

  my $usage = $self->usage;

  my $step = $asOf;



( run in 0.388 second using v1.01-cache-2.11-cpan-87723dcf8b7 )