obmc-console design for multi host support

Andrew Jeffery andrew at aj.id.au
Fri Mar 6 16:01:50 AEDT 2020


Hi Vijay,

On Fri, 6 Mar 2020, at 08:28, Vijay Khemka wrote:
> Hi Andrew,
> I have a question as why do we need obmc-console-ssh.socket and 
> obmc-console-ssh at .service. 

obmc-console-ssh.socket is not used in the concurrent-server context.
It can't be, for reasons outlined below.

obmc-console-ssh at .service is always required, but how it works changes
based on whether obmc-console-ssh.socket is used or not. The behaviour
is changed by the presence or absence of
obmc-console-ssh at .service.d/use-socket.conf which overrides the
ExecStart property of obmc-console-ssh at .service and requires the
presence of obmc-console-ssh.socket.

Prior to implementing concurrent server support in obmc-console, the
dropbear instance that launches the clients was itself launched using
systemd socket-activation:

https://www.freedesktop.org/software/systemd/man/systemd.socket.html

This has the benefit of minimising memory consumed in the system by not
starting dropbear until the first connection is received. The updates to the
obmc-console recipe that pull in the upstream concurrent-server support
maintain this behaviour for systems that do not require concurrent-server
support (all platforms supported upstream), however due to systemd
constraints on the interaction between socket and service units it's not 
possible to use socket-activation and support concurrent servers in a
generic fashion.*

So to clarify,  the changes to the obmc-console.bb recipe assumes by
default that the system it's being installed on does _not_  require
concurrent-server support, and as a consequence configures the package
to install obmc-console-ssh.socket and
obmc-console-ssh at .service.d/use-socket.conf. It is necessary to opt-in to
enabling concurrent-server support in a bbappend, and doing so requires
changes similar to those outlined in my previous email. Configuring the
package with --enable-concurrent-servers will install _neither_
obmc-console-ssh.socket _nor_
obmc-console-ssh at .service.d/use-socket.conf (in-fact, this is all the
--enable-concurrent-servers configure switch controls). The declarations
needed in the .bbappend enabling concurrent-servers roughly fall into
two categories:

1. Telling bitbake about the extra server/client configuration files
2. Modifying bitbake variables to remove the units that won't be installed
(i.e. obmc-console-ssh.socket and
obmc-console-ssh at .service.d/use-socket.conf)

Hope that helps.

Andrew

* Specifically, when systemd starts the service associated with a socket unit
the parameter for the service template unit is a unique integer that has no
association with the template parameter for the socket unit. This means
we can't have the port number passed from the socket unit to the service
unit as a template parameter and therefore don't know which configuration
to choose in the service unit. The only way to make this work is to define
pairs of socket and service units that have the port baked into the service
name (as the service unit still must be a template to support the connection
number). That's quite awkward, so I just chose to instantiate the dropbear
instances directly and avoid socket-activation.


> Especially when using in concurrent servers do we need to create these 
> for each client/server socket?
> 
> This may be a basic question but I want to understand this more.
> 
> Regards
> -Vijay
> 
> On 3/2/20, 8:19 PM, "openbmc on behalf of Andrew Jeffery" 
> <openbmc-bounces+vijaykhemka=fb.com at lists.ozlabs.org on behalf of 
> andrew at aj.id.au> wrote:
> 
>     
>     
>     On Thu, 27 Feb 2020, at 20:34, Andrew Jeffery wrote:
>     
>     > 
>     > You'll need a .bbappend file with a do_install_append() in your machine
>     > layer to install the rest of your configuration files.
>     > 
>     
>     Just following up on the .bbappend - the change for the base recipe is here:
>     
>     
> https://urldefense.proofpoint.com/v2/url?u=https-3A__gerrit.openbmc-2Dproject.xyz_c_openbmc_meta-2Dphosphor_-2B_29747_1_recipes-2Dphosphor_console_obmc-2Dconsole-5Fgit.bb&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=v9MU0Ki9pWnTXCWwjHPVgpnCR80vXkkcrIaqU7USl5g&m=1-CxtAkTLEtpmrw0zNxaJWDWKC1n3zMEPSWErzgz6Ow&s=4F0YCLIwY_2nNtoNQ3nhkPlN1iU1d8O2EX3cOhtz8no&e= 
>     
>     In that context, .bbappends for enabling concurrent console servers should
>     look something like this for an example machine called 'foo':
>     
>     ```
>     FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
>     
>     SRC_URI += "file://server.ttyVUART0.conf"
>     SRC_URI_append_foo = " file://client.2201.conf"
>     SRC_URI_append_foo = " file://server.ttyVUART1.conf"
>     
>     SRC_URI_remove = "file://$%7BBPN%7D.conf"
>     
>     REGISTERED_SERVICES_${PN}_append_foo = " obmc_console_guests:tcp:2201:"
>     
>     SYSTEMD_SERVICE_${PN}_append_foo = " obmc-console-ssh at 2200.service \
>     		obmc-console-ssh at 2201.service \
>                     "
>     SYSTEMD_SERVICE_${PN}_remove_foo = "obmc-console-ssh.socket"
>     
>     FILES_${PN}_remove_foo = 
> "/lib/systemd/system/obmc-console-ssh at .service.d/use-socket.conf"
>     
>     EXTRA_OECONF_append_foo = " --enable-concurrent-servers"
>     
>     do_install_append_foo() {
>             # Install configuration for the servers and clients. Keep 
> commandline
>             # compatibility with previous configurations by defaulting 
> to not
>             # specifying a socket-id for VUART0/2200
>             install -m 0755 -d ${D}${sysconfdir}/${BPN}
>     
>             # Remove the default client configuration as we don't to define a
>             # socket-id for the 2200 console
>             rm -f ${D}${sysconfdir}/${BPN}/client.2200.conf
>     
>             # However, now link to /dev/null as a way of not specifying 
> a
>             # socket-id while having a configuration file present. We 
> need to
>             # provide a configuration path to meet the requirements of 
> the packaged
>             # unit file.
>             ln -sr ${D}/dev/null 
> ${D}${sysconfdir}/${BPN}/client.2200.conf
>     
>             # We need to populate socket-id for remaining consoles
>             install -m 0644 ${WORKDIR}/client.2201.conf 
> ${D}${sysconfdir}/${BPN}/
>     
>             # Install configuration for remaining servers - the base 
> recipe
>             # installs the configuration for the first.
>             install -m 0644 ${WORKDIR}/server.ttyVUART1.conf 
> ${D}${sysconfdir}/${BPN}/
>     }
>     ```
>     
>     Hope that helps.
>     
>     Andrew
>     
> 
>


More information about the openbmc mailing list