public inbox for pbs-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/5] api2/tape/drive: add state to DriveListEntry
Date: Tue,  2 Mar 2021 12:19:36 +0100	[thread overview]
Message-ID: <20210302111940.17276-1-d.csapak@proxmox.com> (raw)

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

diff --git a/src/api2/tape/drive.rs b/src/api2/tape/drive.rs
index 6ef6a78b..f3cb1470 100644
--- a/src/api2/tape/drive.rs
+++ b/src/api2/tape/drive.rs
@@ -64,6 +64,7 @@ use crate::{
             open_drive,
             lock_tape_device,
             set_tape_device_state,
+            get_tape_device_state,
         },
         changer::update_changer_online_status,
     },
@@ -1223,7 +1224,8 @@ pub fn list_drives(
         }
 
         let info = lookup_device_identification(&linux_drives, &drive.path);
-        let entry = DriveListEntry { config: drive, info };
+        let state = get_tape_device_state(&config, &drive.name)?;
+        let entry = DriveListEntry { config: drive, info, state };
         list.push(entry);
     }
 
diff --git a/src/api2/types/tape/drive.rs b/src/api2/types/tape/drive.rs
index 067fdeba..2fd480ac 100644
--- a/src/api2/types/tape/drive.rs
+++ b/src/api2/types/tape/drive.rs
@@ -99,6 +99,9 @@ pub struct DriveListEntry {
     pub config: LinuxTapeDrive,
     #[serde(flatten)]
     pub info: OptionalDeviceIdentification,
+    /// the state of the drive if locked
+    #[serde(skip_serializing_if="Option::is_none")]
+    pub state: Option<String>,
 }
 
 #[api()]
-- 
2.20.1





             reply	other threads:[~2021-03-02 11:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-02 11:19 Dominik Csapak [this message]
2021-03-02 11:19 ` [pbs-devel] [PATCH proxmox-backup 2/5] ui: tape: refactor renderDriveState to Utils Dominik Csapak
2021-03-02 11:19 ` [pbs-devel] [PATCH proxmox-backup 3/5] ui: tape/DriveStatus: add more status lines Dominik Csapak
2021-03-02 11:19 ` [pbs-devel] [PATCH proxmox-backup 4/5] ui: tape/DriveStatus: add state to Info panel Dominik Csapak
2021-03-02 11:19 ` [pbs-devel] [PATCH proxmox-backup 5/5] ui: tape/DriveStatus: use the drive state to determine a status-load 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=20210302111940.17276-1-d.csapak@proxmox.com \
    --to=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