]> git.proxmox.com Git - pve-storage.git/commitdiff
move directory test into get_sysdir_info
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 17 Oct 2016 08:29:09 +0000 (10:29 +0200)
committerDietmar Maurer <dietmar@proxmox.com>
Fri, 28 Oct 2016 08:19:40 +0000 (10:19 +0200)
because it logically belongs there, also
this makes the testing easier

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
PVE/Diskmanage.pm

index 8382045cde362c38ff6c7f350649de8c4f349f3b..dd2591c70d8e32c434f9f7c25792fcb6b806d632 100644 (file)
@@ -266,6 +266,8 @@ sub get_udev_info {
 sub get_sysdir_info {
     my ($sysdir) = @_;
 
+    return undef if ! -d "$sysdir/device";
+
     my $data = {};
 
     my $size = file_read_firstline("$sysdir/size");
@@ -381,10 +383,8 @@ sub get_disks {
 
        my $sysdir = "/sys/block/$dev";
 
-       return if ! -d "$sysdir/device";
-
        # we do not want iscsi devices
-       return if readlink($sysdir) =~ m|host[^/]*/session[^/]*|;
+       return if -l $sysdir && readlink($sysdir) =~ m|host[^/]*/session[^/]*|;
 
        my $sysdata = get_sysdir_info($sysdir);
        return if !defined($sysdata);