1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
use std::net::Ipv4Addr;
use super::*;
mod impls;
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Volume {
pub id: Uuid,
pub name: VolumeName,
pub size_gi: u64,
pub fs_type: String,
pub active_location: Option<String>,
pub locations: Vec<VolumeLocation>,
pub format: Option<DateTime<Utc>>,
pub created: DateTime<Utc>,
pub modified: DateTime<Utc>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum VolumeBindingMode {
WaitForFirstConsumer,
Immediate,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct VolumeName(pub String);
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[skip_serializing_none]
pub struct VolumeLocation {
pub status: LocationVolumeStatus,
pub progress: Option<StateLocationVolumeProgress>,
pub name: String,
pub iscsi: Option<Iscsi>,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[skip_serializing_none]
pub struct Iscsi {
pub iqn: String,
pub ipv4: Option<Ipv4Addr>,
pub port: Option<u16>,
pub chap: Option<Chap>,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct Chap {
pub user: String,
pub secret: String,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StateLocationVolumeProgress {
pub bytes_synchronized: u64,
pub bytes_total: u64,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub struct LocationVolumeStatus {
pub value: StateLocationStatus,
pub msg: Option<String>,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct CreateVolumeDto {
pub name: String,
pub size_gi: u64,
pub fs_type: String,
}
#[derive(
Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, SerializeDisplay, DeserializeFromStr,
)]
pub enum VolumeFileSystem {
Ext,
Ext2,
Ext3,
Ext4,
Jfs,
Swap,
Fat,
Fat32,
}
#[derive(
Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, SerializeDisplay, DeserializeFromStr,
)]
pub enum VolumeStatus {
Ok,
Degraded,
Error,
Syncing,
Pending,
}