openstack qcow2 鏡像文件制作
一: Linux 鏡像文件生成
A. 橋接網絡設備腳本
[root@app10-051 ~]# cat /etc/qemu-ifup
#!/bin/bash
# 橋接網絡設備
switch=br0
if [ -n $1 ];then
ip link set $1 up
brctl addif ${switch} $1
exit 0
else
echo "no interface!"
exit 1
fi
創建qcow2文件
qemu-img create -f qcow2 centos_6.5.qcow2 20G
制作linux鏡像
/usr/libexec/qemu-kvm -m 1024 -cdrom iso/CentOS-6.5-x86_64-minimal.iso -drive file=centos6.5-30G.qcow2,if=virtio -net nic,model=virtio -net tap,script=no -boot d -nographic -vnc :0
啟動已制作的linux鏡像
/usr/libexec/qemu-kvm -m 4096 -drive file=CentOS6.5-x86_64-30G.qcow2,if=virtio -net nic,model=virtio -net tap -nographic -vnc :0
二:制作windows鏡像
/usr/libexec/qemu-kvm -m 2048 -cdrom iso/cn_windows_7_ultimate_x64_dvd_x15-66043.iso \
-drive file=virtio-win-0.1-74.iso,media=cdrom -drive file=win7.qcow2,if=virtio \
-net nic,model=e1000 -net tap,ifname=tap2,script=no -boot d -nographic -vnc :2