赞
踩
配置该主机为nfs的server端,将该云主机中的/mnt/test目录进行共享(目录不存在可自行创建)。然后配置controller节点为nfs的client端,要求将/mnt/test目录作为glance后端存储的挂载目录。
系统 | 角色 | ip |
---|---|---|
centos7.9 | nfs | 10.196.110.86 |
centos7.9 | controller | 10.196.110.32 |
[root@nfs ~]# yum -y install nfs-utils
[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
挂载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作为后端存储,将镜像存储于cinder卷中。使用cirros-0.3.4-x86_64-disk.img文件创建cirros-image镜像存储于cirros-cinder卷中,通过cirros-image镜像使用cinder卷启动盘的方式进行创建虚拟机。
系统 | 角色 | ip |
---|---|---|
centos7.9 | controller | 10.196.110.32 |
[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*
[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 ~]#
使用Swift对象存储服务,修改相应的配置文件,使对象存储Swift作为glance镜像服务的后端存储,使默认上传的镜像会在swift中创建chinaskill_glance容器。
系统 | 角色 | ip |
---|---|---|
centos7.9 | controller | 10.196.110.32 |
[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
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。