1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00
webvirtcloud/appsettings/migrations/0025_vnc_console_and_nic_descriptions.py
catborise f47b79b0ed fix(appsettings): the console and NIC settings say what they do
The four console settings (scale, view-only, resize session, clip
viewport) said "The console starts ...", but they set how a VNC console
starts; a serial console has none of them, and typed into a view-only
one. The NIC model setting said "default" was libvirt's choice, while
a new VM with "default" gets a VirtIO card. Their descriptions now say
so (migration 0025).
2026-11-13 13:58:46 +03:00

29 lines
1.2 KiB
Python

from django.db import migrations
from django.utils.translation import gettext_noop as _
# what these settings do: the console ones apply to a VNC console only (a
# serial console has none of them), and a new VM's NIC model "default" is VirtIO
DESCRIPTIONS = {
"CONSOLE_SCALE": _("The VNC console starts scaled to its window"),
"CONSOLE_VIEW_ONLY": _("The VNC console starts view-only: no keyboard or mouse input"),
"CONSOLE_RESIZE_SESSION": _("The VNC console starts asking the guest to fit its screen to the window"),
"CONSOLE_CLIP_VIEWPORT": _("The VNC console starts clipped to its window, without scaling"),
"INSTANCE_NIC_DEFAULT_TYPE": _("Network card model chosen first for a new VM (default: VirtIO)"),
}
def describe(apps, schema_editor):
AppSettings = apps.get_model("appsettings", "AppSettings")
for setting in AppSettings.objects.using(schema_editor.connection.alias).filter(key__in=DESCRIPTIONS):
setting.description = DESCRIPTIONS[setting.key]
setting.save()
class Migration(migrations.Migration):
dependencies = [
("appsettings", "0024_log_retention_setting"),
]
operations = [
migrations.RunPython(describe, migrations.RunPython.noop),
]