multi-hdd support (fix #218) #625
1 changed files with 16 additions and 16 deletions
|
@ -287,22 +287,22 @@ fn make_data_dirs(dirs: &DataDirEnum) -> Result<Vec<DataDir>, Error> {
|
||||||
let mut ok = false;
|
let mut ok = false;
|
||||||
for dir in dirs.iter() {
|
for dir in dirs.iter() {
|
||||||
let state = match &dir.capacity {
|
let state = match &dir.capacity {
|
||||||
Some(cap) if dir.read_only == false => {
|
Some(cap) if dir.read_only == false => {
|
||||||
let capacity = cap.parse::<bytesize::ByteSize>()
|
let capacity = cap.parse::<bytesize::ByteSize>()
|
||||||
.ok_or_message("invalid capacity value")?.as_u64();
|
.ok_or_message("invalid capacity value")?.as_u64();
|
||||||
if capacity == 0 {
|
if capacity == 0 {
|
||||||
return Err(Error::Message(format!("data directory {} should have non-zero capacity", dir.path.to_string_lossy())));
|
return Err(Error::Message(format!("data directory {} should have non-zero capacity", dir.path.to_string_lossy())));
|
||||||
}
|
}
|
||||||
ok = true;
|
ok = true;
|
||||||
DataDirState::Active {
|
DataDirState::Active {
|
||||||
capacity,
|
capacity,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
None if dir.read_only == true => {
|
None if dir.read_only == true => {
|
||||||
DataDirState::ReadOnly
|
DataDirState::ReadOnly
|
||||||
}
|
}
|
||||||
_ => return Err(Error::Message(format!("data directories in data_dir should have a capacity value or be marked read_only, not the case for {}", dir.path.to_string_lossy()))),
|
_ => return Err(Error::Message(format!("data directories in data_dir should have a capacity value or be marked read_only, not the case for {}", dir.path.to_string_lossy()))),
|
||||||
};
|
};
|
||||||
data_dirs.push(DataDir {
|
data_dirs.push(DataDir {
|
||||||
path: dir.path.clone(),
|
path: dir.path.clone(),
|
||||||
state,
|
state,
|
||||||
|
|
Loading…
Reference in a new issue