<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: Verdana; font-size: 10pt; color: #000000'><div>seem to work</div><div><br></div><div>root@kvmtest3:/# perl test.pl /dev/disk/by-id/scsi-3600144f0f62f0e0000004f4b9fd800af</div><div>$VAR1 = {</div><div> 'revision' => '1.0',</div><div> 'venodor' => 'NEXENTA',</div><div> 'removable' => 0,</div><div> 'product' => 'COMSTAR',</div><div> 'device' => 0</div><div> };</div><div><br></div><div><div>root@kvmtest3:/# ls -l /dev/disk/by-id/scsi-3600144f0f62f0e0000004f4b9fd800af</div><div>lrwxrwxrwx 1 root root 12 Mar 17 14:50 /dev/disk/by-id/scsi-3600144f0f62f0e0000004f4b9fd800af -> ../../dm-357</div></div><div><br></div><div><br></div><br><hr id="zwchr"><div style="color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>De: </b>"Dietmar Maurer" <dietmar@proxmox.com><br><b>À: </b>"Alexandre DERUMIER" <aderumier@odiso.com><br><b>Cc: </b>pve-devel@pve.proxmox.com<br><b>Envoyé: </b>Lundi 19 Mars 2012 09:55:24<br><b>Objet: </b>RE: [pve-devel] [PATCH] add scsi-block detection<br><br>Please can you test if this works to identify the multipath scsi devices?<br><br>-------------------------<br>#!/usr/bin/perl -w<br><br>use strict;<br>use IO::File;<br>use Data::Dumper;<br><br>sub scsi_inquiry {<br> my($fh, $noerr) = @_;<br><br> my $SG_IO = 0x2285;<br> my $SG_GET_VERSION_NUM = 0x2282;<br><br> my $versionbuf = "\x00" x 8;<br> my $ret = ioctl($fh, $SG_GET_VERSION_NUM, $versionbuf);<br> if (!$ret) {<br> die "scsi ioctl SG_GET_VERSION_NUM failoed - $!\n" if !$noerr;<br> return undef;<br> }<br> my $version = unpack("I", $versionbuf);<br><br> if ($version < 30000) {<br> die "scsi generic interface too old\n" if !$noerr;<br> return undef;<br> }<br> <br> my $buf = "\x00" x 36;<br> my $sensebuf = "\x00" x 8;<br> my $cmd = pack("C x3 C x11", 0x12, 36);<br> <br> my $packet = pack("i i C C s I P P P I I i P C C C C S S i I I",<br> ord('S'), -3, length($cmd), length($sensebuf), 0,<br> length($buf), $buf, $cmd, $sensebuf, 6000);<br><br> $ret = ioctl($fh, $SG_IO, $packet);<br> if (!$ret) {<br> die "scsi ioctl SG_IO failed - $!\n" if !$noerr;<br> return undef;<br> }<br><br> my @res = unpack("i i C C s I P P P I I i P C C C C S S i I I", $packet);<br> if ($res[17] || $res[18]) {<br> die "scsi ioctl SG_IO status error - $!\n" if !$noerr;<br> return undef;<br> }<br><br> my $res = {};<br> ($res->{device}, $res->{removable}, $res->{venodor},<br> $res->{product}, $res->{revision}) = unpack("C C x6 A8 A16 A4", $buf);<br><br> return $res;<br>}<br><br>my $devfn = shift || die "no device specified\n";<br><br>my $fh=IO::File->new("+<$devfn") || die "can't open '$devfn' - $!\n";<br><br>my $data = scsi_inquiry($fh);<br>print Dumper($data);<br><br>close($fh);<br><br><br>> -----Original Message-----<br>> From: Alexandre DERUMIER [mailto:aderumier@odiso.com]<br>> Sent: Montag, 19. März 2012 07:06<br>> To: Dietmar Maurer<br>> Cc: pve-devel@pve.proxmox.com<br>> Subject: Re: [pve-devel] [PATCH] add scsi-block detection<br>> <br>> Hi Dietmar,<br>> I found this :<br>> <br>> http://search.cpan.org/~mooli/Device-SCSI-1.004/lib/Device/SCSI.pm<br>> <br>> <br>> use Device::SCSI;<br>> <br>> my @devices = Device::SCSI->enumerate;<br>> <br>> my $device = Device::SCSI->new($devices[0]);<br>> my %inquiry = %{ $device->inquiry };<br>> my ($result, $sense) = $device->execute($command, $wanted, $data);<br>> $device->close;<br>> <br>> <br>> Seem to be what we want to do ...<br>> <br>> ----- Mail original -----<br>> <br>> De: "Dietmar Maurer" <dietmar@proxmox.com><br>> À: "Alexandre DERUMIER" <aderumier@odiso.com><br>> Cc: pve-devel@pve.proxmox.com<br>> Envoyé: Vendredi 16 Mars 2012 15:58:54<br>> Objet: RE: [pve-devel] [PATCH] add scsi-block detection<br>> <br>> > maybe<br>> ><br>> > bdrv_ioctl(s->qdev.conf.bs, SG_GET_VERSION_NUM, &sg_version) do the<br>> > job ?<br>> <br>> AFAIK the inquiry command fail, so we need to execute an scsi inquiry.<br>> <br>> - Dietmar<br>> <br>> <br>> <br>> --<br>> <br>> --<br>> <br>> <br>> <br>> <br>> Alexandre D erumier<br>> Ingénieur Système<br>> Fixe : 03 20 68 88 90<br>> Fax : 03 20 68 90 81<br>> 45 Bvd du Général Leclerc 59100 Roubaix - France<br>> 12 rue Marivaux 75002 Paris - France<br>> <br><br></div><br><br><br>-- <br><div><span name="x"></span><p class="MsoNormal" style="margin-top: 0cm; margin-right: 0cm; margin-bottom: 0.0001pt; margin-left: 0cm; background-color: rgb(255, 255, 255); font-size: 11pt; font-family: Calibri, sans-serif; "><br></p><div style="font-family: 'Andale Mono'; font-size: 16px; background-color: rgb(255, 255, 255); "><table style="font-family: 'Times New Roman'; "><tbody><tr><td><img src="http://www.odiso.com/library/img/signature/logosignatureorange2.png" src="http://www.odiso.com/library/img/signature/logosignatureorange2.png"></td><td width="100%" style="background-color: rgb(244, 229, 223); "><table><tbody><tr><td height="50px"><b><font color="#EA7242" face="Calibri" style="font-size: 20px; ">Alexandre</font> D<font color="#424242" face="Calibri" style="font-size: 20px; ">erumier</font></b><br><b><font color="#636466" face="Calibri"><font size="2">Ingénieur Système</font></font></b></td></tr><tr><td height="16px"><b><font color="#424242" face="Calibri" style="font-size: 13px; ">Fixe : </font></b><font color="#636466" face="Calibri" style="font-size: 13px; ">03 20 68 88 90</font></td></tr><tr><td height="16px"><b><font color="#424242" face="Calibri" style="font-size: 13px; ">Fax : </font></b><font color="#636466" face="Calibri" style="font-size: 13px; ">03 20 68 90 81</font></td></tr><tr><td height="15px"><font color="#808080" face="Calibri" style="font-size: 12px; ">45 Bvd du Général Leclerc 59100 Roubaix - France</font></td></tr><tr><td height="15px"><font color="#808080" face="Calibri" style="font-size: 12px; ">12 rue Marivaux 75002 Paris - France</font></td></tr></tbody></table></td></tr><tr><td></td><td></td></tr></tbody></table></div><span name="x"></span><br></div></div></body></html>