openstack 手工制作镜像

一 摘要

本文主要记录openstack 安装完成后,手工制作相关镜像。主要是在mitaka和ussuri 版本上测试验证。

二 环境信息

(一) openstack 版本

三 镜像制作

(一)linux 系列镜像制作

3.1.1 通过命令的方式制作(mitaka\ussuri 版本上均验证)

首先准备 CentOS-7-x86_64-DVD-1611.iso 镜像文件,此处存放在该目录下/root/software/os/

3.1.1.1 创建虚拟磁盘

我这里建了一个2000G 的虚拟磁盘,太大了,大家可以根据实际需求调整。

[root@ussuritmp os]# mkdir -p /root/software/makeglance
[root@ussuritmp os]# qemu-img create -f qcow2  /root/software/makeglance/centos7.3min2000G.qcow2 2000G
Formatting '/root/software/makeglance/centos7.3min2000G.qcow2', fmt=qcow2 size=2147483648000 cluster_size=65536 lazy_refcounts=off refcount_bits=16

3.1.1.2 系统安装

[root@ussuritmp os]# /usr/libexec/qemu-kvm -m 1024 -cdrom /root/software/os/CentOS-7-x86_64-DVD-1611.iso -drive file=/root/software/makeglance/centos7.3min2000G.qcow2 -boot menu=on --nographic -vnc :3

SeaBIOS (version 1.11.1-4.module_el8.1.0+248+298dec18)


iPXE (http://ipxe.org) 00:03.0 C980 PCI2.10 PnP PMM+3FF91570+3FED1570 C980
                                                                               



Press ESC for boot menu.

Booting from Hard Disk...
Boot failed: not a bootable disk

Booting from Floppy...
Boot failed: could not read the boot disk

Booting from DVD/CD...

执行完上面,然后通过vnc 连接 机器 连接地址是是机器IP:3,正常安装操作系统即可。

3.1.1.3 镜像制作

系统安装好之后,使用命令制作镜像即可。然后在前台页面里就能看到镜像了。

[root@ussuritmp makeglance]# source /etc/kolla/admin-openrc.sh 
[root@ussuritmp makeglance]# openstack image create "centos7.3min2000G.qcow2" --file /root/software/makeglance/centos7.3min2000G.qcow2 --disk-format qcow2 --container-format bare --public
+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Field            | Value                                                                                                                                                                                                                                                   |
+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| checksum         | 624a261678230fc4cc039788d299b436                                                                                                                                                                                                                        |
| container_format | bare                                                                                                                                                                                                                                                    |
| created_at       | 2020-12-08T11:27:49Z                                                                                                                                                                                                                                    |
| disk_format      | qcow2                                                                                                                                                                                                                                                   |
| file             | /v2/images/8842ad43-5506-4b0a-bef7-ab8e8211671f/file                                                                                                                                                                                                    |
| id               | 8842ad43-5506-4b0a-bef7-ab8e8211671f                                                                                                                                                                                                                    |
| min_disk         | 0                                                                                                                                                                                                                                                       |
| min_ram          | 0                                                                                                                                                                                                                                                       |
| name             | centos7.3min2000G.qcow2                                                                                                                                                                                                                                 |
| owner            | 03c7bcda596d49f99f1b97ebbd88bffa                                                                                                                                                                                                                        |
| properties       | os_hash_algo='sha512', os_hash_value='585dfb056bf735be8a563a6db98df5a09166a194003a7741c3f925adb2a9f8557b3325a85ab8a631ed08d3c88df32b9c10c167dceb425021de61f796feddd961', os_hidden='False', owner_specified.openstack.md5='624a261678230fc4cc039788d299b|
| protected        | False                                                                                                                                                                                                                                                   |
| schema           | /v2/schemas/image                                                                                                                                                                                                                                       |
| size             | 5269225472                                                                                                                                                                                                                                              |
| status           | active                                                                                                                                                                                                                                                  |
| tags             |                                                                                                                                                                                                                                                         |
| updated_at       | 2020-12-08T11:28:20Z                                                                                                                                                                                                                                    |
| visibility       | public                                                                                                                                                                                                                                                  |
+------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
[root@ussuritmp makeglance]#

(二) win 系列镜像制作

/usr/libexec/qemu-kvm -m 1024 -cdrom /root/software/os/CentOS-7-x86_64-DVD-1611.iso -drive file=/root/software/makeglance/centos7.3min100G.qcow2 -boot menu=on --nographic -vnc :3

LVM

openstack image create "centos7.3.1611.min100G" --file centos7.3min100G.qcow2 --disk-format qcow2 --container-format bare --public