使用方法 本节主要介绍Glance使用HBlock卷的方法。 1. 修改Glance的配置文件/etc/glance/glanceapi.conf,修改enabledbackends,支持使用Cinder作为Glance的后端存储,同时通过cindervolumetype来指定卷类型。 plaintext [DEFAULT] showimagedirecturl True enabledbackends"file:file,cindera:cinder,cinderb:cinder" [glancestore] storesfile,cindera,cinderb defaultbackendfile [file] filesystemstoredatadir /opt/stack/data/glance/images/ [osglancetasksstore] filesystemstoredatadir /opt/stack/data/glance/tasksworkdir [osglancestagingstore] filesystemstoredatadir /opt/stack/data/glance/staging [cindera] cinderosregionnameRegionOne cinderstoreauthaddress cinderstoreusernamecinder cinderstorepasswordnomoresecret cinderstoreprojectnameservice cindervolumetypehblocka cinderenforcemultipathTrue cinderusemultipathTrue rootwrapconfig /etc/cinder/rootwrap.conf [cinderb] cinderosregionnameRegionOne cinderstoreauthaddress cinderstoreusernamecinder cinderstorepasswordnomoresecret cinderstoreprojectnameservice cindervolumetypehblockb cinderenforcemultipathTrue cinderusemultipathTrue rootwrapconfig /etc/cinder/rootwrap.conf 部分参数描述,具体详细参数请参考OpenStack官网。 参数 描述 showimagedirecturl 是否允许通过直接url的方式表示镜像。 取值: True。 False。 说明 在使用Stor Cinder进行镜像创建卷的场景下,支持采用克隆方式进行底层处理。如果使用克隆进行底层处理,必须配置此项,且该项取值为True。 enabledbackends 存储标识符和存储类型。配置形式为key :value 。value的合法值为file、rbd、http、swift、cinder。key为defaultbackend的值。 说明 可以一次配置多个key :value ,以英文逗号隔开,如key1 :value1 ,key1 :value2 。enabledbackends中的每一个key 都需要有一个单独的一个配置组[key],配置组中需要配置该配置的所有详细配置项。 defaultbackend 必须为enabledbackends中的key。 cinderosregionname 从服务目录中查找cinder服务的区域名称。 cinderstoreauthaddress Openstack实际的identity服务url,对应的账户密码需找管理员获取。在PackStack部署模式下,此值为类似的地址: cinderstoreusername OpenStack鉴权账户名。 cinderstorepassword OpenStack鉴权密码。 cinderstoreprojectname 镜像卷存储在Cinder中的项目名称。 cindervolumetype 在Cinder中创建卷的卷类型。 cinderenforcemultipath 如果它被设置为True,则当Multipathd未运行时,镜像传输的卷附加将中止。 取值: True。 False。 说明 如果HBlock集群版,需要配置为True,如果HBlock单机版,配置为False。仅在cinderusemultipath设置为True时,才将此字段设置为True。 cinderusemultipath 在部署中支持用于识别Mutipath的标记。 如果不支持多路径,则将其设置为False。 True:Cinder使用多路径。 False:Cinder不使用多路径。 说明 如果HBlock集群版,需要配置为True,如果HBlock单机版,配置为False。 rootwrapconfig 用于以root用户身份运行命令的rootwrap配置文件的路径。 Cinder存储需要root特权才能运行镜像卷(用于连接到 iSCSI/FC 卷以及读/写卷数据等)。配置文件应允许cinder store和osbrick库所需的命令。 注意 注意:以下仅为示例,请按照实际的OpenStack环境信息进行填写。 plaintext [DEFAULT] showimagedirecturl True enabledbackends"file:file,cinder:cinder,cinderstor8:cinder" [glancestore] storesfile,cinder defaultbackendfile [file] filesystemstoredatadir /opt/stack/data/glance/images/ [osglancetasksstore] filesystemstoredatadir /opt/stack/data/glance/tasksworkdir [osglancestagingstore] filesystemstoredatadir /opt/stack/data/glance/staging [cinder] cinderosregionnameRegionOne cinderstoreauthaddress