[pve-devel] [PATCH storage 5/5] add default rotational value

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


because if the file does not exist,
we have an perl error for comparing an uninitialized
value

Signed-off-by: Dominik Csapak <d.csapak at proxmox.com>
---
 PVE/Diskmanage.pm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PVE/Diskmanage.pm b/PVE/Diskmanage.pm
index c8706b7..0bd0556 100644
--- a/PVE/Diskmanage.pm
+++ b/PVE/Diskmanage.pm
@@ -282,7 +282,7 @@ sub get_sysdir_info {
     $data->{size} = $size * 512;
 
     # dir/queue/rotational should be 1 for hdd, 0 for ssd
-    $data->{rotational} = file_read_firstline("$sysdir/queue/rotational");
+    $data->{rotational} = file_read_firstline("$sysdir/queue/rotational") || -1;
 
     $data->{vendor} = file_read_firstline("$sysdir/device/vendor") || 'unknown';
     $data->{model} = file_read_firstline("$sysdir/device/model") || 'unknown';
-- 
2.1.4





More information about the pve-devel mailing list