rbd: check value of config override when setting image-meta

Fixes: http://tracker.ceph.com/issues/15522

Signed-off-by: zhuangzeqiang <zhuang.zeqiang@h3c.com>
This commit is contained in:
zhuangzeqiang 2017-10-07 16:52:07 +08:00
parent b7afa78e22
commit 4538f8152d

View File

@ -2627,6 +2627,15 @@ remove_mirroring_image:
int metadata_set(ImageCtx *ictx, const string &key, const string &value)
{
CephContext *cct = ictx->cct;
string start = ictx->METADATA_CONF_PREFIX;
size_t conf_prefix_len = start.size();
if(key.size() > conf_prefix_len && !key.compare(0,conf_prefix_len,start)) {
string subkey = key.substr(conf_prefix_len, key.size()-conf_prefix_len);
int r = cct->_conf->set_val(subkey.c_str(), value);
if (r < 0)
return r;
}
ldout(cct, 20) << "metadata_set " << ictx << " key=" << key << " value=" << value << dendl;
int r = ictx->state->refresh_if_required();