all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [RFC storage v2 1/3] api: smart: return unknown health instead of error message
@ 2025-04-15  7:11 Daniel Kral
  2025-04-15  7:11 ` [pve-devel] [PATCH storage v2 2/3] disks: get: separate error path for retrieving SMART data Daniel Kral
  2025-04-15  7:11 ` [pve-devel] [PATCH storage v2 3/3] fix #6224: disks: get: set timeout for retrieval of SMART stat data Daniel Kral
  0 siblings, 2 replies; 3+ messages in thread
From: Daniel Kral @ 2025-04-15  7:11 UTC (permalink / raw)
  To: pve-devel

In case of an error, the WebGUI expects the SMART data API endpoint to
return a health value, but it will return an error message directly. To
make this more user friendly, mask the error in the API handler.

Signed-off-by: Daniel Kral <d.kral@proxmox.com>
---
This could also have been intentional as the error message is passed to
the CLI and API response correctly, which is why it is a RFC.

 src/PVE/API2/Disks.pm | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/PVE/API2/Disks.pm b/src/PVE/API2/Disks.pm
index 408bdbe..fe8d08e 100644
--- a/src/PVE/API2/Disks.pm
+++ b/src/PVE/API2/Disks.pm
@@ -216,7 +216,9 @@ __PACKAGE__->register_method ({
 
 	my $disk = PVE::Diskmanage::verify_blockdev_path($param->{disk});
 
-	my $result = PVE::Diskmanage::get_smart_data($disk, $param->{healthonly});
+	my $result = eval {
+	    PVE::Diskmanage::get_smart_data($disk, $param->{healthonly})
+	};
 
 	$result->{health} = 'UNKNOWN' if !defined $result->{health};
 	$result = { health => $result->{health} } if $param->{healthonly};
-- 
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] 3+ messages in thread

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-15  7:11 [pve-devel] [RFC storage v2 1/3] api: smart: return unknown health instead of error message Daniel Kral
2025-04-15  7:11 ` [pve-devel] [PATCH storage v2 2/3] disks: get: separate error path for retrieving SMART data Daniel Kral
2025-04-15  7:11 ` [pve-devel] [PATCH storage v2 3/3] fix #6224: disks: get: set timeout for retrieval of SMART stat data Daniel Kral

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal