/[smecontribs]/rpms/smeserver-arkeia/contribs7/smeserver-arkeia-1.0-rotateupdate.patch
ViewVC logotype

Contents of /rpms/smeserver-arkeia/contribs7/smeserver-arkeia-1.0-rotateupdate.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (show annotations) (download)
Tue Nov 25 16:47:03 2008 UTC (15 years, 11 months ago) by slords
Branch: MAIN
CVS Tags: smeserver-arkeia-1_0-18_el4_sme
* Tue Nov 25 2008 Shad L. Lords <slords@mail.com> 1.0-18
- Add ability to do remote tape rotations
- Add ability to offset where tapes are in library
- Add ability to pick drive other then first one

1 --- smeserver-arkeia-1.0/root/etc/e-smith/events/actions/rotate-tape.rotateupdate 2008-11-25 09:46:02.000000000 -0700
2 +++ smeserver-arkeia-1.0/root/etc/e-smith/events/actions/rotate-tape 2008-11-25 09:45:32.000000000 -0700
3 @@ -16,10 +16,19 @@
4 my $confdb = esmith::ConfigDB->open;
5 my $arkeia = $confdb->get('arkeia') or die "No arkeia db entry found\n";
6 my $rotate = $arkeia->prop('Rotate') || 'no';
7 +my $drivenum = $arkeia->prop('DriveNum') || 0;
8 +my $offset = $arkeia->prop('Offset') || 0;
9 my $changer = $arkeia->prop('Changer') || '/dev/changer';
10 +my $host = $arkeia->prop('Host') || 'localhost';
11
12 -exit 0 unless $rotate eq 'yes';
13 -exit 0 unless -c $changer;
14 +my $mtxcmd = "mtx -f $changer";
15 +if ($rotate eq 'remote') {
16 + $mtxcmd = "ssh $host $mtxcmd";
17 +} elsif ($rotate ne 'yes') {
18 + exit 0 unless -c $changer;
19 +} else {
20 + exit 0
21 +}
22
23 my $daily = $arkeia->prop("Daily") || 0;
24 my $weekly = $arkeia->prop("Weekly") || 0;
25 @@ -52,6 +61,11 @@
26 }
27 }
28 exit 0 unless $slot;
29 +$slot += $offset;
30
31 -system("/usr/sbin/mtx -f $changer unload &> /dev/null");
32 -system("/usr/sbin/mtx -f $changer load $slot") && die("A problem occurred execing mtx\n");
33 +my @status = qx($mtxcmd status);
34 +my $loaded = (grep { /Data Transfer Element $drivenum:Full/ } @status)[0];
35 +if ( $loaded && $loaded =~ m{ Element (\d+):Full .* Element (\d+) } ) {
36 + exit 0 if $2 == $slot;
37 + system("$mtxcmd unload $2 $1");
38 +}

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed