glance对接nfs,cinder,swift 后端

欢迎来交流!!!!!!!!!!!!!!!


glance对接nfs后端存储

配置该主机为nfs的server端,将该云主机中的/mnt/test目录进行共享(目录不存在可自行创建)。然后配置controller节点为nfs的client端,要求将/mnt/test目录作为glance后端存储的挂载目录。

环境

系统角色ip
centos7.9nfs10.196.110.86
centos7.9controller10.196.110.32

安装步骤

安装nfs服务
[root@nfs ~]# yum -y install nfs-utils
修改NFS的配置文件 /etc/exports
[root@nfs ~]# vi /etc/exports
/mnt/test *(ro,rw,no_root_squash)

访问/mnt/test 主机用root用户身份访问该共享目录时,不映射root用户(no_root_squash),即相当于在服务器上用root身份访问该目录

(1) Ro 该主机对该共享目录有只读权限

(2) Rw 该主机对该共享目录有读写权限

(3) No_root_squash 客户机用root访问该共享文件夹时,不映射root用户

[root@nfs ~]# exportfs -r  刷新

exportfs命令
常用选项
-a 全部挂载或者全部卸载
-r 重新挂载
-u 卸载某一个目录
-v 显示共享目录
验证测试
[root@nfs ~]# showmount -e
Export list for nfs:
/mnt/test    
glance连接nfs
挂载nfs
[root@controller ~]# mount -t  nfs 10.196.110.86:/mnt/test /var/lib/glance/images/

给文件为glance用户  不然无法访问  如果不能给检测上面的配置文件
[root@controller ~]# chown glance:glance /var/lib/glance/images/

创建镜像测试是否有问题
[root@controller ~]# openstack image create cirros < cirros-0.3.4-x86_64-disk.img 
[root@controller ~]# ls /var/lib/glance/images/
8979d0ee-63b9-4ebf-be41-0a67b571675d

glance对接cinder后端存储

使glance可以使用cinder作为后端存储,将镜像存储于cinder卷中。使用cirros-0.3.4-x86_64-disk.img文件创建cirros-image镜像存储于cirros-cinder卷中,通过cirros-image镜像使用cinder卷启动盘的方式进行创建虚拟机。

环境

系统角色ip
centos7.9controller10.196.110.32

修改glance配置文件

[root@controller ~]# vi /etc/glance/glance-api.conf 
show_multiple_locations = true

[glance_store]
#stores = file,http
#demo_store = file
#filesystem_store_datadir = /var/lib/glance/images/

stores = cinder
default_store=cinder

[root@controller ~]# systemctl restart openstack-glance*

修改cinder配置文件

[root@controller ~]# vi /etc/cinder/cinder.conf 
allowed_direct_url_schemes = cinder
image_upload_use_cinder_backend = true
image_upload_use_internal_tenant = true

#重启服务
[root@controller ~]# systemctl restart openstack-cinder*

测试

[root@controller ~]# openstack image create cirros < cirros-0.3.4-x86_64-disk.img 

[root@controller ~]# cinder list 

+--------------------------------------+-----------+--------------------------------------------+------+-------------+----------+-------------+
| ID                                   | Status    | Name                                       | Size | Volume Type | Bootable | Attached to |
+--------------------------------------+-----------+--------------------------------------------+------+-------------+----------+-------------+
| 527a11ff-5a45-4d72-8bbe-8e6a2215342d | available | image-dca0685f-4261-475f-80cd-f6f868b96741 | 1    | -           | false    |             |
+--------------------------------------+-----------+--------------------------------------------+------+-------------+----------+-------------+
[root@controller ~]# 

glance对接swift后端存储

使用Swift对象存储服务,修改相应的配置文件,使对象存储Swift作为glance镜像服务的后端存储,使默认上传的镜像会在swift中创建chinaskill_glance容器。

环境

系统角色ip
centos7.9controller10.196.110.32

修改glance配置文件

[root@controller ~]# cat /etc/glance/glance-api.conf  | grep "#swift"
[root@controller ~]# vi /etc/glance/glance-api.conf 

[glance_store]
swift_store_container = glance
swift_store_create_container_on_put = true
swift_store_multi_tenant = true
swift_store_admin_tenants = service
swift_store_user = glance
swift_store_key = 000000

stores = swift
default_store=swift

[root@controller ~]# openstack-service restart glance

测试

[root@controller ~]# openstack image create test < cirros-0.3.4-x86_64-disk.img
[root@controller ~]# swift list 
chinaskill_glance_27981d9d-836f-4683-830f-975044d84e09

  • 13
    点赞
  • 54
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值