Commit 1e4dff62 authored by Ryan Jackson's avatar Ryan Jackson

Fixed a few small bugs in os_get_disks

parent e73a834a
......@@ -10,6 +10,11 @@ use File::Basename;
use Fcntl;
use IO::Handle;
# Drag in path stuff so we can find emulab stuff.
BEGIN { require "/etc/emulab/paths.pm"; import emulabpaths; }
use liblocsetup;
sub WhichRawDisk();
#
......@@ -488,9 +493,7 @@ sub DiskList()
my @preferred;
my @units;
if (-x $dmesgcmd) {
@tmp = os_get_disks();
}
@tmp = os_get_disks();
if ($OSNAME eq 'linux') {
@preferred = @linux_preferred;
......@@ -501,7 +504,7 @@ sub DiskList()
@units = @bsd_units;
}
for my $disk (@preffered) {
for my $disk (@preferred) {
for my $unit (@units) {
for my $dev (@tmp) {
if ($dev =~ /^$disk$unit/) {
......
......@@ -21,6 +21,7 @@ use Exporter;
os_routing_add_manual os_routing_del_manual os_homedirdel
os_groupdel os_getnfsmounts os_islocaldir
os_fwconfig_line os_fwrouteconfig_line os_config_gre
os_get_disks os_get_disk_size os_get_partition_info
);
# Must come after package declaration!
......@@ -1559,14 +1560,14 @@ sub os_get_disks
{
my @blockdevs;
@blockdevs = map { s#/sys/block/## } glob('/sys/block/*');
@blockdevs = map { s#/sys/block/##; $_ } glob('/sys/block/*');
return @blockdevs;
}
sub os_get_disk_size($)
{
my $disk = (@_);
my ($disk) = @_;
my $size;
$disk =~ s#^/dev/##;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment