all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox Backup Server development discussion
	<pbs-devel@lists.proxmox.com>,
	Dominik Csapak <d.csapak@proxmox.com>
Subject: Re: [pbs-devel] [PATCH proxmox-backup] tape: fix 'eject-before-unload' api type
Date: Thu, 14 Dec 2023 08:46:29 +0100	[thread overview]
Message-ID: <ee53bf43-bc1f-42b0-a8ad-a1b677c793c0@proxmox.com> (raw)
In-Reply-To: <20231213101112.76140-1-d.csapak@proxmox.com>

Am 13/12/2023 um 11:11 schrieb Dominik Csapak:
> by converting the bool into an option, otherwise having the options not
> set at all will fail the unload while deserializing with
> 'eject-before-unload is not optional'
> 
> Also if we can automatically decide this in the future, we can now
> detect if the option was explicitely set or not.
> 
> Fixes: 66402cdc ("fix #4904: tape changer: add option to eject before unload")
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  pbs-api-types/src/tape/changer.rs | 17 ++++++++++-------
>  src/tape/changer/mod.rs           |  2 +-
>  2 files changed, 11 insertions(+), 8 deletions(-)
> 
> diff --git a/pbs-api-types/src/tape/changer.rs b/pbs-api-types/src/tape/changer.rs
> index e3cf27c1..9e36b12e 100644
> --- a/pbs-api-types/src/tape/changer.rs
> +++ b/pbs-api-types/src/tape/changer.rs
> @@ -39,18 +39,21 @@ Import/Export, i.e. any media in those slots are considered to be
>  .format(&ApiStringFormat::PropertyString(&SLOT_ARRAY_SCHEMA))
>  .schema();
>  
> -fn is_false(b: &bool) -> bool {
> -    !b
> -}
> -
> -#[api]
> +#[api(
> +    properties: {
> +        "eject-before-unload": {
> +            optional: true,
> +            default: false,
> +        },
> +    },
> +)]
>  #[derive(Serialize, Deserialize)]
>  #[serde(rename_all = "kebab-case")]
>  /// Options for Changers
>  pub struct ChangerOptions {

semi-related to your change, but as I talked with Dietmar off-list about this and
thus checked it out a bit more closely:

As this is already on the changer section type it might make more sense to just have
the "eject-before-unload" option there directly though.

As having a property-string here seems a bit odd, we mostly use them if we want to
configure more things at once on a single (sub)-subject, like network for VMs, but
if you'd have this as "plain" option for the change section-type, it would already
affect the correct subject.

If we get many more such options in the future, we can always move them into a
property-string grouping for a next major release, but tbh. I would be slightly
surprised if it's more than a handful such new options in the next decade.
And even if, as long as they affect the changer, not a sub-subject, it can be
still fine to have any such new option also standalone on the top-level





  reply	other threads:[~2023-12-14  7:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-13 10:11 Dominik Csapak
2023-12-14  7:46 ` Thomas Lamprecht [this message]
2023-12-14  7:52   ` Dominik Csapak
2023-12-14  8:18     ` Dietmar Maurer
2023-12-14  8:32     ` Thomas Lamprecht

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=ee53bf43-bc1f-42b0-a8ad-a1b677c793c0@proxmox.com \
    --to=t.lamprecht@proxmox.com \
    --cc=d.csapak@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 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