Merge pull request #44221 from BenoitKnecht/ceph-mon-device-metrics

mon: Abort device health when device not found

Reviewed-by: Yaarit Hatuka <yaarit@redhat.com>
This commit is contained in:
Yuri Weinstein 2022-01-10 07:56:29 -08:00 committed by GitHub
commit 0a23e6d341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -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;

View File

@ -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();
}

View File

@ -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