歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> Linux教程

安裝Xen、創建Xen虛擬機、使用Xen虛擬機過程中經常出現的錯誤總結

目錄

(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 <module>
from xen.xend.server import SrvDaemon
File "/usr/lib64/python/xen/xend/server/SrvDaemon.py", line 20, in <module>
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 <module>
from xen.xm import main
File "/usr/lib/python/xen/xm/main.py", line 45, in <module>
from xen.util import security
File "/usr/lib/python/xen/util/security.py", line 25, in <module>
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


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

 

(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和橋接設備均為空,無法選擇,安裝不能繼續

 

 

 

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

分析原因:

出現此報錯應該是主機的libvirtd服務沒有啟動,

而virt-install工具在進行客戶機系統安裝的時候錯誤地將客戶機的網卡連接到libvirtd服務起的網橋virbr0上,此時libvirtd是關閉的,所以virbr0也不存在了,就出現了上面的錯誤信息。

解決方法:

啟動libvirtd服務後重新運行 virt-manager 來安裝客戶機操作系統;

#/etc/init.d/libvirtd start
但是這也只能保證 nat 選項中有 default 選項,橋接仍不能選擇設備,要徹底解決Xen虛擬機網絡設備問題請參考問題(6)

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

 

(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  http://www.linuxidc.com/Linux/2011-04/34933.htm

 

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=<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 配置界面,停滯不前

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

半虛擬化安裝時,選擇 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=] <image>

[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=] <image>

[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
啟動虛擬機正常.

Copyright © Linux教程網 All Rights Reserved