public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
	Aaron Lauterer <a.lauterer@proxmox.com>
Subject: Re: [pve-devel] [PATCH manager 3/5] api ceph osd: add volume details endpoint
Date: Wed, 6 Jul 2022 08:37:47 +0200	[thread overview]
Message-ID: <2f5c421e-9fc2-64d1-8701-f861a75517ce@proxmox.com> (raw)
In-Reply-To: <7e833330-c2bc-d392-2690-fc828e600adb@proxmox.com>

On 05/07/2022 16:19, Aaron Lauterer wrote:
> Okay, so IIUC, drop the Datastore.Audit and only keep the Sys.Audit?

yes.

> 
> Being unsure 😉 Looking closer at run_command, it will die if there is some issue running the specified command, not found or returning an error. So this would only be needed if I would like to catch the error to handle it in some way, right?

>>> +    my $cmd = ['/usr/sbin/ceph-volume', 'lvm', 'list', '--format', 'json'];
>>> +    eval { run_command($cmd, errmsg => 'ceph volume error', outfunc => $parser) };
>>> +    die $@ if $@;
>>
>> what's the point in eval'ing if you do a plain die then anyway on $@?
> 
> Being unsure 😉 Looking closer at run_command, it will die if there is some issue running the specified command, not found or returning an error. So this would only be needed if I would like to catch the error to handle it in some way, right?

Most of the time an eval with a single (!) function call, for example like
`eval { foo() }; die $@ if $@;`, is identical with '`foo();`, I say most of the
time because a function may avoid die directly but only set $@ manually, and in
that case the eval can help to ensure it was an error from inside the function,
as `eval {}` will reset $@ to undef.

IIRC we only do such "set $@ manually without die" in the PVE::Tools
lock_file_full (and thus the depending lock_file) method though, so just
mentioning for completeness sake.

Otherwise you're right, doing eval { .. } + die if $@ is basically done when
we require to transform the error or have additional condition for when to
actually die, e.g., a $noerr parameter.






  reply	other threads:[~2022-07-06  6:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-01 14:16 [pve-devel] [PATCH widget-toolkit/manager 0/5] Ceph OSD: add detail infos Aaron Lauterer
2022-07-01 14:16 ` [pve-devel] [PATCH widget-toolkit 1/5] ObjectGrid: optionally show loading on reload Aaron Lauterer
2022-07-05  9:32   ` Thomas Lamprecht
2022-07-01 14:16 ` [pve-devel] [PATCH manager 2/5] api ceph osd: add OSD details endpoint Aaron Lauterer
2022-07-01 14:16 ` [pve-devel] [PATCH manager 3/5] api ceph osd: add volume " Aaron Lauterer
2022-07-05  9:58   ` Thomas Lamprecht
2022-07-05 14:19     ` Aaron Lauterer
2022-07-06  6:37       ` Thomas Lamprecht [this message]
2022-07-01 14:16 ` [pve-devel] [PATCH manager 4/5] ui utils: add renderer for ceph osd addresses Aaron Lauterer
2022-07-01 14:16 ` [pve-devel] [PATCH manager 5/5] ui: osd: add details window Aaron Lauterer

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=2f5c421e-9fc2-64d1-8701-f861a75517ce@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=a.lauterer@proxmox.com \
    --cc=pve-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