Skip to content

Compute Node Workspace

ForrestGu edited this page Jun 15, 2017 · 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:

# This description is based on commit c520307dc05847c068a13ab678d9d19b46be2420
<node_name>        # root folder
    etc/
        infrasim.yml         # save runtime infrasim.yml
        vbmc.conf            # render template with data from infrasim.yml
    data/                    # data folder
        vbmc.emu             # emulation data
        bios.bin             # BIOS
        ipmi_sim/            # ipmi_sim runtime, managed by ipmi_sim
            sdr              # runtime sdr
            sel              # runtime sel
    script/                  # script folder
        chassiscontrol
        lancontrol
        startcmd
        stopcmd
        resetcmd
    sda.img (sdb.img, etc)   # drive for nodes
    .serial                  # unix socket file to forward serial data, managed by socat
    .pty0                    # serial device, managed by socat
    .<node_name>-socat       # pid file of socat
    .<node_name>-ipmi        # pid file of ipmi
    .<node_name>-qemu        # pid file of qemu
    .<node_name>-racadm      # pid file of RACADM simulation

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

data/ipmi_sim

This is ipmi_sim runtime, managed by ipmi_sim, instead of infrasim-compute.

data/ipmi_sim/sdr.*

This is runtime SDR of the virtual BMC instance, which ipmi-console manipulates.

data/ipmi_sim/sel.*

This is runtime SEL of the virtual BMC instance, which ipmi-console manipulates.

etc

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.

etc/infrasim.yml

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

  1. By default, it reads from /usr/local/infrasim/template/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.

etc/vbmc.conf

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.

script

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

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

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

script/startcmd

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.

script/stopcmd

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.

script/resetcmd

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.

sda.img (sdb.img, etc)

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.

.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.

.<node_name>-racadm

Record runtime pid of racadmsim of this infrasim-compute instance. By default, racadmsim starts once a node's type is Dell.

Clone this wiki locally