Cobbler PXE菜單裏沒有關於Xen虛擬機的系統版本,導入CentOS5.8系統鏡像時,已經生成一個關於Xen的distros和profiles 即centos5.8-xen-x86_64,由於Cobbler知道它不可能PXE引導物理硬件。
若是你想安裝Xen 宿主機,須要在安裝腳本ks文件%packages部分添加xen包名 "kernel-xen"、「xen」。固然這樣彷佛不太方便,你可使用命令「cobbler import」再導入一個關於xenserver宿主機的配置。
配置好ks文件,安裝方法同步驟7.3。
koan --server=172.17.10.14 --list=profiles
- looking for Cobbler at http://172.17.10.14/cobbler_api
centos5.8-xen-x86_64
centos6.4-x86_64
centos5.8-x86_64
centos6.3-x86_6
koan --server=172.17.10.14 --display --profile=centos5.8-xen-x86_64
- looking for Cobbler at http://172.17.10.14:80/cobbler_api
- reading URL: http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64
install_tree: http://172.17.10.14/cblr/links/centos5.8-xen-x86_64
name : centos5.8-xen-x86_64
distro : centos5.8-xen-x86_64
kickstart : http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64
ks_meta : tree=http://@@http_server@@/cblr/links/centos5.8-xen-x86_64
install_tree : http://172.17.10.14/cblr/links/centos5.8-xen-x86_64
kernel : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/xen/vmlinuz
initrd : /var/www/cobbler/ks_mirror/centos5.8-x86_64/p_w_picpaths/xen/initrd.img
kernel_options : ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64 ksdevice=link kssendmac lang= text
repos :
virt_ram : 512
virt_disk_driver : raw
virt_type : xenpv
virt_path :
virt_auto_boot : 0
koan --server=172.17.10.14 --virt-name=testvm --virt --profile=centos5.8-xen-x86_64
- looking for Cobbler at http://172.17.10.14/cobbler_api
- reading URL: http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64
install_tree: http://172.17.10.14/cblr/links/centos5.8-xen-x86_64
libvirtd (pid 2749) is running...
downloading initrd initrd.img to /var/lib/xen/initrd.img
url=http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-xen-x86_64/initrd.img
- reading URL: http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-xen-x86_64/initrd.img
downloading kernel vmlinuz to /var/lib/xen/vmlinuz
url=http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-xen-x86_64/vmlinuz
- reading URL: http://172.17.10.14/cobbler/p_w_picpaths/centos5.8-xen-x86_64/vmlinuz
Wed, 27 Mar 2013 16:12:17 DEBUG No conn passed to Guest, opening URI 'None'
libvir: Xen error : Domain not found: xenUnifiedDomainLookupByName
libvir: Xen error : Domain not found: xenUnifiedDomainLookupByUUID
libvir: Xen error : Domain not found: xenUnifiedDomainLookupByName
Wed, 27 Mar 2013 16:12:17 DEBUG Creating guest from:
<domain type='xen'>
<name>testvm</name>
<currentMemory>524288</currentMemory>
<memory>524288</memory>
<uuid>b0dee8f5-284b-1622-6191-2443ea10cc1c</uuid>
<os>
<type>linux</type>
<kernel>/var/lib/xen/vmlinuz</kernel>
<initrd>/var/lib/xen/initrd.img</initrd>
<cmdline>ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64 ksdevice=link kssendmac lang= text </cmdline>
</os>
<on_poweroff>destroy</on_poweroff>
<on_reboot>destroy</on_reboot>
<on_crash>destroy</on_crash>
<vcpu>1</vcpu>
<devices>
<disk type='file' device='disk'>
<source file='/var/lib/xen/p_w_picpaths/testvm-disk0'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<source bridge='xenbr0'/>
<mac address='00:16:3e:28:12:79'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
</devices>
</domain>
Wed, 27 Mar 2013 16:12:18 DEBUG Created guest, looking to see if it is running
Wed, 27 Mar 2013 16:12:18 DEBUG Saving XML boot config:
<domain type='xen'>
<name>testvm</name>
<currentMemory>524288</currentMemory>
<memory>524288</memory>
<uuid>b0dee8f5-284b-1622-6191-2443ea10cc1c</uuid>
<bootloader>/usr/bin/pygrub</bootloader>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>restart</on_crash>
<vcpu>1</vcpu>
<devices>
<disk type='file' device='disk'>
<source file='/var/lib/xen/p_w_picpaths/testvm-disk0'/>
<target dev='xvda' bus='xen'/>
</disk>
<interface type='bridge'>
<source bridge='xenbr0'/>
<mac address='00:16:3e:28:12:79'/>
</interface>
<input type='mouse' bus='xen'/>
<graphics type='vnc' port='-1' keymap='en-us'/>
</devices>
</domain>
use virt-manager or reconnect with virsh console testvm
xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 7494 4 r----- 79.0
testvm 1 512 1 r----- 86.5
xm console 1
或者
xm console testvm
Bootdata ok (command line is ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64 ksdevice=link kssendmac lang= text )
Linux version 2.6.18-308.el5xen (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-52)) #1 SMP Tue Feb 21 20:47:10 EST 2012
BIOS-provided physical RAM map:
Xen: 0000000000000000 - 0000000020800000 (usable)
No mptable found.
Built 1 zonelists. Total pages: 129529
Kernel command line: ks=http://172.17.10.14/cblr/svc/op/ks/profile/centos5.8-xen-x86_64 ksdevice=link kssendmac lang= text
Initializing CPU#0
…………略…………
Write protecting the kernel read-only data: 503k
Restarting system.
默認虛擬機配置文件在目錄/etc/xen下
xm create -c testvm
在SecureCRT顯示的啓動、登陸內容以下:
pyGRUB version 0.6
ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿
³ CentOS (2.6.18-308.el5xen) ³
³ ³
³ ³
³ ³
³ ³
³ ³
³ ³
³ ³
ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ
Use the ˜ and ™ keys to select which entry is highlighted.
Press enter to boot the selected OS, 'e' to edit the
commands before booting, 'a' to modify the kernel arguments
before booting, or 'c' for a command line.
………虛擬機啓動過程略……………
登陸界面
CentOS release 5.8 (Final)
Kernel 2.6.18-308.el5xen on an x86_64
host-d-115.sys.hexun login: root
Password:
查看虛擬機主機名
[root@host-d-115 ~]# hostname
host-d-115.sys.hexun
查看ip
[root@host-d-115 ~]# ifconfig eth0
eth0 Link encap:Ethernet HWaddr 00:16:3E:28:12:79
inet addr:172.17.188.115 Bcast:172.17.255.255 Mask:255.255.0.0
inet6 addr: fe80::216:3eff:fe28:1279/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:325 errors:0 dropped:0 overruns:0 frame:0
TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:25014 (24.4 KiB) TX bytes:1298 (1.2 KiB)
到此Xen虛擬機已經經過Cobbler安裝完畢。
《Cobbler部署指南》系列文檔下載:http://down.51cto.com/data/745895