"rename <srcpool> to <destpool>", "osd", "rw", "cli,rest")
COMMAND("osd pool get " \
"name=pool,type=CephPoolname " \
- "name=var,type=CephChoices,strings=size|min_size|pg_num|pgp_num|crush_rule|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|target_max_objects|target_max_bytes|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile|min_read_recency_for_promote|all|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority|compression_mode|compression_algorithm|compression_required_ratio|compression_max_blob_size|compression_min_blob_size|csum_type|csum_min_block|csum_max_block|allow_ec_overwrites", \
+ "name=var,type=CephChoices,strings=size|min_size|pg_num|pgp_num|crush_rule|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|target_max_objects|target_max_bytes|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|erasure_code_profile|min_read_recency_for_promote|all|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority|compression_mode|compression_algorithm|compression_required_ratio|compression_max_blob_size|compression_min_blob_size|csum_type|csum_min_block|csum_max_block|allow_ec_overwrites|fingerprint_algorithm", \
"get pool parameter <var>", "osd", "r", "cli,rest")
COMMAND("osd pool set " \
"name=pool,type=CephPoolname " \
- "name=var,type=CephChoices,strings=size|min_size|pg_num|pgp_num|crush_rule|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|min_read_recency_for_promote|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority|compression_mode|compression_algorithm|compression_required_ratio|compression_max_blob_size|compression_min_blob_size|csum_type|csum_min_block|csum_max_block|allow_ec_overwrites " \
+ "name=var,type=CephChoices,strings=size|min_size|pg_num|pgp_num|crush_rule|hashpspool|nodelete|nopgchange|nosizechange|write_fadvise_dontneed|noscrub|nodeep-scrub|hit_set_type|hit_set_period|hit_set_count|hit_set_fpp|use_gmt_hitset|target_max_bytes|target_max_objects|cache_target_dirty_ratio|cache_target_dirty_high_ratio|cache_target_full_ratio|cache_min_flush_age|cache_min_evict_age|min_read_recency_for_promote|min_write_recency_for_promote|fast_read|hit_set_grade_decay_rate|hit_set_search_last_n|scrub_min_interval|scrub_max_interval|deep_scrub_interval|recovery_priority|recovery_op_priority|scrub_priority|compression_mode|compression_algorithm|compression_required_ratio|compression_max_blob_size|compression_min_blob_size|csum_type|csum_min_block|csum_max_block|allow_ec_overwrites|fingerprint_algorithm " \
"name=val,type=CephString " \
"name=force,type=CephChoices,strings=--yes-i-really-mean-it,req=false", \
"set pool parameter <var> to <val>", "osd", "rw", "cli,rest")
RECOVERY_PRIORITY, RECOVERY_OP_PRIORITY, SCRUB_PRIORITY,
COMPRESSION_MODE, COMPRESSION_ALGORITHM, COMPRESSION_REQUIRED_RATIO,
COMPRESSION_MAX_BLOB_SIZE, COMPRESSION_MIN_BLOB_SIZE,
- CSUM_TYPE, CSUM_MAX_BLOCK, CSUM_MIN_BLOCK };
+ CSUM_TYPE, CSUM_MAX_BLOCK, CSUM_MIN_BLOCK, FINGERPRINT_ALGORITHM };
std::set<osd_pool_get_choices>
subtract_second_from_first(const std::set<osd_pool_get_choices>& first,
{"csum_type", CSUM_TYPE},
{"csum_max_block", CSUM_MAX_BLOCK},
{"csum_min_block", CSUM_MIN_BLOCK},
+ {"fingerprint_algorithm", FINGERPRINT_ALGORITHM},
};
typedef std::set<osd_pool_get_choices> choices_set_t;
case CSUM_TYPE:
case CSUM_MAX_BLOCK:
case CSUM_MIN_BLOCK:
+ case FINGERPRINT_ALGORITHM:
pool_opts_t::key_t key = pool_opts_t::get_opt_desc(i->first).key;
if (p->opts.is_set(key)) {
if(*it == CSUM_TYPE) {
case CSUM_TYPE:
case CSUM_MAX_BLOCK:
case CSUM_MIN_BLOCK:
+ case FINGERPRINT_ALGORITHM:
for (i = ALL_CHOICES.begin(); i != ALL_CHOICES.end(); ++i) {
if (i->second == *it)
break;
ss << "error parsing int value '" << val << "': " << interr;
return -EINVAL;
}
+ } else if (var == "fingerprint_algorithm") {
+ if (!unset) {
+ auto alg = pg_pool_t::get_fingerprint_from_str(val);
+ if (!alg) {
+ ss << "unrecognized fingerprint_algorithm '" << val << "'";
+ return -EINVAL;
+ }
+ }
}
pool_opts_t::opt_desc_t desc = pool_opts_t::get_opt_desc(var);
("csum_max_block", pool_opts_t::opt_desc_t(
pool_opts_t::CSUM_MAX_BLOCK, pool_opts_t::INT))
("csum_min_block", pool_opts_t::opt_desc_t(
- pool_opts_t::CSUM_MIN_BLOCK, pool_opts_t::INT));
+ pool_opts_t::CSUM_MIN_BLOCK, pool_opts_t::INT))
+ ("fingerprint_algorithm", pool_opts_t::opt_desc_t(
+ pool_opts_t::FINGERPRINT_ALGORITHM, pool_opts_t::STR));
bool pool_opts_t::is_opt_name(const std::string& name) {
return opt_mapping.count(name);
out << it->first;
}
}
+ if (p.get_fingerprint_type() != pg_pool_t::TYPE_FINGERPRINT_NONE) {
+ out << " fingerprint_algorighm " << p.get_fingerprint_name();
return out;
}
CSUM_TYPE,
CSUM_MAX_BLOCK,
CSUM_MIN_BLOCK,
+ FINGERPRINT_ALGORITHM,
};
enum type_t {
pool_opts_t opts; ///< options
+ typedef enum {
+ TYPE_FINGERPRINT_NONE = 0,
+ TYPE_FINGERPRINT_SHA1 = 1,
+ } fingerprint_t;
+ static fingerprint_t get_fingerprint_from_str(const string& s) {
+ if (s == "none")
+ return TYPE_FINGERPRINT_NONE;
+ if (s == "sha1")
+ return TYPE_FINGERPRINT_SHA1;
+ return (fingerprint_t)-1;
+ }
+ const fingerprint_t get_fingerprint_type() const {
+ string fp_str;
+ opts.get(pool_opts_t::FINGERPRINT_ALGORITHM, &fp_str);
+ return get_fingerprint_from_str(fp_str);
+ }
+ const char *get_fingerprint_name() const {
+ string fp_str;
+ fingerprint_t fp_t;
+ opts.get(pool_opts_t::FINGERPRINT_ALGORITHM, &fp_str);
+ fp_t = get_fingerprint_from_str(fp_str);
+ return get_fingerprint_name(fp_t);
+ }
+ static const char *get_fingerprint_name(fingerprint_t m) {
+ switch (m) {
+ case TYPE_FINGERPRINT_NONE: return "none";
+ case TYPE_FINGERPRINT_SHA1: return "sha1";
+ default: return "unknown";
+ }
+ }
+
/// application -> key/value metadata
map<string, std::map<string, string>> application_metadata;