public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup] fix #5946: api: disks: directory: fix unknown task status when partition creation fails
@ 2025-04-22 15:03 Filip Schauer
  2025-06-04 11:28 ` Fabian Grünbichler
  0 siblings, 1 reply; 2+ messages in thread
From: Filip Schauer @ 2025-04-22 15:03 UTC (permalink / raw)
  To: pbs-devel

This shows a more helpful error status than "unknown", when the
directory creation task fails during creation of the partition on disk.
The full error message can still be viewed in the task log.

Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
---
Is there a cleaner way to handle this?

 src/api2/node/disks/directory.rs | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
index 62f46343..cd60f192 100644
--- a/src/api2/node/disks/directory.rs
+++ b/src/api2/node/disks/directory.rs
@@ -223,7 +223,13 @@ pub fn create_datastore_disk(
 
             let disk = manager.disk_by_name(&disk)?;
 
-            let partition = create_single_linux_partition(&disk)?;
+            let partition = match create_single_linux_partition(&disk) {
+                Ok(partition) => partition,
+                Err(err) => {
+                    info!("{err}");
+                    bail!("failed to format disk as Linux partition");
+                }
+            };
             create_file_system(&partition, filesystem)?;
 
             let uuid = get_fs_uuid(&partition)?;
-- 
2.39.5


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


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

* Re: [pbs-devel] [PATCH proxmox-backup] fix #5946: api: disks: directory: fix unknown task status when partition creation fails
  2025-04-22 15:03 [pbs-devel] [PATCH proxmox-backup] fix #5946: api: disks: directory: fix unknown task status when partition creation fails Filip Schauer
@ 2025-06-04 11:28 ` Fabian Grünbichler
  0 siblings, 0 replies; 2+ messages in thread
From: Fabian Grünbichler @ 2025-06-04 11:28 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion

On April 22, 2025 5:03 pm, Filip Schauer wrote:
> This shows a more helpful error status than "unknown", when the
> directory creation task fails during creation of the partition on disk.
> The full error message can still be viewed in the task log.
> 
> Signed-off-by: Filip Schauer <f.schauer@proxmox.com>
> ---
> Is there a cleaner way to handle this?

I am not sure I understand the issue - is {err} sometimes just
"unknown"? I think then improving that error message would make more
sense..

or how does replacing one Error with another Error fix the problem?

> 
>  src/api2/node/disks/directory.rs | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/api2/node/disks/directory.rs b/src/api2/node/disks/directory.rs
> index 62f46343..cd60f192 100644
> --- a/src/api2/node/disks/directory.rs
> +++ b/src/api2/node/disks/directory.rs
> @@ -223,7 +223,13 @@ pub fn create_datastore_disk(
>  
>              let disk = manager.disk_by_name(&disk)?;
>  
> -            let partition = create_single_linux_partition(&disk)?;
> +            let partition = match create_single_linux_partition(&disk) {
> +                Ok(partition) => partition,
> +                Err(err) => {
> +                    info!("{err}");
> +                    bail!("failed to format disk as Linux partition");
> +                }
> +            };
>              create_file_system(&partition, filesystem)?;
>  
>              let uuid = get_fs_uuid(&partition)?;
> -- 
> 2.39.5
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel@lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 


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


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

end of thread, other threads:[~2025-06-04 11:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-04-22 15:03 [pbs-devel] [PATCH proxmox-backup] fix #5946: api: disks: directory: fix unknown task status when partition creation fails Filip Schauer
2025-06-04 11:28 ` Fabian Grünbichler

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