mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 19:56:48 +00:00
feat(console): VNC is the only console type
SPICE was removed earlier; its leftovers and the console type choice go too: - the console settings form, update_console and the backend no longer offer or change the type; an invalid console form now shows its errors instead of being ignored; - the create form, the API serializer and create_instance no longer take a graphics type, new VMs get VNC; get_graphics_types and the graphics entries of the domain capabilities are gone; - migration appsettings.0013 deletes QEMU_CONSOLE_DEFAULT_TYPE; - a VM defined elsewhere with another graphics type gets "Console type ... is not supported". The locale catalogs still reference the deleted SPICE templates in source comments; regenerating them is left to the translation work.
This commit is contained in:
parent
9f86330552
commit
e5fda79f5a
18 changed files with 74 additions and 127 deletions
|
|
@ -418,10 +418,6 @@ class wvmConnect(object):
|
|||
result["disk_devices"] = self.get_disk_device_types(arch, machine)
|
||||
result["disk_bus"] = self.get_disk_bus_types(arch, machine)
|
||||
|
||||
result["graphics_support"] = util.get_xml_path(xml, "/domainCapabilities/devices/graphics/@supported")
|
||||
if result["graphics_support"] == "yes":
|
||||
result["graphics_types"] = self.get_graphics_types(arch, machine)
|
||||
|
||||
result["video_support"] = util.get_xml_path(xml, "/domainCapabilities/devices/video/@supported")
|
||||
if result["video_support"] == "yes":
|
||||
result["video_types"] = self.get_video_models(arch, machine)
|
||||
|
|
@ -677,18 +673,6 @@ class wvmConnect(object):
|
|||
# return [ 'disk', 'cdrom', 'floppy', 'lun' ]
|
||||
return util.get_xml_path(self.get_dom_cap_xml(arch, machine), func=get_device_list)
|
||||
|
||||
def get_graphics_types(self, arch, machine):
|
||||
"""
|
||||
:param arch: architecture
|
||||
:param machine:
|
||||
:return: available graphics types
|
||||
"""
|
||||
|
||||
def get_graphics_list(ctx):
|
||||
return [v.text for v in ctx.xpath("/domainCapabilities/devices/graphics/enum[@name='type']/value")]
|
||||
|
||||
return util.get_xml_path(self.get_dom_cap_xml(arch, machine), func=get_graphics_list)
|
||||
|
||||
def get_cpu_modes(self, arch, machine):
|
||||
"""
|
||||
:param arch: architecture
|
||||
|
|
|
|||
|
|
@ -158,7 +158,6 @@ class wvmCreate(wvmConnect):
|
|||
volumes,
|
||||
networks,
|
||||
nwfilter,
|
||||
graphics,
|
||||
virtio,
|
||||
listener_addr,
|
||||
net_model="virtio",
|
||||
|
|
@ -337,7 +336,7 @@ class wvmCreate(wvmConnect):
|
|||
xml += """<input type='tablet'/>"""
|
||||
|
||||
xml += f"""
|
||||
<graphics type='{graphics}' port='-1' autoport='yes' {console_pass} listen='{listener_addr}'/>
|
||||
<graphics type='vnc' port='-1' autoport='yes' {console_pass} listen='{listener_addr}'/>
|
||||
<console type='pty'/> """
|
||||
|
||||
if qemu_ga and virtio:
|
||||
|
|
|
|||
|
|
@ -1130,19 +1130,6 @@ class wvmInstance(wvmConnect):
|
|||
)
|
||||
return console_type
|
||||
|
||||
def set_console_type(self, console_type):
|
||||
if console_type == "":
|
||||
return False
|
||||
root = ElementTree.fromstring(self._XMLDesc(PERSISTENT_XML))
|
||||
graphic = root.find("devices/graphics")
|
||||
if graphic is None:
|
||||
return False
|
||||
if graphic.get("type") == console_type:
|
||||
return True
|
||||
graphic.set("type", console_type)
|
||||
newxml = ElementTree.tostring(root).decode()
|
||||
self._defineXML(newxml)
|
||||
|
||||
def get_console_port(self, console_type=None):
|
||||
if console_type is None:
|
||||
console_type = self.get_console_type()
|
||||
|
|
|
|||
|
|
@ -9,11 +9,11 @@ if not settings.configured:
|
|||
from lxml import etree
|
||||
from vrtManager.instance import PERSISTENT_XML, wvmInstance
|
||||
|
||||
LIVE = "<domain><devices><graphics type='vnc' passwd='live'><listen type='address'/></graphics></devices></domain>"
|
||||
PERSISTENT = "<domain><devices><graphics type='spice' passwd='old'><listen type='address'/></graphics></devices></domain>"
|
||||
LIVE = "<domain><devices><graphics type='vnc' passwd='live' keymap='en-us'><listen type='address'/></graphics></devices></domain>"
|
||||
PERSISTENT = "<domain><devices><graphics type='vnc' passwd='old'><listen type='address'/></graphics></devices></domain>"
|
||||
|
||||
|
||||
def running_vm_with_pending_graphics_type():
|
||||
def running_vm_with_pending_changes():
|
||||
vm = wvmInstance.__new__(wvmInstance)
|
||||
vm.wvm = MagicMock()
|
||||
vm._XMLDesc = MagicMock(side_effect=lambda flags: PERSISTENT if flags == PERSISTENT_XML else LIVE)
|
||||
|
|
@ -31,13 +31,15 @@ class ConsoleSettersTestCase(unittest.TestCase):
|
|||
"set_console_passwd": (lambda vm: vm.set_console_passwd("new"), "passwd", "new"),
|
||||
"set_console_keymap": (lambda vm: vm.set_console_keymap("de"), "keymap", "de"),
|
||||
"set_console_listener_addr": (lambda vm: vm.set_console_listener_addr("127.0.0.1"), "listen", "127.0.0.1"),
|
||||
"set_console_type": (lambda vm: vm.set_console_type("vnc"), "type", "vnc"),
|
||||
}
|
||||
for name, (edit, attr, value) in edits.items():
|
||||
with self.subTest(name):
|
||||
vm = running_vm_with_pending_graphics_type()
|
||||
vm = running_vm_with_pending_changes()
|
||||
edit(vm)
|
||||
self.assertEqual(self.defined_graphics(vm).get(attr), value)
|
||||
graphics = self.defined_graphics(vm)
|
||||
self.assertEqual(graphics.get(attr), value)
|
||||
# Built from the persistent device, not the live one
|
||||
self.assertNotEqual(graphics.get("passwd"), "live")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue