VM management - Create/Edit guest pre-start script

Description

Allows to add commands to be executed before the virtual machine is started (optional).

The script will be initialized upon first edition and will be prepared for the existing virtual machines. Newly added virtual machines will be automatically added upon edition.

Usage

(warning) It is important to respect the rules described in the menu or inside the script.

Example: activation of port 1 on the SEH myUTN-50a USB/Ethernet box before starting the Charon emulator

#!/bin/sh
#
# Parameter $1: contains full path to cfg file
# Parameter $2: contains full path to emulator exe file
#
# Important notes:
# - comments & commands must be on separate lines
# - respect the structure of the file with case/in/esac
# - only place your commands between the selection and the ';;' line
# - do not add any 'exit' command in the script unless you want the
#   virtual machine not to be started if the script fails
#
. /opt/charon/utils/charon_common
#
case "$1"
in
  
/charon/pluto.cfg)
    
/usr/bin/utnm -c "activate utn50agvalab 1"
    
;;
  
*)
    
echo "Invalid parameter '$1' for prestart"
    
exit 1
    
;;
esac

(question) The example above would need enhancement as if the port is already connected, an error will be returned. A test before activation is then welcome.


If the script has been initialized and a new virtual machine is added, it must be edited for the case related to the new configuration file to be added otherwise the "Invalid parameter" case will be activated and the "exit 1" will prevent the virtual machine from starting.

When displaying the list of defined virtual machines, the first 3 lines of the pre-start commands are displayed:



© Stromasys, 1999-2024  - All the information is provided on the best effort basis, and might be changed anytime without notice. Information provided does not mean Stromasys commitment to any features described.