|
1 |
| -#!/usr/bin/perl |
2 |
| - |
3 |
| -require './zfsmanager-lib.pl'; |
4 |
| -ReadParse(); |
5 |
| -use Data::Dumper; |
6 |
| - |
7 |
| -ui_print_header(undef, $text{'vdev_title'}, "", undef, 1, 1); |
8 |
| - |
9 |
| -my %status = zpool_status($in{'pool'}); |
10 |
| - |
11 |
| -print ui_columns_start([ "Virtual Device", "State", "Read", "Write", "Cksum" ]); |
12 |
| -print ui_columns_row([$status{$in{'dev'}}{name}, $status{$in{'dev'}}{state}, $status{$in{'dev'}}{read}, $status{$in{'dev'}}{write}, $status{$in{'dev'}}{cksum}]); |
13 |
| -print ui_columns_end(); |
14 |
| - |
15 |
| -$parent = $status{$in{'dev'}}{parent}; |
16 |
| -if ($status{$in{'dev'}}{parent} =~ 'pool') |
17 |
| -{ |
18 |
| -} else { |
19 |
| - print ui_columns_start([ "Parent", "State", "Read", "Write", "Cksum" ]); |
20 |
| - print ui_columns_row(["<a href='config-vdev.cgi?pool=$in{'pool'}&dev=$status{$in{'dev'}}{parent}'>$status{$parent}{name}</a>", $status{$parent}{state}, $status{$parent}{read}, $status{$parent}{write}, $status{$parent}{cksum}]); |
21 |
| - print ui_columns_end(); |
22 |
| -} |
23 |
| -ui_zpool_list($in{'pool'}); |
24 |
| -if (($status{$in{'dev'}}{name} =~ "cache") || ($status{$in{'dev'}}{name} =~ "logs") || ($status{$in{'dev'}}{name} =~ "spare") || ($status{$in{'dev'}}{name} =~ /mirror/) || ($status{$in{'dev'}}{name} =~ /raidz/)) |
25 |
| -{ |
26 |
| -print "Children: "; |
27 |
| - foreach $key (sort(keys %status)) |
28 |
| - { |
29 |
| - if ($status{$key}{parent} =~ $in{'dev'}) |
30 |
| - { |
31 |
| - print "<a href='config-vdev.cgi?pool=$in{pool}&dev=$key'>".$status{$key}{name}."</a> "; |
32 |
| - } |
33 |
| - } |
34 |
| -} elsif ($config{'pool_properties'} =~ /1/) { |
35 |
| - print ui_table_start("Tasks", "width=100%", "10", ['align=left'] ); |
36 |
| - if ($status{$in{'dev'}}{state} =~ "ONLINE") { |
37 |
| - print ui_table_row("Offline: ", "<a href='cmd.cgi?cmd=vdev&action=offline&pool=$in{'pool'}&vdev=$status{$in{'dev'}}{name}'>Bring device offline</a><br />"); |
38 |
| - } |
39 |
| - else { #elsif ($status{$in{'dev'}}{state} =~ "OFFLINE") { |
40 |
| - print ui_table_row("Online: ", "<a href='cmd.cgi?cmd=vdev&action=online&pool=$in{'pool'}&vdev=$status{$in{'dev'}}{name}'>Bring device online</a><br />"); |
41 |
| - } |
42 |
| - print ui_table_row("Replace: ", "<a href='cmd.cgi?cmd=replace&vdev=$status{$in{'dev'}}{name}&pool=$in{'pool'}'>Replace device</a><br />"); |
43 |
| - print ui_table_row("Remove: ", "<a href='cmd.cgi?cmd=vdev&action=remove&pool=$in{'pool'}&vdev=$status{$in{'dev'}}{name}'>Remove device</a><br />"); |
44 |
| - print ui_table_row("Detach: ", "<a href='cmd.cgi?cmd=vdev&action=detach&pool=$in{'pool'}&vdev=$status{$in{'dev'}}{name}'>Detach device</a><br />"); |
45 |
| - print ui_table_row("Clear: ", "<a href='cmd.cgi?cmd=vdev&action=clear&pool=$in{'pool'}&vdev=$status{$in{'dev'}}{name}'>Clear errors</a><br />"); |
46 |
| - print ui_table_end(); |
47 |
| -} |
48 |
| - |
49 |
| -ui_print_footer("status.cgi?pool=$in{'pool'}", $in{'pool'}); |
| 1 | +#!/usr/bin/perl |
| 2 | + |
| 3 | +require './zfsmanager-lib.pl'; |
| 4 | +ReadParse(); |
| 5 | +use Data::Dumper; |
| 6 | + |
| 7 | +ui_print_header(undef, $text{'vdev_title'}, "", undef, 1, 1); |
| 8 | + |
| 9 | +my %status = zpool_status($in{'pool'}); |
| 10 | + |
| 11 | +print ui_columns_start([ "Virtual Device", "State", "Read", "Write", "Cksum" ]); |
| 12 | +print ui_columns_row([$status{$in{'dev'}}{name}, $status{$in{'dev'}}{state}, $status{$in{'dev'}}{read}, $status{$in{'dev'}}{write}, $status{$in{'dev'}}{cksum}]); |
| 13 | +print ui_columns_end(); |
| 14 | + |
| 15 | +$parent = $status{$in{'dev'}}{parent}; |
| 16 | +if ($status{$in{'dev'}}{parent} =~ 'pool') |
| 17 | +{ |
| 18 | +} else { |
| 19 | + print ui_columns_start([ "Parent", "State", "Read", "Write", "Cksum" ]); |
| 20 | + print ui_columns_row(["<a href='config-vdev.cgi?pool=$in{'pool'}&dev=$status{$in{'dev'}}{parent}'>$status{$parent}{name}</a>", $status{$parent}{state}, $status{$parent}{read}, $status{$parent}{write}, $status{$parent}{cksum}]); |
| 21 | + print ui_columns_end(); |
| 22 | +} |
| 23 | +ui_zpool_list($in{'pool'}); |
| 24 | +if (($status{$in{'dev'}}{name} =~ "cache") || ($status{$in{'dev'}}{name} =~ "logs") || ($status{$in{'dev'}}{name} =~ "spare") || ($status{$in{'dev'}}{name} =~ /mirror/) || ($status{$in{'dev'}}{name} =~ /raidz/)) |
| 25 | +{ |
| 26 | +print "Children: "; |
| 27 | + foreach $key (sort(keys %status)) |
| 28 | + { |
| 29 | + if ($status{$key}{parent} =~ $in{'dev'}) |
| 30 | + { |
| 31 | + print "<a href='config-vdev.cgi?pool=$in{pool}&dev=$key'>".$status{$key}{name}."</a> "; |
| 32 | + } |
| 33 | + } |
| 34 | +} elsif ($config{'pool_properties'} =~ /1/) { |
| 35 | + print ui_table_start("Tasks", "width=100%", "10", ['align=left'] ); |
| 36 | + if ($status{$in{'dev'}}{state} =~ "ONLINE") { |
| 37 | + print ui_table_row("Offline: ", "<a href='cmd.cgi?cmd=vdev&action=offline&pool=$in{'pool'}&vdev=$status{$in{'dev'}}{name}'>Bring device offline</a><br />"); |
| 38 | + } |
| 39 | + else { #elsif ($status{$in{'dev'}}{state} =~ "OFFLINE") { |
| 40 | + print ui_table_row("Online: ", "<a href='cmd.cgi?cmd=vdev&action=online&pool=$in{'pool'}&vdev=$status{$in{'dev'}}{name}'>Bring device online</a><br />"); |
| 41 | + } |
| 42 | + print ui_table_row("Replace: ", "<a href='cmd.cgi?cmd=replace&vdev=$status{$in{'dev'}}{name}&pool=$in{'pool'}'>Replace device</a><br />"); |
| 43 | + print ui_table_row("Remove: ", "<a href='cmd.cgi?cmd=vdev&action=remove&pool=$in{'pool'}&vdev=$status{$in{'dev'}}{name}'>Remove device</a><br />"); |
| 44 | + print ui_table_row("Detach: ", "<a href='cmd.cgi?cmd=vdev&action=detach&pool=$in{'pool'}&vdev=$status{$in{'dev'}}{name}'>Detach device</a><br />"); |
| 45 | + print ui_table_row("Clear: ", "<a href='cmd.cgi?cmd=vdev&action=clear&pool=$in{'pool'}&vdev=$status{$in{'dev'}}{name}'>Clear errors</a><br />"); |
| 46 | + print ui_table_end(); |
| 47 | +} |
| 48 | + |
| 49 | +ui_print_footer("status.cgi?pool=$in{'pool'}", $in{'pool'}); |
0 commit comments