|
1、虚拟机创建流程
2、深入理解虚拟机的磁盘、网络及Metadata
3、OpenStack虚拟机生产镜像构建实践
1.创建虚拟机硬盘
qemu-img create -f qcow2 /tmp/centos.qcow2 10G
2.创建虚拟机
virt-install --virt-type kvm --name centos --ram 1024 \
--disk /tmp/centos.qcow2,format=qcow2 \
--network network=default \
--graphics vnc,listen=0.0.0.0 --noautoconsole \
--os-type=linux --os-variant=rhel7 \
--location=/tmp/CentOS-7.2-x86_64-DVD-1511.iso
如果是桥接网卡
virt-install --virt-type kvm --name centos --ram 1024 \
--disk /tmp/centos.qcow2,format=qcow2 \
--network bridge=brqce3d2bda-d5 \
--graphics vnc,listen=0.0.0.0 --noautoconsole \
--os-type=linux --os-variant=rhel7 \
--location=/tmp/CentOS-7.2-x86_64-DVD-1511.iso
3.virsh start centos
4.安装默认需要的软件
删除mac硬编码
yum install net-tools tree screen wget git vim salt-minion zabbix-agent
内部yum源
内部DNS
shutdown -h now
5.编写/tmp/init.sh
cp /etc/rc.d/rc.local /tmp
chmod +x /etc/rc.d/rc.local
6.修改/etc/rc.d/rc.local 增加
/bin/bash /tmp/init.sh
7.上传Glance
[iyunv@linux-node1 ~]# openstack image create "CentOS-7.2-x86_64" \
> --file /tmp/centos.qcow2 \
> --disk-format qcow2 --container-format bare \
> --public
8.使用镜像创建虚拟机 |
|
|
|
|
|
|