public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Filip Schauer <f.schauer@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup] fix #5946: api: disks: directory: fix unknown task status when partition creation fails
Date: Tue, 22 Apr 2025 17:03:24 +0200	[thread overview]
Message-ID: <20250422150324.228633-1-f.schauer@proxmox.com> (raw)

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


                 reply	other threads:[~2025-04-22 15:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250422150324.228633-1-f.schauer@proxmox.com \
    --to=f.schauer@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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