From 15a6ecb5401cd86f8916a1ab78eec72ec2aefc3f Mon Sep 17 00:00:00 2001 From: gryf Date: Tue, 18 Apr 2023 21:39:50 +0200 Subject: [PATCH] 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. --- box.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/box.py b/box.py index 9c9f07f..3f2a78d 100755 --- a/box.py +++ b/box.py @@ -585,6 +585,14 @@ class Config: return source +class OsTypes: + def ubuntu(conf): + return "Ubuntu%s_64" % conf.version.replace('.', '_') + + def fedora(conf): + return "Fedora_64" + + class VBoxManage: """ Class for dealing with vboxmanage commands @@ -765,7 +773,15 @@ class VBoxManage: '--acpi', 'on', '--audio', 'none', '--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(), start=1): cmd.extend(['--natpf1', f'custom-pf-{count},tcp,,{hostport},'