[pve-devel] [PATCH storage 2/5] move directory test into get_sysdir_info

Dominik Csapak d.csapak at proxmox.com
Mon Oct 17 10:29:09 CEST 2016


because it logically belongs there, also
this makes the testing easier

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/Diskmanage.pm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index 8382045..dd2591c 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -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);
-- 
2.1.4





More information about the pve-devel mailing list