public inbox for pbs-devel@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 v2 7/8] bin/proxmox-tape: add restore-single command to proxmox-tape
Date: Wed, 5 May 2021 13:04:30 +0200	[thread overview]
Message-ID: <42acd90e-4a3f-e43b-b670-845ff1a77173@proxmox.com> (raw)
In-Reply-To: <20210505100918.506-8-d.csapak@proxmox.com>

On 05.05.21 12:09, Dominik Csapak wrote:
> Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
> ---
>  src/bin/proxmox-tape.rs | 62 +++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 62 insertions(+)
> 
> diff --git a/src/bin/proxmox-tape.rs b/src/bin/proxmox-tape.rs
> index e18f334c..3d5d0cf3 100644
> --- a/src/bin/proxmox-tape.rs
> +++ b/src/bin/proxmox-tape.rs
> @@ -868,6 +868,61 @@ async fn backup(mut param: Value) -> Result<(), Error> {
>      Ok(())
>  }
>  
> +#[api(
> +   input: {
> +        properties: {
> +            store: {
> +                schema: DATASTORE_MAP_LIST_SCHEMA,
> +            },
> +            drive: {
> +                schema: DRIVE_NAME_SCHEMA,
> +                optional: true,
> +            },
> +            "media-set": {
> +                description: "Media set UUID.",
> +                type: String,
> +            },
> +            "snapshots": {
> +                description: "Comma-separated list of snapshots.",
> +                type: Array,
> +                items: {
> +                    type: String,
> +                    description: "A single snapshot',"
> +                },
> +            },

same here, and if we'd really like to add a extra command for restoring not all but
a list of snapshots I'd at least make snapshots a fixed "take all" parameter, e.g.:

proxmox-tape restore-snapshots --store bar --media-set foo vm/100/... ct/101/...

Or allow passing it multiple times for accumulation, as those can be better
tab-completed which would be really helpful compared to typing some date in.
(those pasting it in would not loose any benefit).

But as said, above is only for the case where we really want a separate command,
IMO this would fit fine into a single restore command...

> +            "notify-user": {
> +                type: Userid,
> +                optional: true,
> +            },
> +            owner: {
> +                type: Authid,
> +                optional: true,
> +            },
> +            "output-format": {
> +                schema: OUTPUT_FORMAT,
> +                optional: true,
> +            },
> +        },
> +    },
> +)]
> +/// Restore data from media-set
> +async fn restore_single(mut param: Value) -> Result<(), Error> {
> +
> +    let output_format = get_output_format(&param);
> +
> +    let (config, _digest) = config::drive::config()?;
> +
> +    param["drive"] = extract_drive_name(&mut param, &config)?.into();
> +
> +    let mut client = connect_to_localhost()?;
> +
> +    let result = client.post("api2/json/tape/restore-single", Some(param)).await?;
> +
> +    view_task_result(&mut client, result, &output_format).await?;
> +
> +    Ok(())
> +}
> +
>  #[api(
>     input: {
>          properties: {
> @@ -981,6 +1036,13 @@ fn main() {
>                  .completion_cb("store", complete_datastore_name)
>                  .completion_cb("media-set", complete_media_set_uuid)
>          )
> +        .insert(
> +            "restore-single",
> +            CliCommand::new(&API_METHOD_RESTORE_SINGLE)
> +                .arg_param(&["media-set", "store", "snapshots"])
> +                .completion_cb("store", complete_datastore_name)
> +                .completion_cb("media-set", complete_media_set_uuid)
> +        )
>          .insert(
>              "barcode-label",
>              CliCommand::new(&API_METHOD_BARCODE_LABEL_MEDIA)
> 





  reply	other threads:[~2021-05-05 11:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-05 10:09 [pbs-devel] [PATCH proxmox-backup v2 0/8] tape: single snapshot restore Dominik Csapak
2021-05-05 10:09 ` [pbs-devel] [PATCH proxmox-backup v2 1/8] tape/drive: add 'move_to_file' to TapeDriver trait Dominik Csapak
2021-05-06  5:56   ` [pbs-devel] applied: " Dietmar Maurer
2021-05-05 10:09 ` [pbs-devel] [PATCH proxmox-backup v2 2/8] tape/media_catalog: add helpers to look for snapshot/chunk files Dominik Csapak
2021-05-06  5:59   ` [pbs-devel] applied: " Dietmar Maurer
2021-05-05 10:09 ` [pbs-devel] [PATCH proxmox-backup v2 3/8] api2/tape/restore: factor out check_datastore_privs Dominik Csapak
2021-05-06  6:01   ` [pbs-devel] applied: " Dietmar Maurer
2021-05-05 10:09 ` [pbs-devel] [PATCH proxmox-backup v2 4/8] api2/tape/restore: remove unnecessary params from (try_)restore_snapshot_archive Dominik Csapak
2021-05-06  6:02   ` [pbs-devel] applied: " Dietmar Maurer
2021-05-05 10:09 ` [pbs-devel] [PATCH proxmox-backup v2 5/8] api2/tape/restore: return backup manifest in try_restore_snapshot_archive Dominik Csapak
2021-05-05 10:09 ` [pbs-devel] [PATCH proxmox-backup v2 6/8] api2/tape/restore: add 'restore-single' api path Dominik Csapak
2021-05-05 10:53   ` Thomas Lamprecht
2021-05-05 12:48     ` Dominik Csapak
2021-05-05 10:09 ` [pbs-devel] [PATCH proxmox-backup v2 7/8] bin/proxmox-tape: add restore-single command to proxmox-tape Dominik Csapak
2021-05-05 11:04   ` Thomas Lamprecht [this message]
2021-05-05 12:50     ` Dominik Csapak
2021-05-05 10:09 ` [pbs-devel] [PATCH proxmox-backup v2 8/8] ui: tape: add single snapshot restore Dominik Csapak

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=42acd90e-4a3f-e43b-b670-845ff1a77173@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 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