配置块(cinder)存储服务(可选)¶
默认情况下,块(cinder)存储服务使用 LVM 后端安装在主机本身上。
注意
虽然这是 cinder 的默认设置,但使用 LVM 后端会导致单点故障。
LVM 后端需要在主机上运行,但是大多数其他后端可以部署在容器内部。如果您的环境中部署的存储后端能够在容器内运行,建议在 env.d/cinder.yml 文件中设置 is_metal: False。
注意
由于 容器系统的一个限制,在使用依赖于 iSCSI 的后端时,必须将卷服务直接部署到主机上。例如,对于配置为使用 iSCSI 协议的存储设备而言就是如此。
NFS 后端¶
如果 NetApp 后端配置为使用 NFS 存储协议,请编辑 /etc/openstack_deploy/openstack_user_config.yml 并配置每个存储节点上的 NFS 客户端。
对于每个存储节点,在新的
container_vars部分下添加一个cinder_backends块。container_vars用于允许容器/主机个性化配置。每个 cinder 后端都使用唯一的键定义。例如,nfs-volume1。这后来代表一个唯一的 cinder 后端和卷类型。container_vars: cinder_backends: nfs-volume1:
配置适当的 cinder 卷后端名称
volume_backend_name: NFS_VOLUME1
配置适当的 cinder NFS 驱动程序
volume_driver: cinder.volume.drivers.nfs.NfsDriver
配置列出对块存储服务可用的共享的文件的位置。此配置文件必须包含
nfs_shares_confignfs_shares_config: FILENAME_NFS_SHARES
将
FILENAME_NFS_SHARES替换为共享配置文件位置。例如,/etc/cinder/nfs_shares_volume1。配置 NFS 挂载的挂载选项。例如
nfs_mount_options: "rsize=65535,wsize=65535,timeo=1200,actimeo=120"
配置一个或多个 NFS 共享
shares: - { ip: "HOSTNAME", share: "PATH_TO_NFS_VOLUME" }
将
HOSTNAME替换为 NFS 服务器的 IP 地址或主机名,并将PATH_TO_NFS_VOLUME替换为现有且可访问的 NFS 共享的绝对路径(不包括 IP 地址或主机名)。
以下是名为 NFS1 的 cinder NFS 后端的完整配置示例。cinder playbook 将自动添加一个自定义 volume-type 和 nfs-volume1,如本例所示
container_vars: cinder_backends: nfs-volume1: volume_backend_name: NFS_VOLUME1 volume_driver: cinder.volume.drivers.nfs.NfsDriver nfs_shares_config: /etc/cinder/nfs_shares_volume1 nfs_mount_options: "rsize=65535,wsize=65535,timeo=1200,actimeo=120" shares: - { ip: "1.2.3.4", share: "/vol1" }
备份¶
您可以配置 cinder 将卷备份到对象存储(swift)。启用默认配置以将卷备份到您环境中可访问的 swift 安装。或者,您可以设置 cinder_service_backup_swift_url 和其他变量以备份到外部 swift 安装。
在
/etc/openstack_deploy/user_variables.yml文件中添加或编辑以下行,并将值设置为Truecinder_service_backup_program_enabled: True
默认情况下,cinder 使用发起备份的用户访问凭据。默认值设置在
/opt/openstack-ansible/playbooks/roles/os_cinder/defaults/main.yml文件中。您可以通过在/etc/openstack_deploy/user_variables.yml中设置变量来覆盖这些默认值,以更改 cinder 执行备份的方式。将以下任何变量添加到/etc/openstack_deploy/user_variables.yml文件... cinder_service_backup_swift_auth: per_user # Options include 'per_user' or 'single_user'. We default to # 'per_user' so that backups are saved to a user's swift # account. cinder_service_backup_swift_url: # This is your swift storage url when using 'per_user', or keystone # endpoint when using 'single_user'. When using 'per_user', you # can leave this as empty or as None to allow cinder-backup to # obtain a storage url from environment. cinder_service_backup_swift_url: cinder_service_backup_swift_auth_version: 2 cinder_service_backup_swift_user: cinder_service_backup_swift_tenant: cinder_service_backup_swift_key: cinder_service_backup_swift_container: volumebackups cinder_service_backup_swift_object_size: 52428800 cinder_service_backup_swift_retry_attempts: 3 cinder_service_backup_swift_retry_backoff: 2 cinder_service_backup_compression_algorithm: zlib cinder_service_backup_metadata_version: 2
在 cinder 安装期间,将配置备份服务。
如果使用 Horizon,您可能还需要显式定义
horizon_enable_cinder_backup: true并运行 horizon playbook,以在 Horizon 中启用备份面板。
使用 Ceph 进行 cinder 备份¶
您可以部署 Ceph 来保存 cinder 卷备份。要开始,请设置 cinder_service_backup_driver Ansible 变量
cinder_service_backup_driver: cinder.backup.drivers.ceph.CephBackupDriver
配置 Ceph 用户和用于备份的池。默认值如下所示
cinder_service_backup_ceph_user: cinder-backup
cinder_service_backup_ceph_pool: backups
可用区¶
创建多个可用区以管理 cinder 存储主机。编辑 /etc/openstack_deploy/openstack_user_config.yml 和 /etc/openstack_deploy/user_variables.yml 文件以设置可用区。
对于每个 cinder 存储主机,在
container_vars节下配置可用区cinder_storage_availability_zone: CINDERAZ
将
CINDERAZ替换为合适的名称。例如cinderAZ_2。如果创建了多个可用区,请通过在
/etc/openstack_deploy/user_variables.yml中创建一个cinder_default_availability_zone来配置所有主机的默认可用区cinder_default_availability_zone: CINDERAZ_DEFAULT
将
CINDERAZ_DEFAULT替换为合适的名称。例如,cinderAZ_1。默认可用区应与所有 cinder 主机相同。
OpenStack Dashboard(horizon)配置 cinder¶
您可以配置变量以设置 OpenStack Dashboard(horizon)中 cinder 卷管理的行为。默认情况下,未设置 horizon 配置。
如果您使用多个可用区并且
cinder_default_availability_zone没有定义,则默认目标可用区为nova。如果在没有名为nova的可用区的情况下进行卷创建,则 horizon 上的卷创建可能会失败。将cinder_default_availability_zone设置为合适的可用区名称,以便 horizon 中的“任何可用区”正常工作。horizon 默认情况下不会填充卷类型。在新卷页面上,使用默认参数创建卷的请求失败。设置
cinder_default_volume_type,以便在没有显式卷类型的情况下成功进行卷创建请求。您还可以配置实例启动菜单的参数,例如隐藏“创建卷”问题并始终为实例创建 Cinder 卷。为此,您可以定义以下变量
horizon_launch_instance_defaults: create_volume: True hide_create_volume: True disable_image: False disable_instance_snapshot: False disable_volume: False disable_volume_snapshot: False default_availability_zone: any
请在 Horizon 文档 中查看此参数的可用选项
配置 cinder 使用 LVM¶
列出包含目标主机存储选项的
container_vars。注意
与 cinder 可用区和
limit_container_types相关的变量是可选的。要配置 LVM,请使用以下示例
storage_hosts: Infra01: ip: 172.29.236.16 container_vars: cinder_storage_availability_zone: cinderAZ_1 cinder_default_availability_zone: cinderAZ_1 cinder_backends: lvm: volume_backend_name: LVM_iSCSI volume_driver: cinder.volume.drivers.lvm.LVMVolumeDriver volume_group: cinder-volumes iscsi_ip_address: "{{ cinder_storage_address }}" limit_container_types: cinder_volume
要使用容器而不是裸机中的另一个后端,请将 env.d/cinder.yml 复制到 /etc/openstack_deploy/env.d/cinder.yml 文件,并将 cinder_volumes_container 属性下的 is_metal: true 节更改为 is_metal: false。
或者,您可以选择性地覆盖,如下所示
container_skel:
cinder_volumes_container:
properties:
is_metal: false
配置 cinder 使用 Ceph¶
为了使 cinder 使用 Ceph,有必要为 API 和后端进行配置。当使用任何形式的网络存储(iSCSI、NFS、Ceph)作为 cinder 时,API 容器可以被视为后端服务器。不需要单独的存储主机。
将 env.d/cinder.yml 复制到 /etc/openstack_deploy/env.d/cinder.yml 文件,并将 cinder_volumes_container 属性下的 is_metal: true 节更改为 is_metal: false。
或者,您可以选择性地覆盖,如下所示
container_skel:
cinder_volumes_container:
properties:
is_metal: false
要部署 cinder API 的目标主机列表。我们建议为此服务使用至少三个目标主机。
storage-infra_hosts: infra1: ip: 172.29.236.101 infra2: ip: 172.29.236.102 infra3: ip: 172.29.236.103
要配置 RBD 后端,请使用以下示例
container_vars: cinder_storage_availability_zone: cinderAZ_3 cinder_default_availability_zone: cinderAZ_1 cinder_backends: limit_container_types: cinder_volume rbd_backend: volume_driver: cinder.volume.drivers.rbd.RBDDriver rbd_pool: volumes rbd_ceph_conf: /etc/ceph/ceph.conf rbd_flatten_volume_from_snapshot: 'false' rbd_max_clone_depth: 5 rbd_store_chunk_size: 4 rados_connect_timeout: 30 volume_backend_name: rbd_backend rbd_user: "{{ cinder_ceph_client }}" rbd_secret_uuid: "{{ cinder_ceph_client_uuid }}"
以下示例将 cinder 设置为使用 cinder_volumes 池。该示例使用 cephx 身份验证,需要为 cinder_volumes 池的 cinder 帐户。
在 user_variables.yml 中
ceph_mons: - 172.29.244.151 - 172.29.244.152 - 172.29.244.153
在 openstack_user_config.yml 中
storage_hosts: infra1: ip: 172.29.236.101 container_vars: cinder_backends: limit_container_types: cinder_volume rbd: volume_group: cinder-volumes volume_driver: cinder.volume.drivers.rbd.RBDDriver volume_backend_name: rbd rbd_pool: cinder-volumes rbd_ceph_conf: /etc/ceph/ceph.conf rbd_user: cinder infra2: ip: 172.29.236.102 container_vars: cinder_backends: limit_container_types: cinder_volume rbd: volume_group: cinder-volumes volume_driver: cinder.volume.drivers.rbd.RBDDriver volume_backend_name: rbd rbd_pool: cinder-volumes rbd_ceph_conf: /etc/ceph/ceph.conf rbd_user: cinder infra3: ip: 172.29.236.103 container_vars: cinder_backends: limit_container_types: cinder_volume rbd: volume_group: cinder-volumes volume_driver: cinder.volume.drivers.rbd.RBDDriver volume_backend_name: rbd rbd_pool: cinder-volumes rbd_ceph_conf: /etc/ceph/ceph.conf rbd_user: cinder
此链接提供了一个完整的 Ceph 设置和与 cinder(nova 和 glance 包含在内)集成的示例
配置 cinder 使用 Dell EqualLogic¶
要将 Dell EqualLogic 卷驱动程序用作后端,请编辑 /etc/openstack_deploy/openstack_user_config.yml 文件并配置将使用它的每个存储节点。
定义以下参数。
为每个存储节点在
cinder_backends下添加dellqlx节cinder_backends: delleqlx:
指定卷后端名称
volume_backend_name: DellEQLX_iSCSI
使用 Dell EQLX San ISCSI 驱动程序
volume_driver: cinder.volume.drivers.dell_emc.ps.PSSeriesISCSIDriver
指定 SAN IP 地址
san_ip: ip_of_dell_storage
指定 SAN 用户名(默认:grpadmin)
san_login: grpadmin
指定 SAN 密码
san_password: password
指定池的组名(默认:group-0)
eqlx_group_name: group-0
指定 Cinder 将创建卷和快照的池(默认:default)
eqlx_pool: default
确保
openstack_user_config.yml配置准确storage_hosts: Infra01: ip: infra_host_ip container_vars: cinder_backends: limit_container_types: cinder_volume delleqlx: volume_backend_name: DellEQLX_iSCSI volume_driver: cinder.volume.drivers.dell_emc.ps.PSSeriesISCSIDriver san_ip: ip_of_dell_storage san_login: grpadmin san_password: password eqlx_group_name: group-0 eqlx_pool: default
配置 cinder 使用 NetApp 设备¶
要使用 NetApp 存储设备后端,请编辑 /etc/openstack_deploy/openstack_user_config.yml 文件并配置将使用它的每个存储节点。
注意
确保 NAS 团队启用 httpd.admin.access。
为每个存储节点在
cinder_backends节下添加netapp节cinder_backends: netapp:
后续步骤中的选项位于
netapp节下。后端名称是任意的,并在 cinder 中成为卷类型。
配置存储系列
netapp_storage_family: STORAGE_FAMILY
将
STORAGE_FAMILY替换为ontap_7mode以使用 7 模式下的 Data ONTAP 操作系统,或ontap_cluster以使用作为集群运行的 Data ONTAP 操作系统。配置存储协议
netapp_storage_protocol: STORAGE_PROTOCOL
将
STORAGE_PROTOCOL替换为iscsi以使用 iSCSI,或nfs以使用 NFS。对于 NFS 协议,指定列出对 cinder 可用的共享的配置文件的位置
nfs_shares_config: FILENAME_NFS_SHARES
将
FILENAME_NFS_SHARES替换为共享配置文件的位置。例如,/etc/cinder/nfs_shares。配置服务器
netapp_server_hostname: SERVER_HOSTNAME
将
SERVER_HOSTNAME替换为两个 netapp 控制器的主机名。配置服务器 API 端口
netapp_server_port: PORT_NUMBER
将
PORT_NUMBER替换为 HTTP 的 80 或 HTTPS 的 443。配置服务器凭据
netapp_login: USER_NAME netapp_password: PASSWORD
将
USER_NAME和PASSWORD替换为适当的值。选择 NetApp 驱动程序
volume_driver: cinder.volume.drivers.netapp.common.NetAppDriver
配置卷后端名称
volume_backend_name: BACKEND_NAME
将
BACKEND_NAME替换为一个提供 cinder 调度器提示的值。例如,NETAPP_iSCSI。确保
openstack_user_config.yml配置准确storage_hosts: Infra01: ip: 172.29.236.16 container_vars: cinder_backends: limit_container_types: cinder_volume netapp: netapp_storage_family: ontap_7mode netapp_storage_protocol: nfs netapp_server_hostname: 111.222.333.444 netapp_server_port: 80 netapp_login: openstack_cinder netapp_password: password volume_driver: cinder.volume.drivers.netapp.common.NetAppDriver volume_backend_name: NETAPP_NFS
对于
netapp_server_hostname,指定 Data ONTAP 服务器的 IP 地址。根据配置,包括 iSCSI 或 NFS 作为netapp_storage_family。对于netapp_server_port,如果使用 HTTP,则添加 80,如果使用 HTTPS,则添加 443。cinder-volume.ymlplaybook 将自动在主机上安装nfs-common文件,从而从 LVM 转换为 NetApp 后端。
配置 cinder qos 规范¶
部署者可以选择定义变量 cinder_qos_specs 以创建 qos 规范。此变量是包含每个 qos 规范选项的字典列表。可以通过在所需的 qos 规范字典中定义键 cinder_volume_types 来将 cinder 卷类型分配给 qos 规范。
- name: high-iops
options:
consumer: front-end
read_iops_sec: 2000
write_iops_sec: 2000
cinder_volume_types:
- volumes-1
- volumes-2
- name: low-iops
options:
consumer: front-end
write_iops_sec: 100
配置 cinder 创建私有卷类型¶
默认情况下,定义的 cinder 后端将创建一个公共卷类型。为了创建一个私有卷类型,请添加变量 public 并将其设置为 false。如果设置为 true 或未设置,则创建的卷类型将是公共的。
cinder_backends:
private_type:
public: false