obmc-console design for multi host support

Vijay Khemka vijaykhemka at fb.com
Fri Feb 28 18:30:32 AEDT 2020



On 2/27/20, 2:05 AM, "openbmc on behalf of Andrew Jeffery" <openbmc-bounces+vijaykhemka=fb.com at lists.ozlabs.org on behalf of andrew at aj.id.au> wrote:

    Hi Kumar,
    
    On Thu, 27 Feb 2020, at 02:29, Kumar Thangavel wrote:
    > Hi Andrew,
    > 
    >              Could you please suggest how to add configs for multiple host ?
    
    Sure. So the root problem is mapping a given obmc-console-client to
    the correct obmc-console-server instance. We do this by giving the
    unix domain socket created by the server a unique name in the
    abstract socket namespace. The client is associated with a unique
    network port and the server a unique tty device (e.g. ttyVUART0),
    but neither the port nor the tty should be associated with the abstract
    socket's name as to do so means the port or tty name becomes a
    mapping that's hard to break (port X always implies tty Y). The route
    the patches take is to pair a client with a server via a socket-id value
    read from a configuration file (one patch enables the client to read a
    configuration file [1]).
    
    [1] https://urldefense.proofpoint.com/v2/url?u=https-3A__gerrit.openbmc-2Dproject.xyz_c_openbmc_obmc-2Dconsole_-2B_29457&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=v9MU0Ki9pWnTXCWwjHPVgpnCR80vXkkcrIaqU7USl5g&m=4KsAgtpglM3uy-zQNrLetDsAK0tWYa6jrJBrPPRer1A&s=UUdti96_TjtKfCwszTKoPFd1nqrxfUY7_9iSYdG80Tc&e= 
    
    All connections to the client a given port should map to one associated
    server. Given that the port is unique for the client and the tty for the
    server, we can define which configuration they should use in terms of
    the port or tty, which leads to the following configuration structure:
    
    ```
    $ ls -1 /etc/obmc-console
    client.2200.conf
    server.ttyVUART0.conf
    ```
What are other contents of client and server conf file other than socket-id?
    
    So to map the client associated with port 2200 to the server associated
    with ttyVUART0 we set the same socket-id value in both files:

Can this socket-id be any random word and can this be same across multiple
Host (client/server) configuration. I mean, do we need different socket-id for
client.2200 and client.2201 or it can be same.
    
    ```
    $ grep socket-id /etc/obmc-console/*.conf
    client.2200.conf:socket-id = host
    server.ttyVUART0.conf:socket-id = host
    ```
    
    You can add further instances to the system by adding e.g.
    client.2201.conf and server.ttyVUART1.conf and set the same socket-id
    value in each. This brings us to the issue of getting the client and
    server up and running - they are integrated into the running system
    via the two template systemd service units: obmc-console at .service
    and obmc-console-ssh at .service:
    
    ```
    $ cat /lib/systemd/system/obmc-console at .service
    [Unit]
    Description=%i Console Server
    ConditionPathExists=/etc/obmc-console/server.%i.conf
    
    [Service]
    # Instance ID is the VUART basename
    ExecStart=/usr/sbin/obmc-console-server --config /etc/obmc-console/server.%i.conf %i
    SyslogIdentifier=%i-console-server
    Restart=always
    ```
    
    ```
    $ cat obmc-console-ssh at .service
    [Unit]
    Description=Console Client on %i
    Wants=dropbearkey.service
    After=dropbearkey.service
    
    [Service]
    # Unit defaults to a templated service
    Environment="DROPBEAR_RSAKEY_DIR=/etc/dropbear"
    EnvironmentFile=/etc/default/dropbear
    EnvironmentFile=-/etc/default/obmc-console-client
    ExecStart=/usr/sbin/dropbear -r ${DROPBEAR_RSAKEY_DIR}/dropbear_rsa_host_key -c "/usr/bin/obmc-console-client -c /etc/obmc-console/client.%i.conf" -p %i -F $DROPBEAR_EXTRA_ARGS
    SyslogIdentifier=console-client-%i
    ExecReload=/bin/kill -HUP $MAINPID
    KillMode=process
    ```
    
    We realise the obmc-console-ssh at .service template by installing a
    obmc-console-ssh at 2200.service symlink and adding it to the default
    target. We realise the obmc-console at .service template by installing
    a custom udev rule to trigger the start of the server on the appearance
    of the associated tty device (the `ENV{SYSTEMD_WANTS}=` attributes):
    
    ```
    $ cat /lib/udev/rules.d/61-aspeed-vuart.rules
    SUBSYSTEM=="tty", ATTRS{iomem_base}=="0x1E787000", ENV{SYSTEMD_WANTS}="obmc-console at ttyVUART0" SYMLINK+="ttyVUART0", TAG+="systemd"
    SUBSYSTEM=="tty", ATTRS{iomem_base}=="0x1E788000", ENV{SYSTEMD_WANTS}="obmc-console at ttyVUART1" SYMLINK+="ttyVUART1", TAG+="systemd"
    ```
    
    This set of udev rules can be used generally, as due to the
    `ConditionPathExists=/etc/obmc-console/server.%i.conf` directive in
    obmc-console at .service we won't attempt to run obmc-console-server
    unless the associated configuration file is installed.
    
    You may want to review the following patches to understand how to
    integrate the configurations into your machine's configuration in
    bitbake:
    
    https://urldefense.proofpoint.com/v2/url?u=https-3A__gerrit.openbmc-2Dproject.xyz_q_topic-3A-2522concurrent-2Dconsoles-2522-2B-28status-3Aopen-2520OR-2520status-3Amerged-29&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=v9MU0Ki9pWnTXCWwjHPVgpnCR80vXkkcrIaqU7USl5g&m=4KsAgtpglM3uy-zQNrLetDsAK0tWYa6jrJBrPPRer1A&s=LRpDvGH-Ed553168urLDLuEpA5ZGYX89pDwsbvrGDOU&e= 
    
    You'll need a .bbappend file with a do_install_append() in your machine
    layer to install the rest of your configuration files.
    
    More work needs to be done to handle the case where your BMC image
    caters to multiple platform configurations, but this is at least a start to
    handling multiple console servers.
    
    Hope that helps!
    
    Andrew
    



More information about the openbmc mailing list