用vmware workstation制作cloudstack(kvm)鏡像及問題解決辦法
說明1:vmware workstation鏡像是vmdk格式
說明2:cloudstack配置文件目錄:/run/libvirt/qemu/ kvm配置文件目錄:/etc/libvirt/qemu
說明3:windows下格式轉換方法
C:\Program Files (x86)\VMware\VMware Workstation>vmware-vdiskmanager.exe -r d:\centos7.4\CentOS.vmdk -t 0 temp.vmdk
一、在vmware workstation安裝centos7.4系統
二、在系統安裝目錄找到vmdk文件,上傳到linux系統
三、kvm文件轉換
1,轉化vmdk到qcow2
qemu-img convert -f vmdk -O qcow2 temp.vmdk CentOS72.qcow2
2,下載wget https://launchpadlibrarian.net/40519715/virt-goodies_0.4.tar.gz
3,配置文件轉換,轉vmx為xml,
./vmware2libvirt -f /opt/image/CentOS.vmx > /opt/image/CentOS.xml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
<domain type = ‘kvm‘ >
<name>CentOS< / name>
<uuid>c2fbe7d6 - d8c5 - 44df - 9001 - 1632ebde8e58 < / uuid>
<memory> 1048576 < / memory>
<currentMemory> 1048576 < / currentMemory>
<vcpu> 1 < / vcpu>
<os>
< type arch = ‘i686‘ machine = ‘pc‘ >hvm< / type > #改為<type arch=‘x86_64‘ machine=‘pc‘>hvm</type>
<boot dev = ‘hd‘ / >
< / os>
<features>
<acpi / >
< / features>
<clock offset = ‘utc‘ / >
<on_poweroff>destroy< / on_poweroff>
<on_reboot>restart< / on_reboot>
<on_crash>destroy< / on_crash>
<devices>
<emulator> / usr / bin / kvm< / emulator>
<disk type = ‘file‘ device = ‘disk‘ >
<source file = ‘/opt/image/CentOS.vmdk‘ / > #改為<source file=‘/opt/image/CentOS.qcow2‘/>
<target dev = ‘hda‘ / >
< / disk>
<interface type = ‘network‘ >
<mac address = ‘00:0c:29:2e:f9:2c‘ / >
<source network = ‘default‘ / >
< / interface>
< input type = ‘mouse‘ bus = ‘ps2‘ / >
<graphics type = ‘vnc‘ port = ‘-1‘ listen = ‘127.0.0.1‘ / >
< / devices>
< / domain>
|
4,安裝所需包,並連接到/usr/bin目錄下
yum install libvirt-devel.x86_64 libvirt.x86_64
ln -s /usr/libexec/qemu-kvm /usr/bin/kvm
5,啟動kvm
virsh define Ubuntu.xml
6,啟動virt-manager:Applications->System Tools->Virtual Machine Manager
7,如圖更改配置文件
storage format:qcow2
四,利用cloudstack4.11直接轉換
可以直接上傳vmdk或vmdk轉換後的qcow2鏡像,跟磁盤控制器要選擇ide
2,啟動實例,選擇剛才上傳的模板
3,查看實例
用vmware workstation制作cloudstack(kvm)鏡像及問題解決辦法