上传镜像到存储
邮储实际应用:
1. 创建镜像id
glance image-create --name "AX76-FT-150G-20210123"
--disk-format raw
--container-format bare --visibility public --protected False
--property hw_qemu_guest_agent=yes --property os_type="linux"
--property os_distro="corros" --property os_version="0.5.1"
--property hw_vif_multiqueue_enabled=true
--property ctcm_enabled=true --progress
参数说明:
--name 镜像名称,按照镜像实际名称命名即可
其他参数不用更改
2. 上传镜像到ceph
glance image-upload --file /root/sc_image/AX76-FT-150G-202101.raw --backend netapp_A300_FC_az1_001 b1864532-af50-414e-a33a-a490e43e9b70 --progress
- --backend值改为ceph 空格后面为镜像id
- 如果是qcow2的镜像文件需要用以下命令进行转换,其他条件同理
qemu-img convert -f qcow2 -O raw CentOS-6.9.qcow2 CentOS-6.9.raw
3. 镜像分发到存储后端
使用说明
镜像分发命令行:
[root@controller ~]# glance help image-distribute
usage: glance image-distribute <IMAGE_ID> <DEST_IMAGE_ID> <backends>
[<backends> ...] <VOLUME_SIZE>
Distribute image to specific backends.
Positional arguments:
<IMAGE_ID> ID of src image to distribute. //使用该镜像在cinder中创建可启动盘
<DEST_IMAGE_ID> ID of dest image to add location to. //将创建出的可启动盘添加到location,注册到此镜像,作为生产用的镜像
<backends> Backends to distribute image to. //glance stores-info返回的store id,store必须是cinder类型的,使用<IMAGE_ID>镜像在这些backends所对应的cinder-volume上创建可启动卷
<VOLUME_SIZE> Size in GiB of volume to be created in cinder. //指定在cinder中创建可启动卷的大小,一般设置为镜像文件的virtual_size
<backends> 可使用cinder type-list查询
设置镜像VOLUME_SIZE大小时,使用qemu-img info命令先查询大小 例如是23.3G取整为24G即可
使用说明:
glance要对接ceph rbd块存储,并配置为镜像默认存储。
先通过glance image-create命令创建镜像IMAGE_ID,container_format是bare,disk_format是raw,将此镜像上传到ceph rbd块存储中。
之后通过glance image-distribute命令将镜像分发到各个后端存储中,保存为镜像卷。
DEST_IMAGE_ID和IMAGE_ID设置为同一个。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
· 什么是nginx的强缓存和协商缓存
· 一文读懂知识蒸馏