Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[807] Do not stop initialization if disk is not available v2.0 #809

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Bob versions changelog


#### Fixed

- Do not propagate an initialization error when it is determined that the disk is not available (#807)
- Fix crash in hardware metrics when disk is not available (#812)

#### Updated

Expand Down
3 changes: 2 additions & 1 deletion bob-backend/src/pearl/disk_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,14 +351,15 @@ impl DiskController {
}

async fn groups_run_initialized(&self, pp: impl Hooks) -> AnyResult<()> {
let res = {
let mut res = {
let _permit = self.run_sem.acquire().await.expect("Semaphore is closed");
Self::run_groups(self.groups.clone(), pp).await
};
if let Err(e) = &res {
error!("Can't run groups on disk {:?} (reason: {})", self.disk, e);
if !Self::is_work_dir_available(self.disk.path()) {
self.change_state(GroupsState::NotReady).await;
res = Ok(());
}
} else {
self.change_state(GroupsState::Ready).await;
Expand Down
24 changes: 17 additions & 7 deletions bob/src/hw_metrics_collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,30 @@ impl HWMetricsCollector {
}

fn collect_used_disks(disks: &[DiskPath]) -> HashMap<PathBuf, String> {
System::new_all()
System::new_with_specifics(RefreshKind::new().with_disks_list().with_disks())
.disks()
.iter()
.filter_map(|d| {
let path = d.mount_point();
let path_metadata = match path.metadata() {
Ok(meta) => meta,
Err(err) => {
warn!("Can't get metadata from OS for disk '{}' returned by 'sysinfo': {:?}", path.display(), err);
idruzhitskiy marked this conversation as resolved.
Show resolved Hide resolved
return None;
}
};
disks
.iter()
.find(move |dp| {
let dp_md = Path::new(dp.path())
.metadata()
.expect("Can't get metadata from OS");
let p_md = path.metadata()
.expect("Can't get metadata from OS");
p_md.dev() == dp_md.dev()
match Path::new(dp.path()).metadata() {
Ok(dp_metadata) => {
path_metadata.dev() == dp_metadata.dev()
},
Err(err) => {
warn!("Can't get metadata from OS for disk '{}' specified in cluster config: {:?}", dp.path(), err);
false
}
}
})
.map(|config_disk| {
let diskpath = path.to_str().expect("Not UTF-8").to_owned();
Expand Down
Loading