[pve-devel] [PATCH] add scsi-block detection
Dietmar Maurer
dietmar at proxmox.com
Fri Mar 16 15:20:41 CET 2012
Have you checked what kind of test the scsi-block driver usese itself? Maybe a simple ioctl call?
> -----Original Message-----
> From: Alexandre DERUMIER [mailto:aderumier at odiso.com]
> Sent: Freitag, 16. März 2012 12:12
> To: Dietmar Maurer
> Cc: pve-devel at pve.proxmox.com
> Subject: Re: [pve-devel] [PATCH] add scsi-block detection
>
> yes,it's work, i tested it with my multipathed iscsi luns.
>
> ----- Mail original -----
>
> De: "Dietmar Maurer" <dietmar at proxmox.com>
> À: "Derumier Alexandre" <aderumier at odiso.com>, pve-
> devel at pve.proxmox.com
> Envoyé: Vendredi 16 Mars 2012 11:18:22
> Objet: RE: [pve-devel] [PATCH] add scsi-block detection
>
> And such multipath device works with the scsi-block driver (you tested that)?
>
> - Dietmar
>
> > -----Original Message-----
> > From: pve-devel-bounces at pve.proxmox.com [mailto:pve-devel-
> > bounces at pve.proxmox.com] On Behalf Of Derumier Alexandre
> > Sent: Freitag, 16. März 2012 08:57
> > To: pve-devel at pve.proxmox.com
> > Subject: [pve-devel] [PATCH] add scsi-block detection
> >
> >
> > Signed-off-by: Derumier Alexandre <aderumier at odiso.com>
> > ---
> > PVE/QemuServer.pm | 48
> > +++++++++++++++++++++++++++++++++++++++++++++---
> > 1 files changed, 45 insertions(+), 3 deletions(-)
> >
> > diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm index
> > 3991606..13a7852 100644
> > --- a/PVE/QemuServer.pm
> > +++ b/PVE/QemuServer.pm
> > @@ -25,6 +25,7 @@ use PVE::Cluster qw(cfs_register_file cfs_read_file
> > cfs_write_file cfs_lock_file use PVE::INotify; use PVE::ProcFSTools;
> > use Time::HiRes qw(gettimeofday);
> > +use Unix::Mknod qw(:all);
> >
> > my $cpuinfo = PVE::ProcFSTools::read_cpuinfo();
> >
> > @@ -904,9 +905,8 @@ sub print_drivedevice_full { } else { $path =
> > PVE::Storage::path($storecfg, $drive->{file}); }
> > - if ($path =~ m|^/dev/| ) {
> > - $devicetype = 'block';
> > - }
> > +
> > + $devicetype = 'block' if path_is_scsi($path);
> > }
> >
> > $device = "scsi-$devicetype,bus=lsi$controller.0,scsi-
> > id=$unit,drive=drive-$drive->{interface}$drive->{index},id=$drive-
> > >{interface}$drive->{index}";
> > @@ -2904,6 +2904,48 @@ sub vm_stopall { print $msg; }
> >
> > +sub path_is_scsi {
> > + my ($path) = @_;
> > +
> > + return if ($path !~ m|^/dev/|);
> > +
> > + my $bdev = undef;
> > + #if path is /dev/xxx
> > + if($path =~ m|^/dev/[^/]+/?$|) {
> > + $bdev = $path;
> > + }
> > + #if path is /dev/disk/
> > + elsif ($path =~ m|^/dev/disk/|) {
> > + $bdev = readlink($path);
> > + #if multipath, we need to find real device if($bdev =~
> > + m/(dm-(\d+))$/) { my $dir="/sys/block/$1/slaves/"; my $dh =
> > + IO::Dir->new ($dir); if (defined $dh) { while (defined(my $tmp =
> > + $dh->read)) { if ($tmp =~ m/([0-9A-Za-z])$/) { $bdev="/dev/$tmp"; }
> > + } } } elsif ($bdev =~ m/(\w+)/) { $bdev="/dev/$1"; } }
> > +
> > + return if !$bdev;
> > +
> > + my $st=stat($bdev);
> > + my $major=Unix::Mknod::major($st->rdev);
> > +
> > + if ($major =~ m/^(\d+)$/) {
> > + $major = $1;
> > + my @scsimajors =
> > (8,65,66,67,68,69,70,71,128,129,130,131,132,133,134,135);
> > + return 1 if (grep /^$major$/, @scsimajors) } }
> > +
> > # pci helpers
> >
> > sub file_write {
> > --
> > 1.7.2.5
> >
> > _______________________________________________
> > pve-devel mailing list
> > pve-devel at pve.proxmox.com
> > http://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
>
>
>
>
>
> --
>
> --
>
>
>
>
> Alexandre D erumier
> Ingénieur Système
> Fixe : 03 20 68 88 90
> Fax : 03 20 68 90 81
> 45 Bvd du Général Leclerc 59100 Roubaix - France
> 12 rue Marivaux 75002 Paris - France
>
More information about the pve-devel
mailing list