mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
fix(instances): saving a SPICE console's settings keeps it SPICE
The console type list offers VNC and Serial only, so the page of a SPICE VM showed VNC and any save, of the keymap alone, switched the console: libvirt refused the definition when the VM had a SPICE channel, and without one the VM silently got a new VNC console. A console type the panel does not create is now offered as it is, and kept on save. A switch from SPICE that is chosen removes the SPICE channels, USB redirection and smartcards libvirt refuses without SPICE graphics and mutes SPICE audio. A new VNC console keeps the keymap and a password VNC can take; a longer one is replaced by a generated password. The console settings were read from the first graphics device that had each attribute: with VNC and SPICE devices the page showed VNC's port with SPICE's password. All are read from the first device, the one the settings change.
This commit is contained in:
parent
cd3edf4dff
commit
7fe79463fc
8 changed files with 276 additions and 176 deletions
|
|
@ -96,6 +96,21 @@ class UpdateConsoleTestCase(TestCase):
|
|||
form = ConsoleForm(instance=Instance.objects.get(pk=self.instance.pk), is_superuser=True)
|
||||
self.assertEqual((form["console_type"].value(), sorted(form.fields)), ("pty", ["console_type"]))
|
||||
|
||||
def test_a_spice_console_stays_spice_when_its_settings_are_saved(self):
|
||||
# SPICE is not offered for new consoles: a save would have made it VNC
|
||||
proxy, messages = self.post({**VNC, "console_type": "spice", "keymap": "de"}, console_type="spice")
|
||||
self.assertEqual(messages, [])
|
||||
proxy.set_console_type.assert_not_called()
|
||||
proxy.set_console_keymap.assert_called_once_with("de")
|
||||
proxy, _ = self.post({**VNC, "console_type": "vnc"}, console_type="spice")
|
||||
proxy.set_console_type.assert_called_once_with("vnc")
|
||||
# the VNC limits are not SPICE's
|
||||
for password, saved in (("é-a-longer-one", True), ("a\nb", False)):
|
||||
with self.subTest(password=password):
|
||||
proxy, _ = self.post({**VNC, "console_type": "spice", "password_action": "set", "password": password},
|
||||
console_type="spice")
|
||||
self.assertEqual(proxy.set_console_passwd.called, saved)
|
||||
|
||||
@override_settings(SERIAL_CONSOLE_ENABLED=False)
|
||||
def test_serial_is_not_offered_while_the_serial_console_is_off(self):
|
||||
proxy, _ = self.post({**VNC, "console_type": "pty"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue