admin管理员组文章数量:1567261
零 修订记录
序号 | 修订内容 | 修订时间 |
---|---|---|
1 | 新增 (从老博客搬迁过来) | 20210721 |
一 摘要
本文主要介绍openstack 镜像制作,包括支持ceph 集群的镜像制作。
二 环境信息
(一)openstack 版本
openstack 部署的是ussuri 版本,操作系统centos 8.1
(二) ceph 版本
ceph 部署的nautilus 版本,操作系统是centos7.6
三 镜像制作
准备工作
操作系统放到该目录/root/software/os,制作好的镜像放到该目录/root/software/makeglance
(一) linux 系列镜像制作
3.1.1 通过vnc 方式制作
3.1.1.1 创建raw 文件
[root@ussuritest003 makeglance]# qemu-img create -f raw /root/software/makeglance/centos7.3min100G.raw 100G
Formatting '/root/software/makeglance/centos7.3min100G.raw', fmt=raw size=107374182400
[root@ussuritest003 makeglance]#
3.1.1.2 vnc 装操作系统
/usr/libexec/qemu-kvm -m 1024 -cdrom /root/software/os/CentOS-7-x86_64-DVD-1611.iso -drive file=/root/software/makeglance/centos7.3min100G.raw -boot menu=on --nographic -vnc :3
然后使用vnc 连上去,安装操作系统
3.1.1.3 上传glance镜像
如果没有用光纤交换机,万兆网卡,操作系统做小点,命令用nohup 后台运行,否则速度太慢了,预计要5个小时左右。。。
[root@ussuritest003 makeglance]# source /etc/kolla/admin-openrc.sh
[root@ussuritest003 makeglance]# openstack image create "centos7.3.1611.min100G" --file /root/software/makeglance/centos7.3min100G.raw --disk-format raw --container-format bare --public
(二)windows 系列镜像制作
3.2.1 通过vnc 方式安装
3.2.1.1 安装virtio驱动
因为win默认不支持virtio驱动,而通过openstack管理虚拟机是需要virtio驱动的。需要两个virtio驱动,一个是硬盘的,一个是网卡
rpm 包下载地址 https://fedorapeople/groups/virt/virtio-win/repo/srpms/
[root@ussuritest003 os]# rpm -ivh virtio-win-0.1.171-1.noarch.rpm
Verifying... ################################# [100%]
Preparing... ################################# [100%]
Updating / installing...
1:virtio-win-0.1.171-1 ################################# [100%]
[root@ussuritest003 os]#
安装好后相关文件存在该目录/usr/share/virtio-win
[root@ussuritest003 virtio-win]# pwd
/usr/share/virtio-win
[root@ussuritest003 virtio-win]# ll
total 374540
drwxr-xr-x 4 root root 43 Jan 7 18:35 drivers
drwxr-xr-x 2 root root 68 Jan 7 18:35 guest-agent
-rw-r--r-- 1 root root 371732480 May 21 2019 virtio-win-0.1.171.iso
-rw-r--r-- 1 root root 2949120 May 21 2019 virtio-win-0.1.171_amd64.vfd
-rw-r--r-- 1 root root 2949120 May 21 2019 virtio-win-0.1.171_servers_amd64.vfd
-rw-r--r-- 1 root root 2949120 May 21 2019 virtio-win-0.1.171_servers_x86.vfd
-rw-r--r-- 1 root root 2949120 May 21 2019 virtio-win-0.1.171_x86.vfd
lrwxrwxrwx 1 root root 22 May 21 2019 virtio-win.iso -> virtio-win-0.1.171.iso
lrwxrwxrwx 1 root root 28 May 21 2019 virtio-win_amd64.vfd -> virtio-win-0.1.171_amd64.vfd
lrwxrwxrwx 1 root root 36 May 21 2019 virtio-win_servers_amd64.vfd -> virtio-win-0.1.171_servers_amd64.vfd
lrwxrwxrwx 1 root root 35 May 21 2019 virtio-win_servers_x86.vfd -> virtio-win-0.1.171_servers__x86.vfd
lrwxrwxrwx 1 root root 26 May 21 2019 virtio-win_x86.vfd -> virtio-win-0.1.171_x86.vfd
[root@ussuritest003 virtio-win]#
3.2.1.2 创建qcow2 文件
[root@ussuritest003 makeglance]# qemu-img create -f qcow2 /root/software/makeglance/windows_server_2012_r2_x6450g.qcow2 50G
Formatting '/root/software/makeglance/windows_server_2012_r2_x6450g.qcow2', fmt=qcow2 size=53687091200 cluster_size=65536 lazy_refcounts=off refcount_bits=16
3.2.1.3 安装winserver2012 64位
这个命令参数很复杂,好好比对参数,管理密码设为集团域名@2020
参数说明
-m 1024 内存1024M
-smp 1 cpu个数为1
-localtime 使用本地时间
-cdrom windows2003_cd1.iso 光驱加载的文件为windows2003_cd1.iso
-drive file=windows2003.img.img,if=virtio 镜像文件是windows2003.img,驱动是virtio类型
-fdavirtio-win-1.1.16.vfd 软驱加载的文件是virtio-win-1.1.16.vfd
-boot d 从光驱启动
-usbdevice tablet tablet类型的USB驱动
-vnc :0 vnc连接的端口号是0
[root@ussuritest003 os]# /usr/libexec/qemu-kvm -m 4096 \
> -cdrom /root/software/os/cn_windows_server_2012_r2_x64_dvd_2707961.iso \
> -drive file=/usr/share/virtio-win/virtio-win-0.1.171.iso,media=cdrom,index=1 \
> -drive file=/root/software/makeglance/windows_server_2012_r2_x6450g.qcow2,media=disk,index=1,if=virtio,format=qcow2 \
> -fda /usr/share/virtio-win/virtio-win-0.1.171_servers_amd64.vfd \
> -boot order=dc,once=d \
> -net nic,model=virtio \
> -net user -boot c \
> -balloon virtio \
> -display vnc=:3
qemu-kvm: -balloon virtio: warning: This option is deprecated. Use '--device virtio-balloon' to enable the balloon device.
WARNING: Image format was not specified for '/usr/share/virtio-win/virtio-win-0.1.171_servers_amd64.vfd' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
[root@ussuritest003 os]#
操作系统安装过程中关键选择可以参考该博文https://www.iyunv/thread-483188-1-1.html
我的在内网不好截图,转载该博文截图,我的是winserver2012,博文是win7
本章节图片与我实际安装无关,可供参考。
下面是系统装好了,到设备管理器里安装网卡和pci 驱动
选择光驱中的netkvm更新驱动,成功后如
还有选择balloon 装pci 驱动。
3.2.1.4 qcow2 格式转为raw
[root@ussuritest003 makeglance]# qemu-img convert -f qcow2 -O raw /root/software/makeglance/windows_server_2012_r2_x6450g.qcow2 /root/software/makeglance/windows_server_2012_r2_x6450g.raw
[root@ussuritest003 makeglance]# ll -ah
total 19G
drwxr-xr-x 2 root root 134 Jan 8 09:45 .
drwxr-xr-x. 5 root root 64 Dec 8 18:57 ..
-rw-r--r-- 1 root root 100G Jan 7 10:42 centos7.3min100G.raw
-rw-r--r-- 1 root root 7.4G Jan 8 09:35 windows_server_2012_r2_x6450g.qcow2
-rw-r--r-- 1 root root 50G Jan 8 09:45 windows_server_2012_r2_x6450g.raw
[root@ussuritest003 makeglance]#
3.2.1.5 上传glance镜像
[root@ussuritest003 makeglance]# source /etc/kolla/admin-openrc.sh
[root@ussuritest003 makeglance]# openstack image create "winserver2012.min50G" --file /root/software/makeglance/windows_server_2012_r2_x6450g.raw --disk-format raw --container-format bare --public
版权声明:本文标题:openstack 制作镜像(linux和win 系列) 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://www.elefans.com/xitong/1726499023a1073033.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论