int64_t uf = 0; // micro-f
cmd_getval(cct, cmdmap, "val", val);
- // parse string as both int and float; different fields use different types.
- n = strict_strtoll(val.c_str(), 10, &interr);
- f = strict_strtod(val.c_str(), &floaterr);
- uf = llrintl(f * (double)1000000.0);
+ // create list of properties that use SI units
+ std::set<std::string> si_items = {};
+ // create list of properties that use IEC units
+ std::set<std::string> iec_items = {"target_size_bytes"};
+
+ if (si_items.count(var)) {
+ n = strict_si_cast<int64_t>(val.c_str(), &interr);
+ } else if (iec_items.count(var)) {
+ n = strict_iec_cast<int64_t>(val.c_str(), &interr);
+ } else {
+ // parse string as both int and float; different fields use different types.
+ n = strict_strtoll(val.c_str(), 10, &interr);
+ f = strict_strtod(val.c_str(), &floaterr);
+ uf = llrintl(f * (double)1000000.0);
+ }
if (!p.is_tier() &&
(var == "hit_set_type" || var == "hit_set_period" ||
return -EINVAL;
}
}
+ } else if (var == "target_size_bytes") {
+ if (interr.length()) {
+ ss << "error parsing unit value '" << val << "': " << interr;
+ return -EINVAL;
+ }
+ if (osdmap.require_osd_release < ceph_release_t::nautilus) {
+ ss << "must set require_osd_release to nautilus or "
+ << "later before setting target_size_bytes";
+ return -EINVAL;
+ }
} else if (var == "pg_num_min") {
if (interr.length()) {
ss << "error parsing int value '" << val << "': " << interr;