public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pbs-devel] [PATCH proxmox-backup 1/4] docs/tape: fix some typos and improve wording
@ 2021-01-25 15:30 Dominik Csapak
  2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 2/4] tape: fix typos Dominik Csapak
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Dominik Csapak @ 2021-01-25 15:30 UTC (permalink / raw)
  To: pbs-devel

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 docs/tape-backup.rst | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/docs/tape-backup.rst b/docs/tape-backup.rst
index 3309ae6f..3c0bd2b6 100644
--- a/docs/tape-backup.rst
+++ b/docs/tape-backup.rst
@@ -1,15 +1,15 @@
 Tape Backup
 ===========
 
-Proxmox tape backup provides an easy way to store datastore contents
-to a magnetic tapes. This increases data safety because you get:
+Proxmox tape backup provides an easy way to store datastore content
+onto magnetic tapes. This increases data safety because you get:
 
 - an additional copy of the data
 - to a different media type (tape)
 - to an additional location (you can move tapes offsite)
 
-Statistics show that 95% of all restore jobs restores data from the
-last backup. Restore requests further declines the older the data
+In most restore jobs, only data from the last backup job is restored.
+Restore requests further decline the older the data
 gets. Considering this, tape backup may also help to reduce disk
 usage, because you can safely remove data from disk once archived on
 tape. This is especially true if you need to keep data for several
@@ -32,14 +32,14 @@ As of 2021, the only broadly available tape technology standard is
 `Linear Tape Open`_, and different vendors offers LTO Ultrium tape
 drives, autoloaders and LTO tape cartridges.
 
-Of cause, there are a few vendor offering proprietary drives with
+There are a few vendors offering proprietary drives with
 slight advantages in performance and capacity, but they have
-significat disadvantages:
+significant disadvantages:
 
 - proprietary (single vendor)
 - a much higher purchase cost
 
-So we currently do no test such drives.
+So we currently do not test such drives.
 
 In general, LTO tapes offer the following advantages:
 
@@ -64,14 +64,14 @@ kernel should work, but feature like hardware encryptions needs LTO4
 or later.
 
 Tape changer support is done using the Linux 'mtx' command line
-tool. So any changer devive supported by that tool work work.
+tool. So any changer device supported by that tool should work.
 
 
 Drive Performance
 ~~~~~~~~~~~~~~~~~
 
-Current LTO8 tapes provide read/write speeds up to 360MB/s. Please
-note that it still takes a minimum of 9 hours to completely write or
+Current LTO-8 tapes provide read/write speeds up to 360MB/s. This means,
+that it still takes a minimum of 9 hours to completely write or
 read a single tape (even at maximum speed).
 
 The only way to speed up that data rate is to use more than one
@@ -80,10 +80,10 @@ restore jobs while the other dives are used for backups.
 
 Also consider that you need to read data first from your datastore
 (disk). But a single spinning disk is unable to deliver data at this
-rate. We meassured a maximum rate about 60MB/s to 100MB/s in practive,
-so it takes 33 hours to read 12TB to fill up a LTO8 tape. If you want
+rate. We measured a maximum rate of about 60MB/s to 100MB/s in practice,
+so it takes 33 hours to read 12TB to fill up an LTO-8 tape. If you want
 to run your tape at full speed, please make sure that the source
-datastore is able to delive that performance (use SSDs).
+datastore is able to deliver that performance (e.g, by using SSDs).
 
 
 Terminology
@@ -105,7 +105,7 @@ Terminology
    `Code 39`_, as definded in the `LTO Ultrium Cartridge Label
    Specification`_.
 
-   You can either bye such barcode labels from your cartidge vendor,
+   You can either buy such barcode labels from your cartridge vendor,
    or print them yourself. You can use our `LTO Barcode Generator`_ App
    for that.
 
-- 
2.20.1





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

* [pbs-devel] [PATCH proxmox-backup 2/4] tape: fix typos
  2021-01-25 15:30 [pbs-devel] [PATCH proxmox-backup 1/4] docs/tape: fix some typos and improve wording Dominik Csapak
@ 2021-01-25 15:30 ` Dominik Csapak
  2021-01-26 11:42   ` Dietmar Maurer
  2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 3/4] api2/types/tape/drive: add changer_slot Dominik Csapak
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 10+ messages in thread
From: Dominik Csapak @ 2021-01-25 15:30 UTC (permalink / raw)
  To: pbs-devel

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/api2/config/drive.rs | 2 +-
 src/tape/changer/mod.rs  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/api2/config/drive.rs b/src/api2/config/drive.rs
index 54601795..7a05238b 100644
--- a/src/api2/config/drive.rs
+++ b/src/api2/config/drive.rs
@@ -101,7 +101,7 @@ pub fn get_config(
         properties: {},
     },
     returns: {
-        description: "The list of configured remotes (with config digest).",
+        description: "The list of configured drives (with config digest).",
         type: Array,
         items: {
             type: DriveListEntry,
diff --git a/src/tape/changer/mod.rs b/src/tape/changer/mod.rs
index cbcec650..f952f707 100644
--- a/src/tape/changer/mod.rs
+++ b/src/tape/changer/mod.rs
@@ -144,7 +144,7 @@ pub trait MediaChange {
     fn load_media(&mut self, label_text: &str) -> Result<(), Error> {
 
         if label_text.starts_with("CLN") {
-            bail!("unable to load media '{}' (seems top be a a cleaning units)", label_text);
+            bail!("unable to load media '{}' (seems to be a cleaning unit)", label_text);
         }
 
         let mut status = self.status()?;
-- 
2.20.1





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

* [pbs-devel] [PATCH proxmox-backup 3/4] api2/types/tape/drive: add changer_slot
  2021-01-25 15:30 [pbs-devel] [PATCH proxmox-backup 1/4] docs/tape: fix some typos and improve wording Dominik Csapak
  2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 2/4] tape: fix typos Dominik Csapak
@ 2021-01-25 15:30 ` Dominik Csapak
  2021-01-26 11:43   ` Dietmar Maurer
  2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 4/4] api2/tape/changer: reorganize api Dominik Csapak
  2021-01-26 11:42 ` [pbs-devel] [PATCH proxmox-backup 1/4] docs/tape: fix some typos and improve wording Dietmar Maurer
  3 siblings, 1 reply; 10+ messages in thread
From: Dominik Csapak @ 2021-01-25 15:30 UTC (permalink / raw)
  To: pbs-devel

so that an api user can see which drive belongs to which slot of a changer

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/api2/config/changer.rs   | 1 +
 src/api2/config/drive.rs     | 1 +
 src/api2/types/tape/drive.rs | 4 ++++
 3 files changed, 6 insertions(+)

diff --git a/src/api2/config/changer.rs b/src/api2/config/changer.rs
index c1e8c59e..3a838504 100644
--- a/src/api2/config/changer.rs
+++ b/src/api2/config/changer.rs
@@ -137,6 +137,7 @@ pub fn list_changers(
             name: changer.name,
             path: changer.path.clone(),
             changer: None,
+            changer_slot: None,
             vendor: None,
             model: None,
             serial: None,
diff --git a/src/api2/config/drive.rs b/src/api2/config/drive.rs
index 7a05238b..76092c49 100644
--- a/src/api2/config/drive.rs
+++ b/src/api2/config/drive.rs
@@ -127,6 +127,7 @@ pub fn list_drives(
             name: drive.name,
             path: drive.path.clone(),
             changer: drive.changer,
+            changer_slot: drive.changer_drive_id,
             vendor: None,
             model: None,
             serial: None,
diff --git a/src/api2/types/tape/drive.rs b/src/api2/types/tape/drive.rs
index 6e5e3b15..cc2d5d63 100644
--- a/src/api2/types/tape/drive.rs
+++ b/src/api2/types/tape/drive.rs
@@ -82,6 +82,7 @@ pub struct LinuxTapeDrive {
 
 #[api()]
 #[derive(Serialize,Deserialize)]
+#[serde(rename_all = "kebab-case")]
 /// Drive list entry
 pub struct DriveListEntry {
     /// Drive name
@@ -91,6 +92,9 @@ pub struct DriveListEntry {
     /// Associated changer device
     #[serde(skip_serializing_if="Option::is_none")]
     pub changer: Option<String>,
+    /// Slot in associated changer device
+    #[serde(skip_serializing_if="Option::is_none")]
+    pub changer_slot: Option<u64>,
     /// Vendor (autodetected)
     #[serde(skip_serializing_if="Option::is_none")]
     pub vendor: Option<String>,
-- 
2.20.1





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

* [pbs-devel] [PATCH proxmox-backup 4/4] api2/tape/changer: reorganize api
  2021-01-25 15:30 [pbs-devel] [PATCH proxmox-backup 1/4] docs/tape: fix some typos and improve wording Dominik Csapak
  2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 2/4] tape: fix typos Dominik Csapak
  2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 3/4] api2/types/tape/drive: add changer_slot Dominik Csapak
@ 2021-01-25 15:30 ` Dominik Csapak
  2021-01-26 11:48   ` Dietmar Maurer
  2021-01-26 11:42 ` [pbs-devel] [PATCH proxmox-backup 1/4] docs/tape: fix some typos and improve wording Dietmar Maurer
  3 siblings, 1 reply; 10+ messages in thread
From: Dominik Csapak @ 2021-01-25 15:30 UTC (permalink / raw)
  To: pbs-devel

add a changer listing here (copied from api2/config/changer)
and put the status and transfer api calls below that

puts the changer scan into the top level tape api
and removes the (now redundant) info from the config api path

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 src/api2/config/changer.rs      | 14 +------
 src/api2/tape/changer.rs        | 65 +++++++++++++++++++++++++++++++--
 src/api2/tape/mod.rs            |  5 +++
 src/bin/proxmox_tape/changer.rs |  2 +-
 4 files changed, 69 insertions(+), 17 deletions(-)

diff --git a/src/api2/config/changer.rs b/src/api2/config/changer.rs
index 3a838504..67c41856 100644
--- a/src/api2/config/changer.rs
+++ b/src/api2/config/changer.rs
@@ -24,7 +24,6 @@ use crate::{
     tape::{
         linux_tape_changer_list,
         check_drive_path,
-        lookup_drive,
     },
 };
 
@@ -126,14 +125,12 @@ pub fn list_changers(
 
     let (config, digest) = config::drive::config()?;
 
-    let linux_changers = linux_tape_changer_list();
-
     let changer_list: Vec<ScsiTapeChanger> = config.convert_to_typed_array("changer")?;
 
     let mut list = Vec::new();
 
     for changer in changer_list {
-        let mut entry = DriveListEntry {
+        list.push(DriveListEntry {
             name: changer.name,
             path: changer.path.clone(),
             changer: None,
@@ -141,14 +138,7 @@ pub fn list_changers(
             vendor: None,
             model: None,
             serial: None,
-        };
-        if let Some(info) = lookup_drive(&linux_changers, &changer.path) {
-            entry.vendor = Some(info.vendor.clone());
-            entry.model = Some(info.model.clone());
-            entry.serial = Some(info.serial.clone());
-        }
-
-        list.push(entry);
+        });
     }
 
     rpcenv["digest"] = proxmox::tools::digest_to_hex(&digest).into();
diff --git a/src/api2/tape/changer.rs b/src/api2/tape/changer.rs
index da620c4a..3c9662b4 100644
--- a/src/api2/tape/changer.rs
+++ b/src/api2/tape/changer.rs
@@ -10,6 +10,7 @@ use crate::{
     config,
     api2::types::{
         CHANGER_NAME_SCHEMA,
+        DriveListEntry,
         ScsiTapeChanger,
         TapeDeviceInfo,
         MtxStatusEntry,
@@ -25,6 +26,7 @@ use crate::{
             ScsiMediaChange,
             mtx_status_to_online_set,
         },
+        lookup_drive,
     },
 };
 
@@ -155,14 +157,69 @@ pub fn scan_changers(_param: Value) -> Result<Vec<TapeDeviceInfo>, Error> {
     Ok(list)
 }
 
+#[api(
+    input: {
+        properties: {},
+    },
+    returns: {
+        description: "The list of configured changers with model information.",
+        type: Array,
+        items: {
+            type: DriveListEntry,
+        },
+    },
+)]
+/// List changers
+pub fn list_changers(
+    _param: Value,
+) -> Result<Vec<DriveListEntry>, Error> {
+
+    let (config, _digest) = config::drive::config()?;
+
+    let linux_changers = linux_tape_changer_list();
+
+    let changer_list: Vec<ScsiTapeChanger> = config.convert_to_typed_array("changer")?;
+
+    let mut list = Vec::new();
+
+    for changer in changer_list {
+        let mut entry = DriveListEntry {
+            name: changer.name,
+            path: changer.path.clone(),
+            changer: None,
+            changer_slot: None,
+            vendor: None,
+            model: None,
+            serial: None,
+        };
+        if let Some(info) = lookup_drive(&linux_changers, &changer.path) {
+            entry.vendor = Some(info.vendor.clone());
+            entry.model = Some(info.model.clone());
+            entry.serial = Some(info.serial.clone());
+        }
+
+        list.push(entry);
+    }
+    Ok(list)
+}
+
 const SUBDIRS: SubdirMap = &[
     (
-        "scan",
+        "status",
+        &Router::new()
+            .get(&API_METHOD_GET_STATUS)
+    ),
+    (
+        "transfer",
         &Router::new()
-            .get(&API_METHOD_SCAN_CHANGERS)
+            .post(&API_METHOD_TRANSFER)
     ),
 ];
 
-pub const ROUTER: Router = Router::new()
+const ITEM_ROUTER: Router = Router::new()
     .get(&list_subdirs_api_method!(SUBDIRS))
-    .subdirs(SUBDIRS);
+    .subdirs(&SUBDIRS);
+
+pub const ROUTER: Router = Router::new()
+    .get(&API_METHOD_LIST_CHANGERS)
+    .match_all("name", &ITEM_ROUTER);
diff --git a/src/api2/tape/mod.rs b/src/api2/tape/mod.rs
index 8241fa05..6fbf902a 100644
--- a/src/api2/tape/mod.rs
+++ b/src/api2/tape/mod.rs
@@ -16,6 +16,11 @@ pub const SUBDIRS: SubdirMap = &[
     ("drive", &drive::ROUTER),
     ("media", &media::ROUTER),
     ("restore", &restore::ROUTER),
+    (
+        "scan-changers",
+        &Router::new()
+            .get(&changer::API_METHOD_SCAN_CHANGERS),
+    ),
 ];
 
 pub const ROUTER: Router = Router::new()
diff --git a/src/bin/proxmox_tape/changer.rs b/src/bin/proxmox_tape/changer.rs
index db7a8b9c..0479771e 100644
--- a/src/bin/proxmox_tape/changer.rs
+++ b/src/bin/proxmox_tape/changer.rs
@@ -113,7 +113,7 @@ fn list_changers(
 ) -> Result<(), Error> {
 
     let output_format = get_output_format(&param);
-    let info = &api2::config::changer::API_METHOD_LIST_CHANGERS;
+    let info = &api2::tape::changer::API_METHOD_LIST_CHANGERS;
     let mut data = match info.handler {
         ApiHandler::Sync(handler) => (handler)(param, info, rpcenv)?,
         _ => unreachable!(),
-- 
2.20.1





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

* Re: [pbs-devel] [PATCH proxmox-backup 1/4] docs/tape: fix some typos and improve wording
  2021-01-25 15:30 [pbs-devel] [PATCH proxmox-backup 1/4] docs/tape: fix some typos and improve wording Dominik Csapak
                   ` (2 preceding siblings ...)
  2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 4/4] api2/tape/changer: reorganize api Dominik Csapak
@ 2021-01-26 11:42 ` Dietmar Maurer
  3 siblings, 0 replies; 10+ messages in thread
From: Dietmar Maurer @ 2021-01-26 11:42 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

applied




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

* Re: [pbs-devel] [PATCH proxmox-backup 2/4] tape: fix typos
  2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 2/4] tape: fix typos Dominik Csapak
@ 2021-01-26 11:42   ` Dietmar Maurer
  0 siblings, 0 replies; 10+ messages in thread
From: Dietmar Maurer @ 2021-01-26 11:42 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

applied




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

* Re: [pbs-devel] [PATCH proxmox-backup 3/4] api2/types/tape/drive: add changer_slot
  2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 3/4] api2/types/tape/drive: add changer_slot Dominik Csapak
@ 2021-01-26 11:43   ` Dietmar Maurer
  2021-01-26 12:10     ` Dominik Csapak
  0 siblings, 1 reply; 10+ messages in thread
From: Dietmar Maurer @ 2021-01-26 11:43 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

I am confused. IMHO, A drive never belongs to a slot.

> On 01/25/2021 4:30 PM Dominik Csapak <d.csapak@proxmox.com> wrote:
> 
>  
> so that an api user can see which drive belongs to which slot of a changer




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

* Re: [pbs-devel] [PATCH proxmox-backup 4/4] api2/tape/changer: reorganize api
  2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 4/4] api2/tape/changer: reorganize api Dominik Csapak
@ 2021-01-26 11:48   ` Dietmar Maurer
  0 siblings, 0 replies; 10+ messages in thread
From: Dietmar Maurer @ 2021-01-26 11:48 UTC (permalink / raw)
  To: Proxmox Backup Server development discussion, Dominik Csapak

applied (without the changer_slot)




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

* Re: [pbs-devel] [PATCH proxmox-backup 3/4] api2/types/tape/drive: add changer_slot
  2021-01-26 11:43   ` Dietmar Maurer
@ 2021-01-26 12:10     ` Dominik Csapak
  2021-01-26 14:19       ` Dietmar Maurer
  0 siblings, 1 reply; 10+ messages in thread
From: Dominik Csapak @ 2021-01-26 12:10 UTC (permalink / raw)
  To: Dietmar Maurer, Proxmox Backup Server development discussion

On 1/26/21 12:43 PM, Dietmar Maurer wrote:
> I am confused. IMHO, A drive never belongs to a slot.

ok, maybe bad terminology, but a drive inside a changer
has a changer_drive_id, which corresponds to the
'entry-id' we get for the changer status
(i called that changer-slot)

what should i call it instead?

> 
>> On 01/25/2021 4:30 PM Dominik Csapak <d.csapak@proxmox.com> wrote:
>>
>>   
>> so that an api user can see which drive belongs to which slot of a changer




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

* Re: [pbs-devel] [PATCH proxmox-backup 3/4] api2/types/tape/drive: add changer_slot
  2021-01-26 12:10     ` Dominik Csapak
@ 2021-01-26 14:19       ` Dietmar Maurer
  0 siblings, 0 replies; 10+ messages in thread
From: Dietmar Maurer @ 2021-01-26 14:19 UTC (permalink / raw)
  To: Dominik Csapak, Proxmox Backup Server development discussion


> On 01/26/2021 1:10 PM Dominik Csapak <d.csapak@proxmox.com> wrote:
> 
>  
> On 1/26/21 12:43 PM, Dietmar Maurer wrote:
> > I am confused. IMHO, A drive never belongs to a slot.
> 
> ok, maybe bad terminology, but a drive inside a changer
> has a changer_drive_id, which corresponds to the
> 'entry-id' we get for the changer status
> (i called that changer-slot)
> 
> what should i call it instead?

I use "drivenum" in the code.

also see "man mtx"




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

end of thread, other threads:[~2021-01-26 14:19 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-25 15:30 [pbs-devel] [PATCH proxmox-backup 1/4] docs/tape: fix some typos and improve wording Dominik Csapak
2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 2/4] tape: fix typos Dominik Csapak
2021-01-26 11:42   ` Dietmar Maurer
2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 3/4] api2/types/tape/drive: add changer_slot Dominik Csapak
2021-01-26 11:43   ` Dietmar Maurer
2021-01-26 12:10     ` Dominik Csapak
2021-01-26 14:19       ` Dietmar Maurer
2021-01-25 15:30 ` [pbs-devel] [PATCH proxmox-backup 4/4] api2/tape/changer: reorganize api Dominik Csapak
2021-01-26 11:48   ` Dietmar Maurer
2021-01-26 11:42 ` [pbs-devel] [PATCH proxmox-backup 1/4] docs/tape: fix some typos and improve wording Dietmar Maurer

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