在去年写的文章中,http://blog.csdn.net/dobell/article/details/14442457,写到了怎么利用serial 设备进行console连接
不过比较麻烦,因为1.需要修改虚拟机内部的grub启动选项,2 vnc连接过去无法同时使用
后来发现libvirt支持了virio启动,那么就容易了多了。
虚拟机配置文件的xml如下
<devices>
<console type='pty'>
<source path='/dev/pts/5'/>
<target type='virtio' port='0'/>
</console>
</devices>
然后virsh create hvm201.xml创建虚拟机即可。
这次就不截图了,具体如下
root@zju-PowerEdge-T610:/share/nfs181# virsh console hvm201
连接到域 hvm201
换码符为 ^]
Ubuntu 12.04.1 LTS hvm183 hvc0
hvm183 login: Password:
root@zju-PowerEdge-T610:/share/nfs181# dmesg|tail
[ 184.441602] init: Failed to spawn ufw post-stop process: unable to execute: No such file or directory
[ 184.553217] ip_tables: (C) 2000-2006 Netfilter Core Team
[ 184.662792] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[ 184.751382] IPv6: ADDRCONF(NETDEV_UP): virbr0: link is not ready
[ 185.637728] init: Failed to spawn ufw pre-start process: unable to execute: No such file or directory
[ 185.643237] init: Failed to spawn ufw post-stop process: unable to execute: No such file or directory
[ 185.665464] device vnet0 entered promiscuous mode
[ 185.685296] xenbr0: port 2(vnet0) entered forwarding state
[ 185.685306] xenbr0: port 2(vnet0) entered forwarding state
[ 200.710430] xenbr0: port 2(vnet0) entered forwarding state
root@zju-PowerEdge-T610:/share/nfs181#
不过这样还是有个缺点,grub还是得从vnc进入进行选择,而且没有记录启动过程中的信息