rbd无法map(rbd feature disable)

在jewel版本下默认开启了rbd的一些属性

1
2
[root@lab8106 ~]# ceph --show-config|grep rbd|grep features 
rbd_default_features = 61

RBD属性表:
此处输入图片的描述
61的意思是上面图中的bit码相加得到的值

对rbd进行内核的map操作

1
2
3
4
5
[root@lab8106 ~]# rbd map mytest
rbd: sysfs write failed
RBD image feature set mismatch. You can disable features unsupported by the kernel with "rbd feature disable".
In some cases useful info is found in syslog - try "dmesg | tail" or so.
rbd: map failed: (6) No such device or address

根据提示查询打印的信息

1
2
[root@lab8106 ~]# dmesg | tail
[10440.462708] rbd: image mytest: image uses unsupported features: 0x3c

这个地方提示的很清楚了,不支持的属性0x3c,0x3c是16进制的数值,换算成10进制是3*16+12=60
60的意思是不支持:

32+16+8+4 = exclusive-lock, object-map, fast-diff, deep-flatten

也就是不支持这些属性,现在动态关闭这些属性

查看当前使用的image属性

1
2
3
4
5
6
7
8
[root@lab8106 ~]# rbd info mytest
rbd image 'mytest':
size 2000 MB in 500 objects
order 22 (4096 kB objects)
block_name_prefix: rbd_data.10276b8b4567
format: 2
features: layering, exclusive-lock, object-map, fast-diff, deep-flatten
flags:

开启的属性有4个是不支持的,关闭这些属性
语法是:

rbd feature disable {poolname}/{imagename} {feature}

具体到这个测试的命令

1
2
3
4
[root@lab8106 ~]# rbd feature disable rbd/mytest deep-flatten
[root@lab8106 ~]# rbd feature disable rbd/mytest fast-diff
[root@lab8106 ~]# rbd feature disable rbd/mytest object-map
[root@lab8106 ~]# rbd feature disable rbd/mytest exclusive-lock

再次查询image的info信息

1
2
3
4
5
6
7
8
[root@lab8106 ~]# rbd info mytest
rbd image 'mytest':
size 2000 MB in 500 objects
order 22 (4096 kB objects)
block_name_prefix: rbd_data.10276b8b4567
format: 2
features: layering
flags:

可以看到已经关闭了不支持的属性
进行kernel rbd 的map的操作

1
2
[root@lab8106 ~]# rbd map mytest
/dev/rbd1

如果不想动态的关闭,那么在创建rbd之前,在配置文件中设置这个参数即可

rbd_default_features = 3

关于属性支持的,目前到内核4.6仍然只支持

layering,striping = 1 + 2

这两个属性