Tutorial on using spice to connect KVM Guest hosts

Source: Internet
Author: User

Spice technology has been out for a long time, it is superior to VNC a Remote Desktop protocol, the reason is recorded here, because some encrypted video files (such as the end of the Vpy video encryption), will identify the characteristics of the host, once the host reboot after the video can not be viewed, So I thought of watching the video in the virtual machine.

Introduction of Spice

Spice (Independent computing Environment Simple Protocol) is one of the main technical components of the Red Hat Enterprise Virtualization Desktop Edition, and has an adaptive remote commit protocol that provides the exact same end-user experience as the physical desktop. It contains three components.

SPICE driver:spice drives are stored in each virtual desktop component;

SPICE Device:spice devices exist in the Red Hat Enterprise virtualization hypervisor components;

The SPICE Client:spice client is a component on a terminal device that can be either a thin client or a dedicated PC for access to each virtual desktop.

These three components work together to determine the most efficient location for processing graphics to maximize user experience and reduce system load. If the client is strong enough, Spice sends a graphics command to the client and processes the graphics in the client, significantly reducing the load on the server. On the other hand, if the client is not strong enough to handle graphics on the host computer, graphics processing does not require much spice from the CPU's point of view.

Second, the installation and connection of spice software

1, Software Installation and KVM XML file configuration

Redhat/centos/fedora can be installed by Yum

# yum Install Spice-protocol spice-client spice-server
The XML file for a KVM virtual machine can be supported by adding the following content:

# Virsh Edit RHCA
Add the following content
<graphics type= ' spice ' port= ' 5930 ' autoport= ' No. ' listen= ' 192.168.0.102 ' passwd= '
<video>
<model type= ' qxl ' vram= ' 32768 ' heads= ' 1 '/>
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' ' slot= ' 0x02 ' ' function= ', ' 0x0 '
</video>
When you need to enable your sound card, you also need to add the following in the configuration file:

<sound model= ' ac97 ' >
<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' ' slot= ' 0x06 ' ' function= ', ' 0x0 '
</sound>
The spice protocol is enabled when installed:

#virt-install \
-N windows \
-R 2048 \
-F/VAR/KVM/IMAGES/WINDOWS.IMG \
-S 50 \
--vcpus=2 \
--os-type windows \
--os-variant=win7 \
--network bridge=br0 \
--graphics spice,port=5940,listen=192.168.0.110,password=password \
--video QXL \
--channel spicevmc \
--cdrom/dev/cdrom
Note: The video card used by the default virtual machine is a virtual video card, and a virtual NIC can be replaced with a QXL NIC when using the spice protocol, which speeds up the quality of the video transmission.

A virtual machine that is not managed using Virt can be specified when the QEMU command is started:

/usr/libexec/qemu-kvm-m 15000-cpu nehalem,+vmx \
-net nic,vlan=0,macaddr=52:54:00:12:34:22 \
-net tap,vlan=0,ifname=tap0 \
-SMP 8,sockets=1,cores=8,threads=1 \
-drive file=/data/img/rhca/rhca.qcow2 \
-spice Port=5930,disable-ticketing &
The function of the parameter disable-ticketing is to connect without using a password (a blank password).

2, Spice connection

Connections under Linux

The host connecting to guest needs to install Spice-client

# yum-y Install Spice-client
#/usr/libexec/spicec-h 192.168.0.102-p 5930-w Password
Windows Connection Guest

Windows also need to install equivalent client software, specific to the http://www.spice-space.org/download.html page to download:


After the connection, will also be recorded in the recent connection, the feeling is still more humane:

Browser connection

The browser connection requires the Spice-xpi browser plugin to be installed on the connection side, which supports Firefox and chromium browsers, although the plugin currently supports only Linux systems. This is reflected on the rh318 Rhev Red Hat virtualization platform behind it.

Comparison of Spice, VNC and RDP protocols

Spice, VNC, RDP are the more mainstream Remote Desktop Connection protocols. Here is a summary comparison of the three. Visible spice is still quite excellent.




















































SPICE
Vnc Rdp
BIOS Screen Display Yes Yes No
Full color support Yes Yes Yes
Change resolution Yes Yes Yes
Multiple Monitors Multi-monitor support (up to 4 images) Only one screen Multi-monitor support
Image transfer Image and graphics transmission Image transfer Image and graphics transmission
Video playback Support GPU Acceleration Support No GPU Acceleration Support
Audio transmission Bidirectional voice can be controlled No Bidirectional voice can be controlled
Mouse control The client server can control Server-side control Server-side control
USB Transmission USB can be transmitted over the network No USB can be transmitted over the network

So the current idea is to encrypt a single authorized video file, you can consider the storage in the KVM virtual machine, properly save the virtual machine can be, do not worry because the host reload caused by video can not see the problem

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.