lost and found ( for me ? )

install KVM on CentOS 6.3 , use SPICE

[ install KVM on CentOS 6.3 ]


# cat /etc/centos-release
CentOS release 6.3 (Final)

# uname -rn
centos6-1.localdomain 2.6.32-279.2.1.el6.x86_64

# yum groupinstall Virtulization "Virtualization Platform" "Virtualization Client" "Virtualization Tools"

# /usr/libexec/qemu-kvm --version
QEMU PC emulator version 0.12.1 (qemu-kvm-0.12.1.2), Copyright (c) 2003-2008 Fabrice Bellard

# virt-manager --version
0.9.0

# libvirtd --version
libvirtd (libvirt) 0.9.10

start libvirtd
# /etc/init.d/libvirtd start
Starting libvirtd daemon:                                  [  OK  ]


connect to hypervisor with virsh to confirm whether or not libvirtd and virsh work.
# virsh --connect qemu:///system
Welcome to virsh, the virtualization interactive terminal.

Type:  'help' for help with commands
      'quit' to quit

virsh # quit

connect to the hypervisor with root user.
If you try this with regular users , you will see the following error
$ LANG=C virsh --connect qemu:///system
error: authentication failed: Authorization requires authentication but no agent is available.

error: failed to connect to the hypervisor


Same issue will occur with virt-manager.

root user
# virt-manager


connect to the hypervisor


non root user
$ virt-manager


can’t 
connect

error messages are like this:

File "/usr/lib64/python2.6/site-packages/libvirt.py", line 102, in openAuth
   if ret is None:raise libvirtError('virConnectOpenAuth() failed')
libvirtError: authentication failed: Authorization requires authentication but no agent is available.


add a bridge interface ( not mandatory )
trun on network and turn off NetworkManager.
# chkconfig NetworkManager off
# chkconfig network on

# chkconfig --list | grep -i network
NetworkManager  0:off   1:off   2:off   3:off   4:off   5:off   6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off


I’ll associate eth0 with br0.
# pwd
/etc/sysconfig/network-scripts

# cp ifcfg-eth0 ifcfg-br0


edit ifcfg-eth0 like this:
# egrep -v ^# ifcfg-eth0
TYPE=Ethernet
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="Auto eth0"
DEVICE="eth0"
UUID=zzz
ONBOOT=yes
HWADDR=zz
BRIDGE="br0"


edit ifcfg-br0 like this:
# egrep -v ^# ifcfg-br0
TYPE=Bridge
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="br0"
DEVICE="br0"
UUID=zz
ONBOOT=yes
HWADDR=zz
IPADDR=x.x.x.x
PREFIX=24
GATEWAY=z.z.z.z
DNS1=y.y.y.y


stop NetworkManager and start network.
# /etc/init.d/NetworkManager stop;/etc/init.d/network restart

Okay , I could create bridge interface which is associated with eth0.
# brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.002655e1aefa       no              eth0
virbr0          8000.525400fd7ade       yes             virbr0-nic


[ build a CentOS 6 VM with virt-manager and SPICE ]

install spice packages
# yum install spice-server spice-client spice-protocol –y


change display settings to Spice from VNC





# virsh list --all
Id    Name                           State
----------------------------------------------------
1     centos6-64-1                   running

# virsh dumpxml 1 | grep -i spice
   <channel type='spicevmc'>
     <target type='virtio' name='com.redhat.spice.0'/>
   <graphics type='spice' port='5900' autoport='yes' keymap='ja'/>


connect to the VM with spice client
# spicec -h 127.0.0.1 -p 5900


virsh # list --all
Id    Name                           State
----------------------------------------------------
3     centos6-64-1                   running

virsh # qemu-monitor-command 3 --hmp 'info spice'
Server:
    address: 127.0.0.1:5900
       auth: none
Channel:
    address: 127.0.0.1:50420
    session: 1714636915
    channel: 1:0
Channel:
    address: 127.0.0.1:50421
    session: 1714636915
    channel: 6:0
Channel:
    address: 127.0.0.1:50422
    session: 1714636915
    channel: 5:0
Channel:
    address: 127.0.0.1:50423
    session: 1714636915
    channel: 4:0
Channel:
    address: 127.0.0.1:50424
    session: 1714636915
    channel: 2:0
Channel:
    address: 127.0.0.1:50425
    session: 1714636915
    channel: 3:0


virsh #




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.