Calling SMAPI from Linux


Is anyone calling z/VM’s SMAPI from Linux? I have tried using both smaclient from SineNomine and smcli from IBM with different results. I was just wondering if anyone has tried these.


-Mike MacIsaac


Mike, our (IBM’s) CMA code uses smcli, as did the older non-CMA xCAT/ZHCP code. We don’t compare against other implementations when doing that, unsurprisingly… we compare against human-expected results.

For anyone as yet unaware, smcli (along with the rest of ZHCP) is now available in open source smcli source on github. The IBM dev owner is anticipating possibly doing some work in there “soon”.


The current use of smcli requires the caller to scan the output looking for keywords such as error or failed. I am working on an enhancement to add a “header” first line that contains return and reason codes, etc. The caller can then examine the contents of this first line to determine if an error.
To enable this header, a new keyword would need to be supplied. This way existing callers would not be impacted. A GitHub issue has been started and will be filled in with more details later.



Sounds good. Glad to hear smcli is still being actively maintained.

Rather than requiring a new flag on every call and returning the return and reason codes on the first line, why don’t you just always return them on the last line. I’m can’t imagine anyone saying “Including extra error messages broke my screen scraping code”. Just a thought …



Hi Mike,
just a little story from Canonical on that - using smaclient with SMAPI today.

I was looking for my development team mates for a way to kick-off fully-automated-installations (FAIs) from their (Linux/Ubuntu) workstation.
So I had a look at several tools:

  • snIPL
    Doesn’t really allow to do this job.
    It allows to (re-)start (aka re-boot aka re-IPL) systems, but I couldn’t find a way to kick-off an installation.
    On z/VM, so via SMAPI, I didn’t found a way to execute an ‘exec’ from remote, on LPAR no Load from removable media possible.
  • zhmcclient
    Cool and promising, but LPAR only.
    But even for LPARs it’s missing right now a way for using Load from Removable Media remotely.
    This is because the HMC does not yet exposes this task via it’s web API. I requested that from IBM, but these kinds of changes take some time …
  • smcli
    The natural way to look at, because it’s coming from and is supported by IBM.
    Well, quite a huge bunch of C code, not really light-weight - and I already struggled to adjust the Makefile to get it compiled on Ubuntu (well, I obviously focus on Ubuntu only … :wink: )
  • smaclient
    Wooow, I was impressed - at this point many thx to SineNomine for making it available!
    It’s “just” a bash script, hence as light-weight as it can be, no compile, portable (runs on my local x86 workstation, but also on a s390x system), easily expandable, single script (all-in-one), … and just worked w/o any modification!
    Unfortunately it’s a bit outdated, doesn’t support the very latest SMAPI functions, but luckily the functions that I was looking for.

Based on the smaclient I created the following ‘hack’:
smaclient allows me to access z/VM - as usual via SMAPI.
I can now change the IPL line in the user direct, so I can IPL CMS instead of a Linux from disk, I can also add some IPL PARMs that allow me to specify a REXX script to call from CMS later.
The IPL PARMs are automatically handed over to the SYSPROF EXEC, I adjusted the SYSPROF EXEC (using localmod) to look for my special install PARMs, I handed over these again to the PROFILE EXEC and execute an Ubuntu installation exec there, based on the PARMs given, and finally a fully automated “preseed” installation is kicked-off.
All this is done in about 5 minutes, incl. all updated that exist on top of the install system and the post-install reboot.
And my development folks don’t need to touch a 3270 terminal …

(Once the zhmcclient supports the Load from Removable Media task I implement something similar for LPARs.)

A valid question could now be:
Why don’t we use Ubuntu KVM, Container/LXD or OpenStack for deploying systems?
Well, we do - of course :wink:
But from time to time we also have the need to test LPAR and VM installations or components that run directly in VM or LPAR rather than in KVM VMs or containers.
A distributor has quite diverse needs and requirements …

  • Frank


Hi Frank,
Do you have some feedback on how you had to adjust the makefile for Ubuntu? I can add that to the wiki page about how to compile it.



Thanks for the feedback. I meant to reply to this earlier.

I can now change the IPL line in the user direct, so I can IPL CMS instead of a Linux

My first thought was “Why change it, why not always IPL CMS?” This is how I have always done it so as to call the SWAPGEN EXEC (a popular way of writing a swap signature to a ‘file’ in memory).

To access SMAPI from Linux, we have switched the default from smaclient to smcli as the latter seems to be better supported. We can change back to smaclient by setting a variable. FWIW…