From caa2bda71b2cb4b78db99ab91dde9d98bc15ecd3 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sun, 25 Mar 2018 14:36:14 +0700 Subject: [PATCH] Spice with agent support for Qemu VMs. --- gns3server/compute/qemu/qemu_vm.py | 17 +++++++++++++++++ gns3server/schemas/node.py | 2 +- gns3server/schemas/qemu.py | 6 +++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/gns3server/compute/qemu/qemu_vm.py b/gns3server/compute/qemu/qemu_vm.py index d6441685..bbd42d50 100644 --- a/gns3server/compute/qemu/qemu_vm.py +++ b/gns3server/compute/qemu/qemu_vm.py @@ -1455,6 +1455,21 @@ class QemuVM(BaseNode): else: return [] + def _spice_with_agent_options(self): + + spice_options = self._spice_options() + if self._console: + # agent options (mouse/screen) + agent_options = ["-device", "virtio-serial", + "-chardev", "spicevmc,id=vdagent,debug=0,name=vdagent", + "-device", "virtserialport,chardev=vdagent,name=com.redhat.spice.0"] + spice_options.extend(agent_options) + # folder sharing options + folder_sharing_options = ["-chardev", "spiceport,name=org.spice-space.webdav.0,id=charchannel0", + "-device", "virtserialport,chardev=charchannel0,id=channel0,name=org.spice-space.webdav.0"] + spice_options.extend(folder_sharing_options) + return spice_options + def _monitor_options(self): if self._monitor: @@ -1822,6 +1837,8 @@ class QemuVM(BaseNode): command.extend(self._vnc_options()) elif self._console_type == "spice": command.extend(self._spice_options()) + elif self._console_type == "spice+agent": + command.extend(self._spice_with_agent_options()) elif self._console_type != "none": raise QemuError("Console type {} is unknown".format(self._console_type)) command.extend(self._monitor_options()) diff --git a/gns3server/schemas/node.py b/gns3server/schemas/node.py index 2905e0b2..d1f56639 100644 --- a/gns3server/schemas/node.py +++ b/gns3server/schemas/node.py @@ -144,7 +144,7 @@ NODE_OBJECT_SCHEMA = { }, "console_type": { "description": "Console type", - "enum": ["vnc", "telnet", "http", "https", "spice", "none", None] + "enum": ["vnc", "telnet", "http", "https", "spice", "spice+agent", "none", None] }, "properties": { "description": "Properties specific to an emulator", diff --git a/gns3server/schemas/qemu.py b/gns3server/schemas/qemu.py index 1b533270..2c6cb8fb 100644 --- a/gns3server/schemas/qemu.py +++ b/gns3server/schemas/qemu.py @@ -63,7 +63,7 @@ QEMU_CREATE_SCHEMA = { }, "console_type": { "description": "Console type", - "enum": ["telnet", "vnc", "spice", "none"] + "enum": ["telnet", "vnc", "spice", "spice+agent", "none"] }, "hda_disk_image": { "description": "QEMU hda disk image path", @@ -244,7 +244,7 @@ QEMU_UPDATE_SCHEMA = { }, "console_type": { "description": "Console type", - "enum": ["telnet", "vnc", "spice", "none"] + "enum": ["telnet", "vnc", "spice", "spice+agent", "none"] }, "linked_clone": { "description": "Whether the VM is a linked clone or not", @@ -541,7 +541,7 @@ QEMU_OBJECT_SCHEMA = { }, "console_type": { "description": "Console type", - "enum": ["telnet", "vnc", "spice", "none"] + "enum": ["telnet", "vnc", "spice","spice+agent", "none"] }, "initrd": { "description": "QEMU initrd path",