aboutsummaryrefslogtreecommitdiff
path: root/src/model/garage.rs
diff options
context:
space:
mode:
authorAlex <alex@adnab.me>2023-09-11 10:52:01 +0000
committerAlex <alex@adnab.me>2023-09-11 10:52:01 +0000
commit7228fbfd4f62942cf0212d838446ece5ee7f8ef2 (patch)
treeef742d50efb5c3d66145f8a5583e4728c483cb9f /src/model/garage.rs
parent4b4f2000f45a83b4dad3f2a8fd8392a245a30286 (diff)
parentba7ac52c196c452e0b09fef63862264e0c4582bb (diff)
downloadgarage-7228fbfd4f62942cf0212d838446ece5ee7f8ef2.tar.gz
garage-7228fbfd4f62942cf0212d838446ece5ee7f8ef2.zip
Merge pull request 'multi-hdd support (fix #218)' (#625) from multihdd into next
Reviewed-on: https://git.deuxfleurs.fr/Deuxfleurs/garage/pulls/625
Diffstat (limited to 'src/model/garage.rs')
-rw-r--r--src/model/garage.rs20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/model/garage.rs b/src/model/garage.rs
index 981430fb..721d5e3a 100644
--- a/src/model/garage.rs
+++ b/src/model/garage.rs
@@ -92,8 +92,22 @@ impl Garage {
// Create meta dir and data dir if they don't exist already
std::fs::create_dir_all(&config.metadata_dir)
.ok_or_message("Unable to create Garage metadata directory")?;
- std::fs::create_dir_all(&config.data_dir)
- .ok_or_message("Unable to create Garage data directory")?;
+ match &config.data_dir {
+ DataDirEnum::Single(data_dir) => {
+ std::fs::create_dir_all(data_dir).ok_or_message(format!(
+ "Unable to create Garage data directory: {}",
+ data_dir.to_string_lossy()
+ ))?;
+ }
+ DataDirEnum::Multiple(data_dirs) => {
+ for dir in data_dirs {
+ std::fs::create_dir_all(&dir.path).ok_or_message(format!(
+ "Unable to create Garage data directory: {}",
+ dir.path.to_string_lossy()
+ ))?;
+ }
+ }
+ }
info!("Opening database...");
let mut db_path = config.metadata_dir.clone();
@@ -237,7 +251,7 @@ impl Garage {
config.compression_level,
data_rep_param,
system.clone(),
- );
+ )?;
block_manager.register_bg_vars(&mut bg_vars);
// ---- admin tables ----