}
f->close_section();
} else if (admin_command == "smart") {
- probe_smart(ss);
+ string devid;
+ cmd_getval(cct, cmdmap, "devid", devid);
+ probe_smart(devid, ss);
} else if (admin_command == "list_devices") {
set<string> devnames;
store->get_devices(&devnames);
assert(r == 0);
- r = admin_socket->register_command("smart", "smart",
+ r = admin_socket->register_command("smart", "smart name=devid,type=CephString,req=False",
asok_hook,
"probe OSD devices for SMART data.");
"compact object store's omap. "
"WARNING: Compaction probably slows your requests",
"osd", "rw", "cli,rest")
-COMMAND("smart",
+COMMAND("smart name=devid,type=CephString,req=False",
"runs smartctl on this osd devices. ",
"osd", "rw", "cli,rest")
};
}
else if (prefix == "smart") {
- probe_smart(ds);
+ string devid;
+ cmd_getval(cct, cmdmap, "devid", devid);
+ probe_smart(devid, ds);
}
else {
}
}
-void OSD::probe_smart(ostream& ss)
+void OSD::probe_smart(const string& only_devid, ostream& ss)
{
set<string> devnames;
store->get_devices(&devnames);
uint64_t smart_timeout = cct->_conf->get_val<uint64_t>(
"osd_smart_report_timeout");
- std::string result;
// == typedef std::map<std::string, mValue> mObject;
json_spirit::mObject json_map;
<< dendl;
continue;
}
+ if (only_devid.size() && devid != only_devid) {
+ continue;
+ }
+
+ std::string result;
if (probe_smart_device(("/dev/" + dev).c_str(), smart_timeout, &result)) {
dout(10) << "probe_smart_device failed for /dev/" << dev << dendl;
- continue;
+ //continue;
+ result = "{\"error\": \"smartctl failed\", \"dev\": \"" + dev + "\"}";
}
// TODO: change to read_or_throw?