1
0
mirror of https://github.com/gryf/boxpy.git synced 2025-12-18 21:10:17 +01:00

Use predefined os types for vbox VMs.

It might have impact on how operating system inside VM is treated by
VirtualBox, so let's stick with proper distro for every OS. As an
outcome, it turns out, that for graphical side of the vm, for Linux OS
the vmsvga driver is recommended, as a little more amount of vram.
This commit is contained in:
2023-04-18 21:39:50 +02:00
parent 10543cb506
commit 15a6ecb540

18
box.py
View File

@@ -585,6 +585,14 @@ class Config:
return source return source
class OsTypes:
def ubuntu(conf):
return "Ubuntu%s_64" % conf.version.replace('.', '_')
def fedora(conf):
return "Fedora_64"
class VBoxManage: class VBoxManage:
""" """
Class for dealing with vboxmanage commands Class for dealing with vboxmanage commands
@@ -765,7 +773,15 @@ class VBoxManage:
'--acpi', 'on', '--acpi', 'on',
'--audio', 'none', '--audio', 'none',
'--nic1', 'nat', '--nic1', 'nat',
'--natpf1', f'boxpyssh,tcp,,{port},,22'] '--natpf1', f'boxpyssh,tcp,,{port},,22',
'--graphicscontroller', 'vmsvga',
'--vram', '16']
if hasattr(OsTypes, conf.distro):
cmd.extend(['--ostype', getattr(OsTypes, conf.distro)(conf)])
else:
cmd.extend(['--ostype', 'Linux_64'])
for count, (hostport, vmport) in enumerate(conf.forwarding.items(), for count, (hostport, vmport) in enumerate(conf.forwarding.items(),
start=1): start=1):
cmd.extend(['--natpf1', f'custom-pf-{count},tcp,,{hostport},' cmd.extend(['--natpf1', f'custom-pf-{count},tcp,,{hostport},'