当前位置:  开发笔记 > 编程语言 > 正文

安装、创建Xen虚拟机时经常遇到的错误和解决办法

目录(1)启动Xend时出现错误ImportError:/usr/lib/python/xen/lowlevel/acm.so:undefinedsymbol:Py_InitModule4(2)使用virt-install创建Xen虚拟机时出现错误:ERRORvirDomainCreateLinux()failedXM

目录

(1) 启动 Xend 时出现错误 ImportError: /usr /lib/python/xen/lowlevel/acm.so: undefined symbol: Py_InitModule4
(2) 使用 virt-install 创建Xen虚拟机时出现错误:ERROR virDomainCreateLinux() failed XML描述 domain 不是良好的格式或者无效
(3) virt-manager 中连接虚拟机管理者Dom 0时出现错误:虚拟机管理者连接失败 libvirtError: virConnectOpenReadOnly() failed
(4) virt-install 安装虚拟机是出现错误:ERROR    无法连接到 'localhost:8000': 拒绝连接
(5) virt-manager 安装Xen虚拟机连接网络时nat和桥接设备均为空,无法选择,安装不能继续
(6) virt-manager 或者 virt-install 安装虚拟机系统过程中出现错误:
'libvirt.libvirtError virDomainCreateLinux() failed POST操作失败: (xend.err 'Device 0 (vif) could not be connected. Hotplug scripts not working.

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

错误总结

使用 CentOS 5.2 默认安装的 Xen,启动 Xend 时出现如下错误:
(1)  启动 Xend 时出现错误 ImportError: /usr /lib/python/xen/lowlevel/acm.so: undefined symbol: Py_InitModule4
--------------------------------------------------------------------------------------
[root@glnode04 ~]# xend
Traceback (most recent call last):
  File "/usr/sbin/xend", line 51, in
    from xen.xend.server import SrvDaemon
  File "/usr/lib64/python/xen/xend/server/SrvDaemon.py", line 20, in
    import xen.lowlevel.xc
ImportError: /usr/lib64/python/xen/lowlevel/xc.so: undefined symbol: Py_InitModule4
[root@glnode04 ~]# xm list
Traceback (most recent call last):
  File "/usr/sbin/xm", line 8, in
    from xen.xm import main
  File "/usr/lib/python/xen/xm/main.py", line 45, in
    from xen.util import security
  File "/usr/lib/python/xen/util/security.py", line 25, in
    from xen.lowlevel import acm
ImportError: /usr/lib/python/xen/lowlevel/acm.so: undefined symbol: Py_InitModule4
----------------------------------------------------------------------------------------
############################################

原因分析和解决办法:
直觉是 python import 时出现的错误,查看文件/usr/sbin/xend,第51行是“from xen.xend.server import SrvDaemon”,就是这行出错。
查看 python 版本
[root@glnode04 ~]# python -V
Python 2.5
查看 python 安装路径
[root@glnode04 ~]# which python
/usr/local/bin/python
查看系统安装的 python 的rpm包版本
[root@glnode04 ~]# rpm -q python
python-2.4.3-21.el5  从这可以看出 python 版本和 rpm 包所示的版本不一致,这个 rpm 包是 CentOS 5.2 自带的.

系统是CentOS 5.2, 我们发现使用的不是CentOS 5.2 默认安装的 python,默认安装的是 Python 2.4.3,CentOS 5.2 默认将python安装在/usr/bin下。 
[root@glnode04 ~]# /usr/bin/python -V
Python 2.4.3
由此可以想到可能是环境变量 PATH 的设置导致我们在命令行执行 python 时使用的是 /usr/local/bin/python,可能是 PATH 的值中 /usr/local/bin 在 /usr/bin 之前;
检查 ~/.bashrc 发现的确如此,环境变量 PATH 设置是 export PATH=/usr/local/bin:$PATH,将其修改为
export PATH=$PATH:/usr/local/bin,然后 source ~/.bashrc,或者退出 shell,重新开启一个 shell,
测试 python ,发现使用的是默认版本。
[root@glnode04 ~]# python -V
Python 2.4.3

启动 Xend ,正常,没有问题。
[root@glnode04 ~]# xm list
Error: Unable to connect to xend: No such file or directory. Is xend running?
[root@glnode04 ~]# xend
usage: /usr/sbin/xend {start|stop|restart}
[root@glnode04 ~]# xend start
[root@glnode04 ~]# xm list
Name                                      ID Mem(MiB) VCPUs State   Time(s)
Domain-0                                   0     7931     8 r-----    463.9

分析原因,是因为 Xen 是python写的,执行 Xen 相关工具时需要调用 python 相关库,如果版本对应不一致,或者库路径不一致,则会出错。

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

(2) 使用 virt-install 创建Xen虚拟机时出现错误: ERROR virDomainCreateLinux() failed XML描述 domain 不是良好的格式或者无效

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

[root@glnode04 vm02-CentOS-5.5]# virt-install -n vm01-CentOS-5.5 -r 1024 --vcpus=4 -f vm01-CentOS-5.5.img -s 20 --nographic -l http://10.10.113.14:8888/mirrors/CentOS/5.5/

Would you like a fully virtualized guest (yes or no)?  This will allow you to run unmodified operating systems. no
Starting install...
Retrieving file .treeinfo 100% |=========================|  417 B    00:00    
Retrieving file vmlinuz.. 100% |=========================| 2.0 MB    00:00    
Retrieving file initrd.im 100% |=========================| 7.7 MB    00:00    
virDomainCreateLinux() failed XML描述 domain 不是良好的格式或者无效
Domain installation may not have been
 successful.  If it was, you can restart your domain
 by running 'virsh start vm02-CentOS-5.5'; otherwise, please
 restart your installation.
三, 20  4月 2011 19:21:08 ERROR    virDomainCreateLinux() failed XML描述 domain 不是良好的格式或者无效
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 XML描述 domain 不是良好的格式或者无效
----------------------------------------------------------------------------------------
############################################
解决办法:

安装前先启动 libvirtd 服务。

[root@glnode04 vm02-CentOS-5.5]# /etc/init.d/libvirtd status
libvirtd is stopped
[root@glnode04 vm02-CentOS-5.5]# /etc/init.d/libvirtd start
Starting libvirtd daemon:                                  [  OK  ]

原因分析:
出现此报错应该是主机的libvirtd服务没有启动,而virt-install工具在进行客户机系统安装的时候错误地将客户机的网卡连接到libvirtd服务起的网桥virbr0上,此时libvirtd是关闭的,所以virbr0也不存在了,就出现了上面的错误信息。
解决方法有两个:
(i)启动libvirtd服务后重新用原来的virt-install命令安装客户机操作系统;
#/etc/init.d/libvirtd start

(ii)、在原来的virt-install命令后面加-b参数指定需要连接的网桥,如果未调整网络,一般默认的网桥应该为xenbr0
要查看网桥的名称可以使用brctl命令查看

[root@glnode04 vm02-CentOS-5.5]# /etc/init.d/libvirtd status
libvirtd is stopped
[root@glnode04 vm02-CentOS-5.5]# brctl show  # libvirtd是关闭时网桥virbr0也不存在
bridge name    bridge id        STP enabled    interfaces
[root@glnode04 vm02-CentOS-5.5]# /etc/init.d/libvirtd start
Starting libvirtd daemon:                                  [  OK  ]
[root@glnode04 vm02-CentOS-5.5]# /etc/init.d/libvirtd status
libvirtd (pid 20863) is running...
[root@glnode04 vm02-CentOS-5.5]# brctl show
bridge name    bridge id        STP enabled    interfaces
virbr0        8000.000000000000    yes   

此处我们已经关闭了libvirtd服务,剩下的网桥的名称为xenbr0(如果创建了多个网桥,选择自己需要的网桥名称)
#virt-install -n kiro-test -r 256 --vcpus=1 -f /data/rh5 --nographics -p -d -l "http://192.168.0.1" -b xenbr0

参考:  XEN故障与解决方法汇总


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


(3) virt-manager 中连接虚拟机管理者Dom 0时出现错误:虚拟机管理者连接失败 libvirtError: virConnectOpenReadOnly() failed

----------------------------------------------------------------------------------------
Unable to open connection to hypervisor URI 'xen:///':
libvirt.libvirtError virConnectOpenReadOnly() failed
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/connection.py", line 307, in _open_thread
    self.vmm = libvirt.openReadOnly(self.uri)
  File "/usr/lib64/python2.4/site-packages/libvirt.py", line 132, in openReadOnly
    if ret is None:raise libvirtError('virConnectOpenReadOnly() failed')
libvirtError: virConnectOpenReadOnly() failed

虚拟机管理者连接失败

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

############################################
解决:

修改 xen 配置文件,按如下方式修改:
[root@glnode04 ~]# vim /etc/xen/xend-config.sxp

(xend-http-server yes)
(xend-unix-server yes)

重新启动 Xend 服务

[root@glnode04 ~]# xend restart
############################################

(4) virt-install 安装虚拟机是出现错误:ERROR    无法连接到 'localhost:8000': 拒绝连接

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

[root@gmnode14 vm01-CentOS-5.5]#  virt-install -n vm01-CentOS-5.5 -r 1024 --vcpus=4 -f vm01-CentOS-5.5.img -s 20 --nographic -l nfs:10.10.113.14:/opt/CentOS/mirrors/5.5
ERROR    无法连接到 'localhost:8000': 拒绝连接
Traceback (most recent call last):
  File "/usr/sbin/virt-install", line 861, in ?
    main()
  File "/usr/sbin/virt-install", line 636, in main
    conn = cli.getConnection(options.connect)
  File "/usr/lib/python2.4/site-packages/virtinst/cli.py", line 126, in getConnection
    conn = libvirt.open(connect)
  File "/usr/lib64/python2.4/site-packages/libvirt.py", line 159, in open
    if ret is None:raise libvirtError('virConnectOpen() failed')
libvirtError: 无法连接到 'localhost:8000': 拒绝连接
----------------------------------------------------------------------------------------
############################################
解决:

修改 Xend 配置文件,然后,xend  restart

[root@gmnode14 yum.repos.d]# vim /etc/xen/xend-config.sxp
(xend-http-server yes)
(xend-unix-server yes)

(xend-port            8000)

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

(5) virt-manager 安装Xen虚拟机连接网络时nat和桥接设备均为空,无法选择,安装不能继续

virt-manager创建虚拟系统选择网络连接时没有设备

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

分析原因:

出现此报错应该是主机的libvirtd服务没有启动,

而virt-install工具在进行客户机系统安装的时候错误地将客户机的网卡连接到libvirtd服务起的网桥virbr0上,此时libvirtd是关闭的,所以virbr0也不存在了,就出现了上面的错误信息。

解决方法:

启动libvirtd服务后重新运行 virt-manager 来安装客户机操作系统;

#/etc/init.d/libvirtd start
但是这也只能保证 nat 选项中有 default 选项,桥接仍不能选择设备,要彻底解决Xen虚拟机网络设备问题请参考问题(6)

参考:  XEN故障与解决方法汇总

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

(6) virt-manager 或者 virt-install 安装虚拟机系统过程中出现错误:

'libvirt.libvirtError virDomainCreateLinux() failed POST操作失败: (xend.err 'Device 0 (vif) could not be connected. Hotplug scripts not working.
---------------------------------------------------------------------------------------
Unable to complete install 'libvirt.libvirtError virDomainCreateLinux() failed POST操作失败: (xend.err 'Device 0 (vif) could not be connected. Hotplug scripts not working. ')
Traceback (most recent call last):
  File "/usr/share/virt-manager/virtManager/create.py", line 611, in do_install
    dom = guest.start_install(False, meter = meter)
  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.')
'---------------------------------------------------------------------------------------
############################################

原因分析:
从错误提示中可以查看到设备(vif) 不能连接,突然想到之前创建虚拟机时在网络连接设置时桥接方式不能选择,只能选择nat方式连接网络(见问题5),很可能和这个问题也有关系;


解决办法:


因为我使用的机器是好几年前的,系统是 Cent OS 5.2,不知道xen相关包有没有安装正常,于是使用 yum -y install xen* 重新安装了 xen 相关包,发现有几个包的确没有安装上 。安装完毕,重启系统后创建虚拟机,该问题不再出现。

如何使用 yum 安装xen相关软件包,请参见 CentOS 5.4下使用yum安装Xen

2011-04-29  更新该问题

后来我在另外一台机器上做实验室时一直提示该错误,就算重新安装了 xen,还是无法解决问题,后来终于从一个国外的网站上得到了提示,这个网站现在不记得了,忘记搜藏了。

网站上说,启动虚拟机桥接设备需要这样几个内核模块支持:netbk ,netloop,于是我使用 modprobe 命令手动加载了这两个模块,并且重新启动了 xend,这是生成了网桥设备 xenbr0,

我的测试和使用日志如下:

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

virt-install -n vm02-CentOS-5.5-full -r 2048 --vcpus=4 -f vm02-CentOS-5.5-full.img -s 20 --nographic -l http://10.10.103.14: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=); if the
  6 driver is compiled statically into the kernel, then you may set the parameter
  7 using loopback.nloopbacks= on the domain 0 kernel command line.
  8

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

[root@hdfs05 ~]# /etc/xen/scripts/network-bridge status
============================================================
2: eth0: 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=); if the
driver is compiled statically into the kernel, then you may set the parameter
using loopback.nloopbacks= 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 配置界面,停滞不前

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

半虚拟化安装时,选择 nat 上网方式,IP 配置使用 DHCP 方式,此时卡在 TCP/IP 配置界面,
Xen Sending request for IP information for eth0 不能成功, 卡在这里,不能通过。

--------------------------------------------------------------------------------------------------------
############################################

解决办法:
IP选择手动配置,配置 ip地址/子网掩码;

全虚拟化安装时不存在此问题。

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

(8) 启动虚拟机时出现错误:File "/usr/bin/pygrub", line 28, in ? ImportError: No module named LiloConf
--------------------------------------------------------------------------------------------------------
[root@glnode04 xen]# xm create /etc/xen/vm01-centos-5.5-pv
Using config file "/etc/xen/vm01-centos-5.5-pv".
Traceback (most recent call last):
  File "/usr/bin/pygrub", line 28, in ?
    import grub.LiloConf
ImportError: No module named LiloConf

提示 /usr/bin/pygrub 文件的第 28 行的 import grub.LiloConf 出错,这又是 python 的问题,import 出错。

手动执行 pygrub 命令,仍是出现这样的错误.
[root@glnode04 xen]# /usr/bin/pygrub
Traceback (most recent call last):
  File "/usr/bin/pygrub", line 28, in ?
    import grub.LiloConf
ImportError: No module named LiloConf

正常情况下执行 /usr/bin/pygrub 是这样的

[root@gmnode14 xen]# /usr/bin/pygrub
Usage: /usr/bin/pygrub [-q|--quiet] [-i|--interactive] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=]

[root@gmnode14 xen]#
--------------------------------------------------------------------------------------------------------

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

查看 /usr/lib 下 python 库,发现有3项:
[root@glnode04 xen]# ls /usr/lib/python
python/           python2.3  python2.4/

这地方有问题,CentOS默认安装的是Python 2.4.3,库文件和可执行文件的路径是:
/usr/lib/python2.4
/usr/bin/python2.4

而现在多了两个库文件python和python2.3,将这两项删除,或者重命名,再次测试,问题解决。

[root@glnode04 xen]# /usr/bin/pygrub
Usage: /usr/bin/pygrub [-q|--quiet] [-i|--interactive] [--output=] [--kernel=] [--ramdisk=] [--args=] [--entry=]

[root@glnode04 xen]# xm create /etc/xen/vm02-CentOS-5.5-pv
Using config file "/etc/xen/vm02-CentOS-5.5-pv".
Started domain vm02-CentOS-5.5-pv
启动虚拟机正常.

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

推荐阅读
360691894_8a5c48
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有