1. 概述數據庫
紅帽公司推出了混合雲CloudForms解決方案,redhat的宗旨在於經過CloudForms可以管理全部的基礎架構設施如RHEV,VMware和雲(AWS和OpenStack),實現集中化管理平臺。CloudForms由Engine引擎,VMDB虛擬數據庫等組成,其中Engine做爲CloudForms中核心功能,負責CloudForms的平常管理工做。api
CloudForms Engine簡稱CFME,是一個已經制定好的虛擬機,經過部署該虛擬機,能夠快速的部署CloudForms的環境。因爲是虛擬機,根據環境的不一樣,能夠部署在不通的虛擬化平臺上,而且根據不通的虛擬化平臺,由不通的虛擬機提供,如VMware平臺,RHEV平臺,OpenStack平臺等。本文以部署在KVM爲例,講述CloudForms Egine的部署。架構
2. 經過KVM部署CloudFormsdom
創建和修改虛擬機的配置文件ide
[root@ChuangYiYuan_10_16_2_9 ~]# cp /etc/libvirt/qemu/CentOS-5.9.xml /etc/libvirt/qemu/cfme.xml
修改以下內容:ui
a、名字 <name>cfme</name>rest
b、uuid <uuid>ba845a90-8670-4b89-9451-3a111372950c</uuid> 經過uuidgen生成一個新的號碼orm
c、內存 <memory unit='KiB'>4194304</memory>xml
d、CPU <vcpu placement='static'>4</vcpu>blog
e、啓動順序 <boot dev='hd'/>
f、磁盤文件
<disk type='file' device='disk'> #磁盤類型爲file <driver name='qemu' type='qcow2' cache='none'/> #驅動類型和格式 <source file='/var/lib/libvirt/p_w_picpaths/cfme.qcow2'/> #磁盤文件路徑,從CloudForms中解壓獲取 <target dev='vda' bus='virtio'/> #磁盤名字和總線類型爲virtio <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> @@@注意,要刪除@@@,不然總線的地址會衝突 </disk> <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/p_w_picpaths/cfme_vdb.qcow2'/> #磁盤所在路徑,後續建立 <target dev='vdb' bus='virtio'/> #磁盤爲vdb </disk>
g、網卡
<interface type='network'> <mac address='52:54:00:00:00:0c'/> #mac地址 <source network='br-eth0'/> #橋接網卡,@@注意@@@此處用的是ovs的網橋,若是KVM的網橋,請修改成br0 <virtualport type='openvswitch'></virtualport> #因爲使用openvswitch網橋,須要添加,br0則不用 <model type='virtio'/> </interface>
h、VNC
<graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'> #用於VNC鏈接,防止沒有圖形界面 <listen type='address' address='0.0.0.0'/> </graphics>
修改完以後,虛擬機的配置文件內容以下:
cat /etc/libvirt/qemu/cfme.xml <domain type='kvm'> <name>cfme</name> <uuid>ba845a90-8670-4b89-9451-3a111372950c</uuid> <memory unit='KiB'>4194304</memory> <currentMemory unit='KiB'>4194304</currentMemory> <vcpu placement='static'>4</vcpu> <os> <type arch='x86_64' machine='rhel6.5.0'>hvm</type> <boot dev='hd'/> </os> <features> <acpi/> <apic/> <pae/> </features> <clock offset='utc'/> <on_poweroff>destroy</on_poweroff> <on_reboot>restart</on_reboot> <on_crash>restart</on_crash> <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/p_w_picpaths/cfme.qcow2'/> <target dev='vda' bus='virtio'/> </disk> <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none'/> <source file='/var/lib/libvirt/p_w_picpaths/cfme_vdb.qcow2'/> <target dev='vdb' bus='virtio'/> </disk> <controller type='usb' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/> </controller> <controller type='ide' index='0'> <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <interface type='network'> <mac address='52:54:00:00:00:0c'/> <source network='br-eth0'/> <virtualport type='openvswitch'></virtualport> <model type='virtio'/> </interface> <serial type='pty'> <target port='0'/> </serial> <console type='pty'> <target type='serial' port='0'/> </console> <input type='tablet' bus='usb'/> <input type='mouse' bus='ps2'/> <graphics type='vnc' port='-1' autoport='yes' listen='0.0.0.0'> <listen type='address' address='0.0.0.0'/> </graphics> <video> <model type='cirrus' vram='9216' heads='1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/> </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/> </memballoon> </devices> </domain>
2. 獲取CloudForms的虛擬機
爲了方便你們使用,我已經放置到網盤中,鏈接路徑:網盤地址:http://pan.baidu.com/s/1hrrmtec
3. 解壓CFME虛擬機
[root@foundation0 cfme]# tar -xvf cfme-rhevm-5.3-47.x86_64.rhevm master/ master/vms/ master/vms/e6b971c2-14bf-43e3-ad38-36d9702afb54/ master/vms/e6b971c2-14bf-43e3-ad38-36d9702afb54/e6b971c2-14bf-43e3-ad38-36d9702afb54.ovf p_w_picpaths/ p_w_picpaths/a2dd2ac4-7a94-4c90-9c86-6a45477cbbb9/ p_w_picpaths/a2dd2ac4-7a94-4c90-9c86-6a45477cbbb9/143fbb49-1441-4a1a-beaf-f9c6433f3566.meta p_w_picpaths/a2dd2ac4-7a94-4c90-9c86-6a45477cbbb9/143fbb49-1441-4a1a-beaf-f9c6433f3566 #CloudForms的磁盤鏡像文件,要的就是該文件 #將CFME文件拷貝至KVM虛擬機目錄,並更名字 [root@foundation0 cfme]# ll -h p_w_picpaths/a2dd2ac4-7a94-4c90-9c86-6a45477cbbb9/143fbb49-1441-4a1a-beaf-f9c6433f3566 -rwxr-xr-x 1 root root 2.0G Jan 9 2015 p_w_picpaths/a2dd2ac4-7a94-4c90-9c86-6a45477cbbb9/143fbb49-1441-4a1a-beaf-f9c6433f3566 [root@foundation0 cfme]# mv p_w_picpaths/a2dd2ac4-7a94-4c90-9c86-6a45477cbbb9/143fbb49-1441-4a1a-beaf-f9c6433f3566 /var/lib/libvirt/p_w_picpaths/cfme #基於磁盤鏡像文件,建立backing file鏈接,backing file相似於Linux下的軟連接,是一個只讀的文件,增量的寫內容,都會保存至新的文件,本文即cfme.qcow2中 [root@foundation0 cfme]# qemu-img create -f qcow2 -b /var/lib/libvirt/p_w_picpaths/cfme /var/lib/libvirt/p_w_picpaths/cfme.qcow2 Formatting '/var/lib/libvirt/p_w_picpaths/cfme.qcow2', fmt=qcow2 size=42949672960 backing_file='/var/lib/libvirt/p_w_picpaths/cfme' encryption=off cluster_size=65536 [root@foundation0 cfme]# qemu-img info /var/lib/libvirt/p_w_picpaths/cfme.qcow2 p_w_picpath: /var/lib/libvirt/p_w_picpaths/cfme.qcow2 file format: qcow2 virtual size: 40G (42949672960 bytes) disk size: 200K cluster_size: 65536 backing file: /var/lib/libvirt/p_w_picpaths/cfme #基於該文件,創建的bakcing-file,實現快速的clone #創建另一塊磁盤 [root@foundation0 cfme]# qemu-img create -f qcow2 /var/lib/libvirt/p_w_picpaths/cfme_vdb.qcow2 10G #名字和路徑,須要和配置文件中保持一致 Formatting '/var/lib/libvirt/p_w_picpaths/cfme_vdb.qcow2', fmt=qcow2 size=10737418240 encryption=off cluster_size=65536 [root@foundation0 cfme]# qemu-img info /var/lib/libvirt/p_w_picpaths/cfme_vdb.qcow2 p_w_picpath: /var/lib/libvirt/p_w_picpaths/cfme_vdb.qcow2 file format: qcow2 virtual size: 10G (10737418240 bytes) #10G的空間 disk size: 140K cluster_size: 65536
4. 啓動虛擬機,並獲取VNC的端口號
[root@foundation0 ~]# virsh create /etc/libvirt/qemu/cfme.xml #加載到KVM域內 Domain cfme created from /etc/libvirt/qemu/cfme.xml [root@foundation0 ~]# virsh Welcome to virsh, the virtualization interactive terminal. Type: 'help' for help with commands 'quit' to quit virsh # list --all Id Name State ---------------------------------------------------- 6 cfme running virsh # vncdisplay cfme #查看VNC的端口號,即5900 :0 [root@foundation0 ~]# ifconfig br-eth0 Link encap:Ethernet HWaddr 00:E0:81:DF:9C:DB inet addr:10.16.0.60 Bcast:10.16.1.255 Mask:255.255.254.0 #KVM母機的ip地址,使用該地址和VNC端口鏈接到虛擬機 inet6 addr: fe80::5849:18ff:fee2:5c4e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:351184814 errors:0 dropped:0 overruns:0 frame:0 TX packets:234038352 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:54255684244 (50.5 GiB) TX bytes:56112174185 (52.2 GiB)
5. 使用VNC客戶端鏈接至CFME虛擬機
配置成功,界面以下,默認的username:admin,password:smartvm
5. CloudForms初始化
使用admin:smartvm登錄到系統中,能夠自行初始化操做,初始化的操做包括以下內容:
選擇8,配置數據庫便可,執行1生成key,選擇內部internal,設置數據庫區域爲0,執行完以後,顯示以下
查看CloudForms的狀態信息
6. 登錄CloudForms
輸入https://10.16.1.197便可登錄至CloudForms,因爲是https,所須要確認證書,確認證書以後,將會進入到CloudForms的管理界面
輸入admin:smartvm便可登錄,登錄以後頁面內容
完畢!!!