安装Xen、创建Xen虚拟机、使用Xen虚拟机过程中经(4)

安装虚拟机系统时,出现以下错误:

virt-install -n vm02-CentOS-5.5-full -r 2048 --vcpus=4 -f vm02-CentOS-5.5-full.img -s 20 --nographic -l :8088/CentOS/5.5/

[root@hdfs05 vm01-CentOS-5.5-full]# ./install_vm.sh
Would you like a fully virtualized guest (yes or no)? This will allow you to run unmodified operating systems. yes


Starting install...
Retrieving file .treeinfo 100% |=========================| 417 B 00:00
Retrieving file boot.iso. 100% |=========================| 10 MB 00:00
Creating storage file... 100% |=========================| 20 GB 00:00
virDomainCreateLinux() failed POST操作失败: (xend.err 'Device 0 (vif) could not be connected. Hotplug scripts not working.')
Domain installation may not have been
successful. If it was, you can restart your domain
by running 'virsh start vm02-CentOS-5.5-full'; otherwise, please
restart your installation.
二, 26 4月 2011 09:23:28 ERROR virDomainCreateLinux() failed POST操作失败: (xend.err 'Device 0 (vif) could not be connected. Hotplug scripts not working.')
Traceback (most recent call last):
File "/usr/bin/virt-install", line 502, in ?
main()
File "/usr/bin/virt-install", line 462, in main
dom = guest.start_install(conscb,progresscb)
File "/usr/lib/python2.4/site-packages/virtinst/Guest.py", line 813, in start_install
return self._do_install(consolecb, meter)
File "/usr/lib/python2.4/site-packages/virtinst/Guest.py", line 834, in _do_install
self.domain = self.conn.createLinux(install_xml, 0)
File "/usr/lib64/python2.4/site-packages/libvirt.py", line 573, in createLinux
if ret is None:raise libvirtError('virDomainCreateLinux() failed', conn=self)
libvirtError: virDomainCreateLinux() failed POST操作失败: (xend.err 'Device 0 (vif) could not be connected. Hotplug scripts not working.')

这是 xenbr0、vif0.0 未启动导致的问题。

重启机器后

[root@hdfs05 ~]# xend start
[root@hdfs05 ~]# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 7931 8 r----- 40.5
[root@hdfs05 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:1D:7D:48:38:1A
inet addr:10.10.111.5 Bcast:10.10.255.255 Mask:255.255.0.0
inet6 addr: fe80::21d:7dff:fe48:381a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4942 errors:0 dropped:0 overruns:0 frame:0
TX packets:111 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:681358 (665.3 KiB) TX bytes:14358 (14.0 KiB)
Memory:d8320000-d8340000

eth1 Link encap:Ethernet HWaddr 00:1D:7D:48:38:1B
inet addr:10.10.141.4 Bcast:10.10.255.255 Mask:255.255.0.0
inet6 addr: fe80::21d:7dff:fe48:381b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4970 (4.8 KiB) TX bytes:552 (552.0 b)
Memory:d8360000-d8380000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:87189 errors:0 dropped:0 overruns:0 frame:0
TX packets:87189 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:118287320 (112.8 MiB) TX bytes:118287320 (112.8 MiB)

[root@hdfs05 ~]# /etc/init.d/libvirtd
Usage: /etc/init.d/libvirtd {start|stop|status|restart|condrestart|reload}
[root@hdfs05 ~]# /etc/init.d/libvirtd status
libvirtd is stopped
[root@hdfs05 ~]# /etc/init.d/libvirtd start 启动 libvirtd 服务
Starting libvirtd daemon: [ OK ]
[root@hdfs05 ~]# ifconfig ,生成了网桥设备 virbr0
eth0 Link encap:Ethernet HWaddr 00:1D:7D:48:38:1A
inet addr:10.10.111.5 Bcast:10.10.255.255 Mask:255.255.0.0
inet6 addr: fe80::21d:7dff:fe48:381a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5082 errors:0 dropped:0 overruns:0 frame:0
TX packets:175 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:710500 (693.8 KiB) TX bytes:23050 (22.5 KiB)
Memory:d8320000-d8340000

eth1 Link encap:Ethernet HWaddr 00:1D:7D:48:38:1B
inet addr:10.10.141.4 Bcast:10.10.255.255 Mask:255.255.0.0
inet6 addr: fe80::21d:7dff:fe48:381b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4970 (4.8 KiB) TX bytes:552 (552.0 b)
Memory:d8360000-d8380000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:87613 errors:0 dropped:0 overruns:0 frame:0
TX packets:87613 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:118861744 (113.3 MiB) TX bytes:118861744 (113.3 MiB)

virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:328 (328.0 b)

[root@hdfs05 ~]# xend stop
[root@hdfs05 ~]# /etc/init.d/libvirtd stop
Stopping libvirtd daemon: [ OK ]
[root@hdfs05 ~]# /etc/init.d/libvirtd start
[root@hdfs05 ~]# xend start
[root@hdfs05 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:1D:7D:48:38:1A
inet addr:10.10.111.5 Bcast:10.10.255.255 Mask:255.255.0.0
inet6 addr: fe80::21d:7dff:fe48:381a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5508 errors:0 dropped:0 overruns:0 frame:0
TX packets:299 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:757440 (739.6 KiB) TX bytes:42402 (41.4 KiB)
Memory:d8320000-d8340000

eth1 Link encap:Ethernet HWaddr 00:1D:7D:48:38:1B
inet addr:10.10.141.4 Bcast:10.10.255.255 Mask:255.255.0.0
inet6 addr: fe80::21d:7dff:fe48:381b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:20 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:4970 (4.8 KiB) TX bytes:552 (552.0 b)
Memory:d8360000-d8380000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:91038 errors:0 dropped:0 overruns:0 frame:0
TX packets:91038 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:123483512 (117.7 MiB) TX bytes:123483512 (117.7 MiB)

virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:398 (398.0 b)

xenbr0 未启动,

查看Xend启动日志,出现错误“Link veth0 is missing”

[root@hdfs05 ~]# vim /var/log/xen/xend-debug.log
1
2 Link veth0 is missing.
3 This may be because you have reached the limit of the number of interfaces
4 that the loopback driver supports. If the loopback driver is a module, you
5 may raise this limit by passing it as a parameter (nloopbacks=<N>); if the
6 driver is compiled statically into the kernel, then you may set the parameter
7 using loopback.nloopbacks=<N> on the domain 0 kernel command line.
8

使用脚本手动启动,出现错误

[root@hdfs05 ~]# /etc/xen/scripts/network-bridge status
============================================================
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:1d:7d:48:38:1a brd ff:ff:ff:ff:ff:ff
inet 10.10.111.5/16 brd 10.10.255.255 scope global eth0
inet6 fe80::21d:7dff:fe48:381a/64 scope link
valid_lft forever preferred_lft forever
Device "xenbr0" does not exist.

[root@hdfs05 ~]# /etc/xen/scripts/network-bridge start

Link veth0 is missing.
This may be because you have reached the limit of the number of interfaces
that the loopback driver supports. If the loopback driver is a module, you
may raise this limit by passing it as a parameter (nloopbacks=<N>); if the
driver is compiled statically into the kernel, then you may set the parameter
using loopback.nloopbacks=<N> on the domain 0 kernel command line.

查看加载的模块

[root@hdfs05 ~]# lsmod | grep net
nfnetlink 40457 2 ip_nat,ip_conntrack

正常情况下的 glnode04 上是:
[root@glnode04 Xenoprof]# lsmod | grep net
netloop 40129 0
netbk 129153 0 [permanent]

手动加载模块 netbk ,netloop

[root@hdfs05 ~]# modprobe netloop
[root@hdfs05 ~]# modprobe netbk
[root@hdfs05 ~]# lsmod | grep net
netbk 129153 0 [permanent]
netloop 40129 0
nfnetlink 40457 2 ip_nat,ip_conntrack

模块加载后重启 xend,

[root@hdfs05 ~]# xend stop
[root@hdfs05 ~]# xend start 启动消耗很长时间,像死机一样,网络跟断了一样,bash关闭了,过一段时间后网络好了。
......
[root@hdfs05 ~]# ps -ef | grep xend
root 4504 1 0 09:35 ? 00:00:00 python /usr/sbin/xend start
root 4505 4504 0 09:35 ? 00:00:00 python /usr/sbin/xend start
root 4813 4773 0 09:37 pts/1 00:00:00 grep xend

开启另外一个 bash,查看设备,发现 xenbr0 设备启动了

[root@hdfs05 ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:1D:7D:48:38:1A
inet addr:10.10.111.5 Bcast:10.10.255.255 Mask:255.255.0.0
inet6 addr: fe80::21d:7dff:fe48:381a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1079 errors:0 dropped:0 overruns:0 frame:0
TX packets:80 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:158475 (154.7 KiB) TX bytes:12704 (12.4 KiB)

eth1 Link encap:Ethernet HWaddr 00:1D:7D:48:38:1B
inet addr:10.10.141.4 Bcast:10.10.255.255 Mask:255.255.0.0
inet6 addr: fe80::21d:7dff:fe48:381b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:552 (552.0 b)

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:107602 errors:0 dropped:0 overruns:0 frame:0
TX packets:107602 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:145810320 (139.0 MiB) TX bytes:145810320 (139.0 MiB)

peth0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:7926 errors:0 dropped:0 overruns:0 frame:0
TX packets:803 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1048526 (1023.9 KiB) TX bytes:140794 (137.4 KiB)
Memory:d8320000-d8340000

peth1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:278 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6444 (6.2 KiB) TX bytes:35772 (34.9 KiB)
Memory:d8360000-d8380000

vif0.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:101 errors:0 dropped:0 overruns:0 frame:0
TX packets:1098 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:17258 (16.8 KiB) TX bytes:159729 (155.9 KiB)

vif0.1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:552 (552.0 b) TX bytes:0 (0.0 b)

virbr0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
inet addr:192.168.122.1 Bcast:192.168.122.255 Mask:255.255.255.0
inet6 addr: fe80::200:ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 b) TX bytes:468 (468.0 b)

xenbr0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:629 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:107389 (104.8 KiB) TX bytes:0 (0.0 b)

xenbr1 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
UP BROADCAST RUNNING NOARP MTU:1500 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:440 (440.0 b) TX bytes:0 (0.0 b)

[root@hdfs05 ~]# xend stop
[root@hdfs05 ~]# xend start 生成的网桥设备不变,xend启动一次后,设备即生成了
[root@hdfs05 ~]# xm list
Name ID Mem(MiB) VCPUs State Time(s)
Domain-0 0 7931 8 r----- 52.0

查看网桥设备

[root@hdfs05 ~]# brctl show
bridge name bridge id STP enabled interfaces
virbr0 8000.000000000000 yes
xenbr0 8000.feffffffffff no peth0
vif0.0
xenbr1 8000.feffffffffff no peth1
vif0.1

 

############################################

(7)半虚拟化安装,选择nat上网方式、IP配置使用 DHCP 方式时,虚拟机系统安装过程卡在 TCP/IP 配置界面,停滞不前

--------------------------------------------------------------------------------------------------------

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/18672.html