-
Notifications
You must be signed in to change notification settings - Fork 29
Compute Node Workspace
infrasim-compute creates a compute node simulation for you. The simulation leverages several runtime data and these data are kept in a workspace. The workspace is created at this path by default:
<HOME>/.infrasim/<node_name>/
This folder is created by this function call:
infrasim.model.CNode.init_workspace()
This folder is removed by this function call:
infrasim.model.CNode.terminate_workspace()
The folder structure looks like this:
# This description is based on commit c520307dc05847c068a13ab678d9d19b46be2420
<node_name> # Root folder
data # Data folder
<node_type>.emu # Emulation data
<node_type>_smbios.bin # BIOS
etc
infrasim.yml # Save runtime infrasim.yml
vbmc.conf # Render template with data from infrasim.yml
script # Script folder
chassiscontrol
lancontrol
startcmd
stopcmd
resetcmd
sda.img (sdb.img, etc) # disk image
.serial # unix socket file to forward data
.pty0 # Serial device, created by socat, not here
.<node_name>-socat # pid file of socat
.<node_name>-ipmi # pid file of ipmi
.<node_name>-qemu # pid file of qemu
Folder data
reserved all runtime data for infrasim. With exactly the same data, we assume you can start a same infrasim instance, including the same node type, same serial number, same network, etc.
This is a runtime emulation file for ipmi_sim
. If user sets target emulation data, it will be copied here. If user doesn't set a target, infrasim-compute shall get node type
from infrasim.yml
, then fetch the data from:
/usr/local/infrasim/data/<node_type>/<node_type>.emu
This is a runtime bios binary for qemu
. If user sets target binary, it will be copied here. If user doesn't set a target, infrasim-compute shall get node type
from infrasim.yml
, then fetch the data from:
/usr/local/infrasim/data/<node_type>/<node_type>_smbios.bin
Folder etc
reserved runtime configuration data for infrasim, such as infrasim configuration file and ipmi_sim
configuration file. With exactly the same data, we assume you can start a same infrasim instance, including the same node type, same serial number, same network, etc.
This is a copy of target infrasim configuration. It can comes from two sources:
- By default, it reads from
/usr/local/infrasim/template/infrasim.yml
- If user set target file, infrasim-compute shall copy it here.
Due to unresolved limitation on pyyaml, we can't keep comments from original yaml file to this runtime copy. But critical attributes are exactly the same.
Class infrasim.model.CNode
shall take python dictionary from this yaml file as input, then start working.
This is a runtime configuration file for ipmi_sim
. It comes from a template at /usr/local/infrasim/template/vbmc.conf
. Then this template is rendered with attributes from infrasim.yml
, and is finally written here.
You can define below attributes in infrasim.yml
:
---
type: ...
compute: ...
bmc:
ipmi_over_lan_port: ... # Be rendered to {{port_iol}} in template
lancontrol: ... # Be rendered to {{lan_control_script}} in template
interface: ... # Be rendered to {{lan_interface}} in template
chassiscontrol: ... # Be rendered to {{chassis_control_script}} in template
startcmd: ... # Be rendered to {{startcmd_script}} in template
startnow: ... # Be rendered to {{startnow}} in template
poweroff_wait: ... # Be rendered to {{poweroff_wait}} in template
kill_wait: ... # Be rendered to {{kill_wait}} in template
username: ... # Be rendered to {{username}} in template
password: ... # Be rendered to {{password}} in template
historyfru: ... # Be rendered to {{historyfru}} in template
sol_device: ... # Be rendered to {{sol_device}} in template
bmc_connection_port: ... # Be rendered to {{port_qemu_ipmi}} in template
ipmi_console_port: ... # Be rendered to {{port_ipmi_console}} in template
or you can just not write them and infrasim-compute sets a reasonable default value for you.
Folder script
reserved all control script for infrasim, especially for impi_sim
now.
This is a script for ipmi_sim
to do chassis control. If user sets target chassiscontrol script, it won't be copied here. If user doesn't set chassiscontrol script, infrasim-compute renders this script from:
/usr/local/infrasim/template/chassiscontrol
Several variables shall be taken into consideration to render this chassiscontrol, infrasim-compute has done this for you in init_workspace()
:
{{qemu_pid_file}} # Once workspace is set, pid file is <workspace>/.<node_name>-node
{{startcmd}} # Path of startcmd, user give it or <workspace>/script/startcmd
{{stopcmd}} # Path of stopcmd, user give it or <workspace>/script/stopcmd
{{resetcmd}} # Path of resetcmd, user give it or <workspace>/script/resetcmd
This is a script for ipmi_sim
to do lan control. If user sets target lancontrol script, it won't be copied here. If user doesn't set lancontrol script, infrasim-compute renders this script from:
/usr/local/infrasim/template/lancontrol
This is a script for ipmi_sim
to start compute simulation. This script is rendered from template at:
/usr/local/infrasim/template/startcmd
In startcmd
implementation, we actually call infrasim.qemu.start_qemu({{yaml_file}})
, and this function needs yaml_file
path which is <workspace>/etc/<node_name>.yml
.
This is a script for ipmi_sim
to stop compute simulation. This script is rendered from template at:
/usr/local/infrasim/template/stopcmd
In stopcmd
implementation, we actually call infrasim.qemu.stop_qemu({{yaml_file}})
, and this function needs yaml_file
path which is <workspace>/etc/<node_name>.yml
.
This is a script for ipmi_sim
to reset compute simulation. This script is rendered from template at:
/usr/local/infrasim/template/resetcmd
In resetcmd
implementation, we actually call infrasim.qemu.stop_qemu({{yaml_file}}); infrasim.qemu.start_qemu({{yaml_file}})
, and this function needs yaml_file
path which is <workspace>/etc/<node_name>.yml
.
These files are disk images, whose number depends on the disk number read from infrasim.yml
.
##.serial
This file is a unix socket file to forward data. More specifically, this socket bridges socat
and qemu
for InfraSIM to forward input and output stream as a serial port.
This is a hidden device for ipmi_sim
and socat
to use. The function serial over lan from ipmi_sim
shall connect I/O stream from this device. User can set target device in infrasim.yml
:
---
type: ...
compute: ...
bmc: ...
sol_device: ...
or you can just not write them and infrasim-compute sets the device here in workspace.
Record runtime pid of socat
of this infrasim-compute instance.
Record runtime pid of ipmi_sim
of this infrasim-compute instance.
Record runtime pid of qemu
of this infrasim-compute instance.