]> git.proxmox.com Git - proxmox-backup.git/blob - pbs-api-types/src/zfs.rs
move acl to pbs_config workspaces, pbs_api_types cleanups
[proxmox-backup.git] / pbs-api-types / src / zfs.rs
1 use serde::{Deserialize, Serialize};
2
3 use proxmox::api::{api, schema::*};
4
5 use proxmox::const_regex;
6
7 const_regex! {
8 pub ZPOOL_NAME_REGEX = r"^[a-zA-Z][a-z0-9A-Z\-_.:]+$";
9 }
10
11 pub const ZFS_ASHIFT_SCHEMA: Schema = IntegerSchema::new(
12 "Pool sector size exponent.")
13 .minimum(9)
14 .maximum(16)
15 .default(12)
16 .schema();
17
18 pub const ZPOOL_NAME_SCHEMA: Schema = StringSchema::new("ZFS Pool Name")
19 .format(&ApiStringFormat::Pattern(&ZPOOL_NAME_REGEX))
20 .schema();
21
22 #[api(default: "On")]
23 #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
24 #[serde(rename_all = "lowercase")]
25 /// The ZFS compression algorithm to use.
26 pub enum ZfsCompressionType {
27 /// Gnu Zip
28 Gzip,
29 /// LZ4
30 Lz4,
31 /// LZJB
32 Lzjb,
33 /// ZLE
34 Zle,
35 /// ZStd
36 ZStd,
37 /// Enable compression using the default algorithm.
38 On,
39 /// Disable compression.
40 Off,
41 }
42
43 #[api()]
44 #[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
45 #[serde(rename_all = "lowercase")]
46 /// The ZFS RAID level to use.
47 pub enum ZfsRaidLevel {
48 /// Single Disk
49 Single,
50 /// Mirror
51 Mirror,
52 /// Raid10
53 Raid10,
54 /// RaidZ
55 RaidZ,
56 /// RaidZ2
57 RaidZ2,
58 /// RaidZ3
59 RaidZ3,
60 }
61
62 #[api()]
63 #[derive(Debug, Serialize, Deserialize)]
64 #[serde(rename_all="kebab-case")]
65 /// zpool list item
66 pub struct ZpoolListItem {
67 /// zpool name
68 pub name: String,
69 /// Health
70 pub health: String,
71 /// Total size
72 pub size: u64,
73 /// Used size
74 pub alloc: u64,
75 /// Free space
76 pub free: u64,
77 /// ZFS fragnentation level
78 pub frag: u64,
79 /// ZFS deduplication ratio
80 pub dedup: f64,
81 }