天天看點

KVM的HVM虛拟機使用非序列槽方式建立virsh console 連接配接

在去年寫的文章中,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建立虛拟機即可。

這次就不截圖了,具體如下

[email protected]:/share/nfs181# virsh console hvm201
連接配接到域 hvm201
換碼符為 ^]







Ubuntu 12.04.1 LTS hvm183 hvc0

hvm183 login: Password: 
[email protected]:/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
[email protected]:/share/nfs181# 
           

不過這樣還是有個缺點,grub還是得從vnc進入進行選擇,而且沒有記錄啟動過程中的資訊

繼續閱讀