- SPICE
- Contents
- Introduction
- Requirements for SPICE
- SPICE client
- Enable SPICE for a VM
- Caution
- OS specific settings for VM
- Windows
- Windows 7/8/10 and Windows 2012/2016
- Linux
- Start your SPICE session
- Using client USB devices
- Caution
- Using Audio
- SPICE Enhancements
- Troubleshooting
- Can’t start Spice session
- Guest resolution does not resize to Remote Viewer window
- Alternatives
- Spice протокол для Proxmox
- Настройка Spice
- Шаринг каталогов при помощи Spice
- Настройка нескольких мониторов
- Настройка клиентов под OS Linux
- Автоматическое получение SPICE-токена
- Основные возможности SPICE-клиента
- Работа по протоколу Spice для клиентов под Microsoft Windows
- Выводы
- Spice
- Introduction
- Testing Spice with oVirt
- Windows guest
- Fedora/RHEL guest
- Ubuntu 14.04/16.04 guest
SPICE
Contents
Introduction
SPICE (Simple Protocol for Independent Computing Environments) is an open remote computing solution built for virtual environments which allows users to view a computing «desktop» environment. The integrating of Spice into Proxmox VE provides a solution for interaction with virtualized desktop devices, like keyboard, mouse, audio and video. Interaction between front-end and back-end is done using Virtual Device Interfaces (VDI).
Spice achieves a user experience similar to an interaction with a local machine. It is suitable for both LAN and WAN usage, without compromising on the user experience.
Using Spice on Proxmox VE is easy and secure. It is integrated in the cluster environment, the user- and authentication system — and of course, all traffic is fully encrypted.
Spice was first introduced with Proxmox VE 3.1.
Requirements for SPICE
In order to use Spice you need the following:
- Spice client on your desktop OS
- Spice drivers inside your VM (VirtIO, QXL Graphic card drivers)
SPICE client
- Windows: virt-viewer 0.5.6 or higher, http://www.spice-space.org/download.html
- Linux: virt-viewer 0.5.6 or higher
- OS X (not yet working as expected): virt-viewer 0.5.7 or higher, https://www.spice-space.org/osx-client.html
Enable SPICE for a VM
Spice is not enabled by default. To enable it set the Display in the Hardware section of the VM to Spice (shown in the screenshot at the top). Increase the memory if you intend to use SPICE with high resolutions. 32 MiB is plenty for 4K resolutions.
Caution
Before changing the Display setting to SPICE check the following section. You may need to install QXL/SPICE drivers depending on the guest OS.
OS specific settings for VM
Windows
Windows 7/8/10 and Windows 2012/2016
Fully supported. Before you switch the Display to SPICE install the Windows SPICE guest tools 0.132 or higher (spice-guest-tools-0.132.exe or higher)
Linux
All Linux distributions released after 2011 have the necessary qxl driver included as a part of the Xorg package.
Start your SPICE session
A Spice session can be started by clicking directly on the Console button or by opening the Console sub menu and selecting Spice explicitly. This will trigger the download of the connection config file.
Open this file with Remote Viewer to start the session.
The association is automatic for Chrome and Internet Explorer (they use the mime type association from the OS). For Firefox, the association must be done manually, as Firefox has his own internal mime type association (See Options/Applications).
Using client USB devices
You can pass USB devices from the client into the VM. Add a USB device of the type Spice Port in the Hardware section of the VM.
Old methods of editing the config file directly are not necessary anymore with recent versions of Proxmox VE.
Caution
- The Windows version of the virt-viewer does not support it.
Using Audio
Audio devices can be added in the Hardware section of the VM. Three audio devices are supported:
- ich9-intel-hda: emulates Intel HDA Audio on ICH9 chipsets
- intel-hda: emulates Intel HDA Audio on ICH6 chipsets. Use if the ICH9 one does not work properly
- AC97: useful for older OS`s like Windows XP
Manually editing the config file of the VM is not necessary with recent versions of Proxmox VE.
SPICE Enhancements
SPICE Enhancements are optional features that can improve the remote viewer experience. They can be enabled in the Options panel of a VM.
Two enhancements are currently available:
Foldersharing enables you to share a local folder with the VM you are connecting to. The «spice-webdavd» daemon needs to be installed in the VM.
HINT: only the Linux version of Virt-viewer (remote-viewer) supports this.
Videostreaming will encode fast refreshing areas in a lossy video stream. A general recommendation cannot be given but depending on your situation this can greatly improve the performance.
More information can be found in the reference manual by clicking the «Help» button in the dialog to enable the enhancements.
Troubleshooting
Can’t start Spice session
If you can’t start a Spice session from the PVE Web gui, you can try the following shell script: https://git.proxmox.com/?p=pve-manager.git;a=blob_plain;f=spice-example-sh;hb=HEAD
Guest resolution does not resize to Remote Viewer window
Make sure the spice-vdagent service is installed and running in the VM.
If the guest stops resizing once you go higher than a certain size it is possible that the video memory is not enough. Increase the Memory settings of the Display in the Hardware section of the VM by a few MiB. For the changes to take effect you have to shutdown the VM and do a clean start.
Alternatives
Depending on your situation SPICE might not be the best solution. Alternatives are:
- RDP (Remote Desktop Protocol) for Windows Guests
- X2GO for Linux Guests
Spice протокол для Proxmox
Продолжим наш цикл статей посвященный удаленной работе рассказом про встроенные возможности популярного менеджера управления виртуализацией Proxmox VE.
Безусловно доступ к виртуальным машинам должен осуществляться средствами гостевой ОС, что обеспечивает безопасность для хостовой машины на которой установлен гипервизор. Но иногда возникает необходимость работы с виртуальной машиной, внешний доступ к которой не предусмотрен, или во время настройки. Особенно это актуально для рабочих станций с графическим интерфейсом.
На данный момент Proxmox VE предоставляет следующие средства:
- Консоль noVNC — основана на HTML5, требует последние версии браузеров и не нуждается в модулях Java;
- XtermJS — консоль на основе Java;
- SPICE — интегрирован в кластерную среду, систему пользователей и аутентификации и, конечно же, весь трафик полностью зашифрован.
Наиболее функциональным, безопасным и удобным для ежедневной работы является SPICE. Он так же позволяет настроить несколько независимых дисплеев, что особенно удобно при программировании.
Настройка Spice
Выбор дисплея используемой консоли определяется в процессе создания VPS или LXC. Протокол является открытым состоит из клиентской и серверной части. В процессе взаимодействия так же учавствует гипервизор.
SPICE сервер использует библиотеку libspice. Proxmox пока что основной пользователь этой библиотеки в среде виртуализации QEMU.
SPICE клиент — это программы, которые используют протокол SPICE. Безопасность обеспечивается генерацией сервером временного CSRF токен файла , который открывается на клиенте. Простой вариант получения файла доступен через веб интерфейс Proxmox VE клавиша «Консоль» — «Spice».
На клиенте нужно установить remote-viewer из пакета virt-viewer. Сейчас доступны версии для загрузки под Linux, Windows, OS X и другие платформы.
Прежде чем подключиться по протоколу Spice нужно указать в настройках VM видеокарту или изменить ее в настройках. Сделать это можно в меню VPS -> Оборудование -> Дисплей -> Spice.
Среди вариантов типов дисплея выберите Spice dual monitor, он как раз и обеспечивает режим мульти дисплеев. Пока для VM не будет установлен дисплей типа spice он не будет доступен.
Шаринг каталогов при помощи Spice
Для возможности работы проброса папок из VPS на базе Windows в параметрах опцию «Spice Enhancement» требуется установить в «Folder Sharing». Это позволит клиентам предоставить общий доступ к папкам.
Если ОС на сервере из cемейства Windows требуется установить следующие пакеты:
- UsbDk — драйвер фильтра Windows, разработанный для перенаправления USB Spice (клиентская сторона Windows) — UsbDk_1.0.22_x64.msi
- Гостевые инструменты Windows — spice-guest-tools
- Демон Spice WebDAV
Настройка нескольких мониторов
На VPS симейства Linux для полноценной поддержки spice dual monitors, должны быть установлены SPICE vdagent и x.org QXL video driver.
К примеру у Ubuntu 20
Настройка клиентов под OS Linux
Пакет virt-manager доступен для следующих дистрибутивов :
Fedora: # yum install virt-manager;
Debian: # apt-get install virt-manager;
Gentoo: # emerge virt-manager;
OpenBSD: # pkg_add virt-manager.
Есть возможность сборки программного обеспечения из исходного кода github.
Автоматическое получение SPICE-токена
Для клиентов linux для получения SPICE-токена можно использовать API Proxmox VE. Это можно сделать написав небольшой Shel скрипт. Сценарий заключается в том, что по установленным параметрам соединения с нашим гипервизором сначала получаем «авторизационный тикет» от API, а затем получаем сгенерированный CSRF токен файл для вьювера.
Формат запуска скрипта
После запуска на экране автоматически откроется окно консоли/рабочего стола вашей виртуальной машины. Для безопасности рекомендуем не указывать пароль доступа.
Основные возможности SPICE-клиента
Меню «Файл» — дополнительные настройки просмотра.
Меню «Просмотр» — задание масштаба отображения рабочего стола и возможность переключиться в полный экран. Также в этом меню можно активировать дополнительные дисплеи если установлен spice dual monitor.
Меню «Отправить клавишу» — позволяет отправлять различные комбинации в окно viewera.
Освободить курсор «мышки» через комбинацию — Ctrl+Alt+R.
Два дисплея в виде отдельных окон между которыми действует функционал перетаскивания.
В меню настройки консоли Remote Viewer можно указать какую папку вы монтируете в VPS и настройки совместного доступа к ней.
Работа по протоколу Spice для клиентов под Microsoft Windows
Windows 32 битная
Windows 64 битная
Для клиентов семейства Windows требуется чтобы внутри вашей VPS поддерживались драйвера видеокарты VirtiO, QXL. На данный момент операционные системы Windows 7/8/10 и Windows 2012/2016 полностью поддерживаются.
Функционал проброса папки в VPS семейства Windows работает пока только для клиентов под Linux.
Выводы
SPICE удобный, безопасный инструмент. Его можно использовать для доступа и работы с удаленным сервером, когда стандартные средства, такие как SSH или RDP не доступны. Безопасность передачи данных, возможность использовать графический интерфейс, мышь и клавиатуру, несколько дисплеев, выгодно выделяют SPICE среди других инструментов удаленной работы. Его можно использовать для повседневной работы с удаленным сервером, например во время для разработки программного обеспечения или просто для набора документов. Кстати именно Spice используют наши разработчики.
Spice
Introduction
The Spice project aims to provide a complete open source solution for interaction with virtualized desktop devices.The Spice project deals with both the virtualized devices and the front-end. Interaction between front-end and back-end is done using VD-Interfaces. The VD-Interfaces (VDI) enable both ends of the solution to be easily utilized by a third-party component. (from http://spice-space.org/). Spice is an essential part of Ovirt. Check home page of Spice project for more details http://spice-space.org/.
- Spice client is the interface for the end user.
- QXL driver is a video driver for the QEMU QXL video accelerator. It’s used for improving remote display performance and enhancing the graphic capabilities of the guest graphic system. However, standard VGA is supported when no driver exists.
- Spice vdagent is an optional component for enhancing user experience and performing guest-oriented management tasks. For example, the agent injects mouse position and state to the guest when using client mouse mode. In addition, it is used for configuration of the guest display settings and provides Clipboard sharing — allows copy paste between clients and the virtual machine.
- Spice XPI is SPICE extension for mozilla allows the client to be used from a web browser (on linux clients).
Testing Spice with oVirt
What do you need?
- A Linux client machine with spice client and spice xpi installed (packages spice-client and spice-xpi in Fedora/RHEL). It’s not possible to connect to a guest from Windows client through Ovirt yet.
- Fedora 17/RHEL6.3 Beta users can try a new spice-gtk based client remote-viewer — Install virt-viewer package and change priorities of spice clients with using update-alternatives tool (“update-alternatives –config spice-xpi-client” -> Choose remote-viewer). Please Note that SELinux policy bug (preventing remote-viewer connection) was observed, you may switch to SELinux permissive mode.
- In Ubuntu there is no spice-xpi package. One method that works for Ubuntu 13.04 is to Install the spice-client package which gives you /usr/bin/spicec. Extract the libnsISpicec.so file from the latest Fedora (FC19) RPM. Copy it into /usr/lib/mozilla/plugins/ and restart Firefox.
- Ovirt instance with some Windows/Linux guests installed with QXL graphic driver and spice vdagent installed (See below how to set up those components).
Windows guest
Install Spice guest tools (qxl graphic driver and spice-vdagent):
Install qxl graphic driver and spice vdagent separately:
- Download qxl driver (zip file) from http://www.spice-space.org/download/windows/qxl/qxl-0.1-19/ (broken) , unpack and install suitable version of qxl driver on Windows guest (i.e. with using Device Manager).
- Download spice vdagent (zip file) from http://www.spice-space.org/download/windows/vdagent/vdagent-win-0.7.2 (broken) , unpack and install suitable version of service following way:
- Start cmd under Administrator (It’s important to run it as Administrator).
- Move to location where you unpacked binaries (vdservice.exe and vdagent.exe).
- Run: “vdservice install”
- Run: “net start vdservice” (note you need to have virtio-serial driver installed).
Note: virtio-serial driver needs to be installed as well.
Fedora/RHEL guest
Make sure that xorg-x11-drv-qxl and spice-vdagent packages are installed (qxl driver is in used and spice-vdagentd service running). Note that F15/F16 will be displayed in fallback mode.
Ubuntu 14.04/16.04 guest
Make sure that xserver-xorg-video-qxl and spice-vdagent packages are installed (qxl driver is in used and spice-vdagentd service running).