summaryrefslogtreecommitdiffstats
path: root/core/modules/vbox-src
diff options
context:
space:
mode:
authorJonathan Bauer2018-04-19 12:31:00 +0200
committerJonathan Bauer2018-04-19 12:31:00 +0200
commit389196f0a398e49591df8ba1796a9442fa9a4927 (patch)
treec0696d5163824a6ee7b67791d222c9dc4f074851 /core/modules/vbox-src
parent[rfs-stage31] Force loading acpi_ipmi for nvidia, doesn't handle dependencies... (diff)
downloadmltk-389196f0a398e49591df8ba1796a9442fa9a4927.tar.gz
mltk-389196f0a398e49591df8ba1796a9442fa9a4927.tar.xz
mltk-389196f0a398e49591df8ba1796a9442fa9a4927.zip
[vbox-src] support SHARE_REMAP_MODE
and moved some variables
Diffstat (limited to 'core/modules/vbox-src')
-rwxr-xr-xcore/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/finalize_machine_config.inc22
-rwxr-xr-xcore/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/guest_hardware_limits.inc21
-rwxr-xr-xcore/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/init_core.inc3
3 files changed, 26 insertions, 20 deletions
diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/finalize_machine_config.inc b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/finalize_machine_config.inc
index 1db67e08..9eab913a 100755
--- a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/finalize_machine_config.inc
+++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/finalize_machine_config.inc
@@ -2,13 +2,8 @@
# Include: write final machine configuration file #
################################################################################
finalize_machine_config() {
- # Expected path to the final vbox file
- VBOX_MACHINE_CONFIG="${VBOX_MACHINES_DIR}/${VM_CLEANNAME}/${VM_CLEANNAME}.xml"
- # remove ':' from MAC addr for vbox and generate a VDE (virtual device ethernet)
- VM_MAC_ADDR="$(sed 's/://g' <<< ${VM_MAC_ADDR})"
-
- # set machine uuid
+ # set the generated machine uuid
set_attr "/VirtualBox/Machine" "uuid" "{${MACHINE_UUID}}"
# set read-only image path and uuid
@@ -62,18 +57,23 @@ finalize_machine_config() {
"uuid={${SLX_FLOPPY_UUID}}"
- # Add a node for the SharedFolder
- add_node "/VirtualBox/Machine/Hardware" "SharedFolders"
- if [ -n "${HOME_SHARE_NAME}" -a -n "${HOME_SHARE_PATH}" -a -d "${HOME_SHARE_PATH}" ]; then
+ setup_shared_folders() {
+ # TODO common share through shared folders?
+ if isempty SHARED_FOLDERS HOME_SHARE_NAME HOME_SHARE_PATH; then
+ writelog "Missing information to setup shared folders."
+ return 1
+ fi
add_node \
"/VirtualBox/Machine/Hardware/SharedFolders" "SharedFolder" \
"name=${HOME_SHARE_NAME}" \
"hostPath=${HOME_SHARE_PATH}" \
"writable=true" \
"autoMount=true"
- fi
+ }
+ notempty VBOX_SHARED_FOLDERS && setup_shared_folders
- # set the MAC address
+ # remove ':' from MAC address and set it to the main network adapter
+ VM_MAC_ADDR="$(sed 's/://g' <<< ${VM_MAC_ADDR})"
set_attr "/VirtualBox/Machine/Hardware/Network/Adapter" "MACAddress" "${VM_MAC_ADDR}"
# set vm's memory
diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/guest_hardware_limits.inc b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/guest_hardware_limits.inc
index def5280c..44640710 100755
--- a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/guest_hardware_limits.inc
+++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/guest_hardware_limits.inc
@@ -3,10 +3,9 @@
################################################################################
set_hardware_limits() {
- #SHARED_FOLDERS="TRUE"
- #enablevt="true"
- #enable2d
- #enable3d
+
+ # support shared folders by default, disable it if guest OS doesn't support it
+ declare -g SHARED_FOLDERS="TRUE"
# set some base configuration depending on the guest operating system
# NOTE: list supported OS type with: VBoxManage list ostypes
@@ -33,19 +32,16 @@ set_hardware_limits() {
MAXCORES="1"
MAXMEM="256"
MAXVRAM="64"
- SHARED_FOLDERS="FALSE"
;;
WindowsMe)
MAXCORES="1"
MAXMEM="384"
MAXVRAM="64"
- SHARED_FOLDERS="FALSE"
;;
Windows2000|Windows2003)
MAXCORES="4"
MAXMEM="4000"
MAXVRAM="128"
- SHARED_FOLDERS="FALSE"
;;
Windows2003_64|WindowsXP_64)
MAXCORES="4"
@@ -108,8 +104,6 @@ set_hardware_limits() {
# TODO: FreeBSD, NetBSD, MacOS*, Solaris, Oracle, ...
esac
- declare -rg GUESTVRAM=$MAXVRAM
-
# check /run/hwinfo for CORE not THREADS
# vbox seems to only want maximum cores = number of
# physical cores of the cpu, so use that
@@ -120,6 +114,15 @@ set_hardware_limits() {
[ "${CPU_CORES}" -gt "{MAXCORES}" ] && CPU_CORES="${MAXCORES}"
[ "${VM_MEM}" -gt "${MAXMEM}" ] && VM_MEM="${MAXMEM}"
+ # currently not used, keep the VRAMSize setting from the uploaded configuration
+ declare -rg GUESTVRAM=$MAXVRAM
+
+ # check if shared folders should be activated according
+ # to SHARE_REMAP_MODE set by /opt/openslx/inc/shares
+ VBOX_SHARED_FOLDERS=
+ if [ "x$SHARED_FOLDERS" != "xFALSE" ] && [ "$SHARE_REMAP_MODE" -gt 1 ]; then
+ declare -rg VBOX_SHARED_FOLDERS="1"
+ fi
return 0
}
diff --git a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/init_core.inc b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/init_core.inc
index 26408ee1..f63d41cd 100755
--- a/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/init_core.inc
+++ b/core/modules/vbox-src/data/opt/openslx/vmchooser/plugins/virtualbox/includes/init_core.inc
@@ -184,6 +184,9 @@ init_core() {
# xml namespace for vbox configs
declare -rg VBOX_NAMESPACE="http://www.virtualbox.org/"
+ # path to the main machine configuration file
+ declare -rg VBOX_MACHINE_CONFIG="${VBOX_MACHINES_DIR}/${VM_CLEANNAME}/${VM_CLEANNAME}.xml"
+
writelog "Directories:"
writelog "\tConfig dir:\t\t$VBOX_ROOT"
writelog "\tMachines dir:\t\t$VBOX_MACHINES_DIR"