public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH storage 1/2] disks: get: separate error path for retrieving SMART data
@ 2025-04-11 15:08 Daniel Kral
  2025-04-11 15:08 ` [pve-devel] [PATCH storage 2/2] fix #6224: disks: get: set timeout for retrieval of SMART stat data Daniel Kral
  2025-04-11 15:52 ` [pve-devel] [PATCH storage 1/2] disks: get: separate error path for retrieving SMART data Max Carrara
  0 siblings, 2 replies; 6+ messages in thread
From: Daniel Kral @ 2025-04-11 15:08 UTC (permalink / raw)
  To: pve-devel

Make the subroutine get_smart_data() die with the error message from
running the `smartctl` command before. This is in preparation for the
next patch, which makes that command fail in certain scenarios.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
 src/PVE/Diskmanage.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/Diskmanage.pm b/src/PVE/Diskmanage.pm
index 4272668..059d645 100644
--- a/src/PVE/Diskmanage.pm
+++ b/src/PVE/Diskmanage.pm
@@ -150,8 +150,10 @@ sub get_smart_data {
     };
     my $err = $@;
 
+    die "Error getting S.M.A.R.T. data: $err\n" if $err;
+
     # bit 0 and 1 mark a fatal error, other bits are for disk status -> ignore (see man 8 smartctl)
-    if ((defined($returncode) && ($returncode & 0b00000011)) || $err) {
+    if ((defined($returncode) && ($returncode & 0b00000011))) {
 	die "Error getting S.M.A.R.T. data: Exit code: $returncode\n";
     }
 
-- 
2.39.5



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-15  7:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-11 15:08 [pve-devel] [PATCH storage 1/2] disks: get: separate error path for retrieving SMART data Daniel Kral
2025-04-11 15:08 ` [pve-devel] [PATCH storage 2/2] fix #6224: disks: get: set timeout for retrieval of SMART stat data Daniel Kral
2025-04-11 16:04   ` Max Carrara
2025-04-15  6:42     ` Daniel Kral
2025-04-11 15:52 ` [pve-devel] [PATCH storage 1/2] disks: get: separate error path for retrieving SMART data Max Carrara
2025-04-15  7:15   ` Daniel Kral

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal