Eugene Vilensky asks:

> What is an easy way to identify if the scsi devices of a host are
> attached via FC or just scsi?

Depends who wants to know, when, and in what format.

Here's what I do as a priority callout for multipath. Note this only works for 
RHEL5, not RHEL4, because RHEL4 kernel doesn't give you all the requisite links.

#!/usr/bin/perl

my $dev = $ARGV[0];

#open LOG, ">> /tmp/prio_compellent";
#print LOG scalar(localtime) . $dev . "\n";

($dev) = $dev =~ /^\/dev\/(sd[a-z]{1,2})$/;

die unless $dev;

chdir "/sys/block/$dev/device" or die "invalid device $dev";

opendir DEVICE, ".";
while ($_ = readdir DEVICE) {
  if (/scsi_device:(\d+):\d+:\d+:\d+$/) {
    my $host = $1;
    closedir DEVICE;
    chdir "/sys/class/scsi_host/host$host" or die "could not find scsi_host";
    open PROC, "< proc_name";
    $proc = <PROC>;
    close PROC;
    if ($proc =~ /iscsi_tcp/) {
      print "10\n";
      #print LOG "10\n";
      exit 0;
    }
    if (-e 'isp_name') {
      print "50\n";
      #print LOG "50\n";
      exit 0;
    }
    print "20\n";
    exit 0;
  }
}
closedir DEVICE;
die "could not find scsi_device\n";
-- 
Rich Graves http://claimid.com/rcgraves
Carleton.edu Sr UNIX and Security Admin
CMC135: 507-646-7079 Cell: 952-292-6529

_______________________________________________
rhelv5-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/rhelv5-list

Reply via email to