Este conteúdo não está disponível no idioma selecionado.

11.3. SPICE Agent


The SPICE agent helps run graphical applications such as virt-manager more smoothly, by helping integrate the guest operating system with the SPICE client.
For example, when resizing a window in virt-manager, the SPICE agent allows for automatic X session resolution adjustment to the client resolution. The SPICE agent also provides support for copy and paste between the host and guest, and prevents mouse cursor lag.
For system-specific information on the SPICE agent's capabilities, see the spice-vdagent package's README file.

11.3.1. Setting up Communication between the SPICE Agent and Host

The SPICE agent can be configured on a running or shut down virtual machine. If configured on a running guest, the guest will start using the guest agent immediately. If the guest is shut down, the SPICE agent will be enabled at next boot.
Either virsh or virt-manager can be used to configure communication between the guest and the SPICE agent. The following instructions describe how to configure the SPICE agent on a Linux guest.

Procedure 11.4. Setting up communication between guest agent and host with virsh on a Linux guest

  1. Shut down the virtual machine

    Ensure the virtual machine (named rhel7 in this example) is shut down before configuring the SPICE agent:
    # virsh shutdown rhel7 
    Copy to Clipboard Toggle word wrap
  2. Add the SPICE agent channel to the guest XML configuration

    Edit the guest's XML file to add the SPICE agent details:
    # virsh edit rhel7
    Copy to Clipboard Toggle word wrap
    Add the following to the guest's XML file and save the changes:
    <channel type='spicevmc'>
       <target type='virtio' name='com.redhat.spice.0'/>
    </channel>
    Copy to Clipboard Toggle word wrap
  3. Start the virtual machine

    # virsh start rhel7
    Copy to Clipboard Toggle word wrap
  4. Install the SPICE agent on the guest

    Install the SPICE agent if not yet installed in the guest virtual machine:
    # yum install spice-vdagent
    Copy to Clipboard Toggle word wrap
  5. Start the SPICE agent in the guest

    Start the SPICE agent service in the guest:
    # systemctl start spice-vdagent
    Copy to Clipboard Toggle word wrap
Alternatively, the SPICE agent can be configured on a running guest with the following steps:

Procedure 11.5. Setting up communication between SPICE agent and host on a running Linux guest

  1. Create an XML file for the SPICE agent

    # cat agent.xml
    <channel type='spicevmc'>
       <target type='virtio' name='com.redhat.spice.0'/>
    </channel>
    Copy to Clipboard Toggle word wrap
  2. Attach the SPICE agent to the virtual machine

    Attach the SPICE agent to the running virtual machine (named rhel7 in this example) with this command:
    # virsh attach-device rhel7 agent.xml
    Copy to Clipboard Toggle word wrap
  3. Install the SPICE agent on the guest

    Install the SPICE agent if not yet installed in the guest virtual machine:
    # yum install spice-vdagent
    Copy to Clipboard Toggle word wrap
  4. Start the SPICE agent in the guest

    Start the SPICE agent service in the guest:
    # systemctl start spice-vdagent
    Copy to Clipboard Toggle word wrap

Procedure 11.6. Setting up communication between the SPICE agent and host with virt-manager

  1. Shut down the virtual machine

    Ensure the virtual machine is shut down before configuring the SPICE agent.
    To shut down the virtual machine, select it from the list of virtual machines in Virtual Machine Manager, then click the light switch icon from the menu bar.
  2. Add the SPICE agent channel to the guest

    Open the virtual machine's hardware details by clicking the lightbulb icon at the top of the guest window.
    Click the Add Hardware button to open the Add New Virtual Hardware window, and select Channel.
    Select the SPICE agent from the Name drop-down list, edit the channel address, and click Finish:

    Figure 11.2. Selecting the SPICE agent channel device

  3. Start the virtual machine

    To start the virtual machine, select it from the list of virtual machines in Virtual Machine Manager, then click on the menu bar.
  4. Install the SPICE agent on the guest

    Open the guest with virt-manager and install the SPICE agent if not yet installed in the guest virtual machine:
    # yum install spice-vdagent
    Copy to Clipboard Toggle word wrap
  5. Start the SPICE agent in the guest

    Start the SPICE agent service in the guest:
    # systemctl start spice-vdagent
    Copy to Clipboard Toggle word wrap
The SPICE agent is now configured on the rhel7 virtual machine.
Red Hat logoGithubredditYoutubeTwitter

Aprender

Experimente, compre e venda

Comunidades

Sobre a documentação da Red Hat

Ajudamos os usuários da Red Hat a inovar e atingir seus objetivos com nossos produtos e serviços com conteúdo em que podem confiar. Explore nossas atualizações recentes.

Tornando o open source mais inclusivo

A Red Hat está comprometida em substituir a linguagem problemática em nosso código, documentação e propriedades da web. Para mais detalhes veja o Blog da Red Hat.

Sobre a Red Hat

Fornecemos soluções robustas que facilitam o trabalho das empresas em plataformas e ambientes, desde o data center principal até a borda da rede.

Theme

© 2026 Red Hat
Voltar ao topo