[FrontPage] [TitleIndex] [WordIndex

This is a read-only archived version of wiki.centos.org

Using Spice with LibVirt on VMs (CentOS-6.2 or Higher)

<<TableOfContents: execution failed [Argument "maxdepth" must be an integer value, not "[1]"] (see also the log)>>

1. What is Spice

CentOS-6.2 introduces a new version of LibVirt (version 0.9.4-23) that contains built in support for Spice.

The Spice project aims to provide a complete open source solution for interaction with virtualized desktop devices. Spice currently focuses to provide high-quality remote access to QEMU virtual machines. Seeking to help break down the barriers to virtualization adoption by overcoming traditional desktop virtualization challenges and emphasizing the user experience. For this purpose, Red Hat introduced the SPICE remote computing protocol that is used for Spice client-server communication. Other components developed include QXL display device and driver, etc.

So, Spice is an enhanced method to connect to a QEMU virtual machine in a way that helps to maintain the desktop experience. It provides sound from the VM as well as much lower bandwidth for higher end graphics on the VM. For more information on Spice, see the spice-space.org website.

2. How to convert a current KVM Virtual Machine to use Spice

Note: Currently (as of CentOS-6.2), only the X86_64 arch can be used as a KVM host server for virtual machines. This guide is written for a CentOS-6.2 x86_64 machine with either vmx (Intel Processor) or smx (AMD Processor) cpu flags and an already working VirtManager (or virsh for CLI only) VM host.

Note: Spice only works with KVM (and not Xen) virtual machines.

2.1. Installing Spice

1. If you have a KVM Virtual Machine that is currently using VNC as the console (the old default), after upgrading to version 0.9.4-23 (or higher) for libvirt, install the following RPMS on the host:

yum install spice-server spice-client spice-protocol

With CentOS 6.3 and later, you may also want to install virt-viewer.

2. If the host machine is a fully graphical install, you might also want to install the following optional RPMS:

yum install cairo-spice ffmpeg-spice-libs ngspice pixman-spice spice-glib spice-gtk spice-gtk-python spice-gtk-tools spice-xpi

2.2. Installing the Spice Display on an Existing KVM Virtual Machine

1. Open VirtManager and double click the VM in question. Changes only happen when the VM is shutdown, so shutdown the VM to make the change.

2. After the machine is shutdown, use the View menu item and select Details. In the left column, find the Display VNC hardware item, highlight it and click the Remove button on the bottom right of the screen.

3. Click the Add Hardware option at the bottom left of the screen, then pick Graphics, and in the Type drop down box that defaults to VNC Server, pick Spice Server and click the Finish button.

  1. You can also check the option to Listen on all Public Interfaces. This option will listen on your public IP address and not only. This will make your VM available to be connected to from other machines that install spice-client (as detailed below). Another option is tha you can allocate the port for the normal and secure connections. Make sure to set a password and to use a secure port if connecting from a non secure network.

Note: You must remove the VNC Display and then add the Spice Display ... you can NOT change the VNC Display to a Spice Display as that does not add the extra devices necessary to use spice.

4. Select the Video hardware device, and in the Model drop down box, select the qxl device. Press the Apply button at the bottom right of the window.

5. You should now be able to start the device and it should be using spice for the default console connection.

6. You can also install some graphics drivers on some operating systems (in your VM Guest) to get better graphical performance. See the spice download page for Windows Drivers for qxl.

3. Connecting to Spice with the Clients

1. You can use the console from VirtManager if you are on the machine that hosts the VM, but you can also connect to the machine using one of remote clients.

  1. The spice-client contains the spicec and can be used like this:

    spicec -h <host> -p <port_number> -w <password> (if you did a secure port, use -s <port> for that instead of -p ... -w <password> is optional)

    With CentOS 6.3 and later, you can connect using the following command (the virt-viewer package required):

    remote-viewer spice://<host>:<port_number>
  2. The spice-gtk-tools package contains spicy. If you execute spicy, you can type in the hostname, password, and port to connect to a spice machine.

Note: Remember that when using spicec or spicy (or any another spice client), you are connecting to the port and Hostname (or IPADDRESS) of the KVM Host and not the actual name/address of the Virtual Machine.

2023-09-11 07:22