Skip to content

Compute Node Workspace

ForrestGu edited this page Aug 31, 2016 · 10 revisions

Introduction

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()

Structure

The folder structure looks like this:

<node_name>    # Root folder
    data                        # Data folder
        infrasim.yml            # Save runtime infrasim.yml
        vbmc.conf               # Render template with data from infrasim.yml
        <node_type>.emu         # Emulation data
        <node_type>_smbios.bin  # BIOS
    script                      # Script folder
        chassiscontrol
        lancontrol
        startcmd
        stopcmd
        resetcmd
    .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

Folders and Files

data

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.

data/infrasim.yml

This is a copy of target infrasim configuration. It can comes from two sources:

  1. By default, it reads from /etc/infrasim/infrasim.yml
  2. 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.

data/vbmc.conf

This is a runtime configuration file for ipmi_sim. It comes from a template at /usr/local/etc/infrasim/conf/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.

data/<node_type>.emu

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/etc/infrasim/<node_type>/<node_type>.emu

data/<node_type>_smbios.bin

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/etc/infrasim/<node_type>/<node_type>_smbios.bin

script

Folder script reserved all control script for infrasim, especially for impi_sim now.

chassiscontrol

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/etc/infrasim/script/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

lancontrol

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/etc/infrasim/script/lancontrol

startcmd

This is a script for ipmi_sim to start compute simulation. This script is rendered from template at:

/usr/local/etc/infrasim/script/startcmd

In startcmd implementation, we actually call infrasim.qemu.start_qemu({{yaml_file}}), and this function needs yaml_file path which is <workspace>/data/infrasim.yml.

stopcmd

This is a script for ipmi_sim to stop compute simulation. This script is rendered from template at:

/usr/local/etc/infrasim/script/stopcmd

In stopcmd implementation, we actually call infrasim.qemu.stop_qemu({{yaml_file}}), and this function needs yaml_file path which is <workspace>/data/infrasim.yml.

resetcmd

This is a script for ipmi_sim to reset compute simulation. This script is rendered from template at:

/usr/local/etc/infrasim/script/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>/data/infrasim.yml.

.pty0

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.

.<node_name>-socat

Record runtime pid of socat of this infrasim-compute instance.

.<node_name>-ipmi

Record runtime pid of ipmi_sim of this infrasim-compute instance.

.<node_name>-qemu

Record runtime pid of qemu of this infrasim-compute instance.