tape: add media state database
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
use std::path::Path;
|
||||
|
||||
use anyhow::Error;
|
||||
use serde_json::Value;
|
||||
|
||||
@ -14,9 +16,14 @@ use crate::{
|
||||
MtxEntryKind,
|
||||
},
|
||||
tape::{
|
||||
TAPE_STATUS_DIR,
|
||||
ElementStatus,
|
||||
OnlineStatusMap,
|
||||
Inventory,
|
||||
MediaStateDatabase,
|
||||
linux_tape_changer_list,
|
||||
mtx_status,
|
||||
mtx_status_to_online_set,
|
||||
mtx_transfer,
|
||||
},
|
||||
};
|
||||
@ -47,8 +54,7 @@ pub fn get_status(name: String) -> Result<Vec<MtxStatusEntry>, Error> {
|
||||
|
||||
let status = mtx_status(&data.path)?;
|
||||
|
||||
/* todo: update persistent state
|
||||
let state_path = Path::new(MEDIA_POOL_STATUS_DIR);
|
||||
let state_path = Path::new(TAPE_STATUS_DIR);
|
||||
let inventory = Inventory::load(state_path)?;
|
||||
|
||||
let mut map = OnlineStatusMap::new(&config)?;
|
||||
@ -57,7 +63,6 @@ pub fn get_status(name: String) -> Result<Vec<MtxStatusEntry>, Error> {
|
||||
|
||||
let mut state_db = MediaStateDatabase::load(state_path)?;
|
||||
state_db.update_online_status(&map)?;
|
||||
*/
|
||||
|
||||
let mut list = Vec::new();
|
||||
|
||||
|
21
src/api2/types/tape/media_status.rs
Normal file
21
src/api2/types/tape/media_status.rs
Normal file
@ -0,0 +1,21 @@
|
||||
use ::serde::{Deserialize, Serialize};
|
||||
|
||||
use proxmox::api::api;
|
||||
|
||||
#[api()]
|
||||
/// Media status
|
||||
#[derive(Debug, PartialEq, Copy, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
/// Media Status
|
||||
pub enum MediaStatus {
|
||||
/// Media is ready to be written
|
||||
Writable,
|
||||
/// Media is full (contains data)
|
||||
Full,
|
||||
/// Media is marked as unknown, needs rescan
|
||||
Unknown,
|
||||
/// Media is marked as damaged
|
||||
Damaged,
|
||||
/// Media is marked as retired
|
||||
Retired,
|
||||
}
|
@ -8,3 +8,6 @@ pub use drive::*;
|
||||
|
||||
mod media_pool;
|
||||
pub use media_pool::*;
|
||||
|
||||
mod media_status;
|
||||
pub use media_status::*;
|
||||
|
Reference in New Issue
Block a user