Skip to content

Commit

Permalink
Merge pull request #44221 from BenoitKnecht/ceph-mon-device-metrics
Browse files Browse the repository at this point in the history
mon: Abort device health when device not found

Reviewed-by: Yaarit Hatuka <yaarit@redhat.com>
  • Loading branch information
yuriw committed Jan 10, 2022
2 parents 5f50e31 + 96de1c9 commit 0a23e6d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/mon/Monitor.cc
Expand Up @@ -421,6 +421,11 @@ int Monitor::do_admin_command(
cmd_getval(cmdmap, "devid", want_devid);

string devname = store->get_devname();
if (devname.empty()) {
err << "could not determine device name for " << store->get_path();
r = -ENOENT;
goto abort;
}
set<string> devnames;
get_raw_devices(devname, &devnames);
json_spirit::mObject json_map;
Expand Down
4 changes: 4 additions & 0 deletions src/mon/MonitorDBStore.h
Expand Up @@ -57,6 +57,10 @@ class MonitorDBStore
return devname;
}

std::string get_path() {
return path;
}

std::shared_ptr<PriorityCache::PriCache> get_priority_cache() const {
return db->get_priority_cache();
}
Expand Down
5 changes: 4 additions & 1 deletion systemd/ceph-mon@.service.in
Expand Up @@ -20,7 +20,10 @@ LockPersonality=true
MemoryDenyWriteExecute=true
# Need NewPrivileges via `sudo smartctl`
NoNewPrivileges=false
PrivateDevices=yes
# We need access to block devices to check the health of the disk backing the
# monitor DB store. It can be set to `true` if you're not interested in that
# feature.
PrivateDevices=false
PrivateTmp=true
ProtectControlGroups=true
ProtectHome=true
Expand Down

0 comments on commit 0a23e6d

Please sign in to comment.