Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.
Signed-off-by: Sean McGinnis <email@example.com>
Removes the backward compatibility feature of `vbmc` to
automatically start up `vbmcd` daemon process if it is not running.
From now on, `vbmcd` should be started by systemd or some other
Add validation to fix error of "'<' not supported between
instances of 'str' and 'int'" when defining server_response_timeout
value in virtualbmc.conf. The error is trigger because the
config parameters from the configuration file are read as strings
and everything else assume that value is an integer (as the default of 5000).
The patch also include validations for server_spawn_wait and server_port to
check the values are valid integers.
Updates test_config.test_validate for test coverage
Signed-off-by: William Caban <firstname.lastname@example.org>
Since we've dropped support for Python 2.7, it's time to look at
the bright future that Python 3.x will bring and stop forcing
compatibility with older versions.
This patch removes the six library from requirements, not
Since log messages interpolation is frequently postponed
till the logging time, occasional bugs in message
templates may go unnoticed.
This patch attempts to enable full logging in unit tests.
Unfortunately, exceptions caused by interpolation failures
get inhibited by the logging module code so they do not
actually fail tests. But at least those exceptions are
noticeable on stdout.
This is a followup patch to  making the `start` command accepting
multiple domain names in the same way as `stop` command does.
Possible duplicate domain names given on the command line removed
to avoid runtime errors.
This is a followup patch to  introducing configurable timing
parameters for the client to wait for automatic vbmcd start up and
vbmcd response timeout.
Original design of the VirtualBMC tool was that user manages
config files for individual VirtualBMC (via a cli tool), then
requests the tool to start the instances representing
individual VirtualBMC instances (via the cli tool). Then
the instances become independent processes. The only way
to know their whereabouts is through the pidfiles
There were certain practical inconveniences with the
original design, namely:
* Cumbersome to start/stop/monitor free-standing
vBMC instances processes
* No two-way communication between the parent process
and the VirtualBMC instances what makes child state check
or modification unnecessary difficult
This commit turns server part of the tool into a single
process spawning multiple children processes and herding
them via ZMQ client/server.
The parent process runs server part of the control
interface, maintains persistent VirtualBMC instances
configuration and ensures all its children are alive
and kicking. Each VirtualBMC instance is still a separate
If child dies, parent respawns it right away. If parent
is about to die, it tries its best to kill all the
This new implementation tries to stay compatible with
the original one in part of `vbmc` tool CLI interface
and behaviour. Whenever it can't connect to the `vbmcd`
it tries to fork and spawn the daemon behind the scenes.
While the threading design for this tool might look better,
the underlying pyghmi library is apparently rather
complicated to use its concurrency capabilities reliably.
The other minor consideration is that running multiple
processes leverages CPU-based concurrency.
* The `start` command now accepts more than one domains
to be started
With pyghmi API, some methods return generic IPMI error
codes, while some return payload values. This patch fixes
the `get_power_state()` method to raise exception instead
of returning IPMI error code because the latter goes against
This reverts commit 9f7bfb9f6b.
It seems that the SOL feature introduced by patch  led to
the VirtualBMC daemons leaking two file descriptors (ends of
UNIX pipe, perhaps) per each IPMI query it processes. Given the
default ulimit of 1024 open files per process, in circa 500 IPMI
queries vbmc renders itself not quite functional.
The quick research of the problem reveals that the leak comes
to life once the virEventRegisterDefaultImpl() call is made
which prepares libvirt for asynchronous operations over a dedicated
connection to libvirtd. Even though once SOL session is gone and
libvirt is cleaned up (well, dedicated connection is closed),
the libvirt connection, which is open every time when IPMI query
comes in, leaks 2 FDs per query.
This problem has been reported about some other libvirt application
in the past  so the problem might go away if we turn the IPMI
part of vbmc to the asynchronous operation mode as well.
Another observation is that libvirt API may not  offer a full
clean up upon exiting from the asynchronous operation mode.
To summarize: the real cause of this behaviour is not yet properly
It seems that at times of high concurrency, libvirt
occassionally fails on supposedly some race condition
what leads to client failure (e.g. Ironic). This change
is to tell Ironic that it should try some more times rather
than bailing out right away.
This patch adds some methods to support Serial-over-LAN capability.
We'll be able to connect serial console of a domain with
"ipmitool sol activate" command.
SOL capability requires a persistent libvirt connection, so this
patchset adds libvirt_open.get_conn() method and use it.
This patch replaces the use of argparse module
by the cliff package. The rationale is that
cliff infrastructure is easier to use and more
functional. Some other OpenStack projects seem
to migrate to cliff already.
"boot" entries under "devices/*" are mutually exclusive with those
under "os". If such entries are present, vbmc fails when adding "boot"
entry under "os".
assertRaisesRegexp was renamed to assertRaisesRegex in Py3.2
For more details, please check:
When using Python 3 would have a type error when writing an integer
value to the config file. Convert it to a string before writing it.
As the ipmitool supports the power soft, and meanwhile
the spec  is trying to support this feature
to ironic node. Correspondingly we should enhance
our vbmc to support it as well.
Prior to this patch VirtualBMC methods would return None on most on most
failures and that would get translated into return code 0 by pyghmi. So,
even when a node failed to stop, start, get or set the boot device the
error was never propagated to the IPMI client.
This patch changes such behavior to include proper errors upon failures.
Prior to this patch, virutalbmc could only be configured in a per-user
basis. The configuration file as well the path where the VBMCs are going
to be created always lived in the users home directory.
This patch is adding support for a "global" configuration file which
will live in /etc/virtualbmc/virtualbmc.conf. When vbmc does not find a
configuration file in the user directory it will then fallback to the
global (if it exist, otherwise it will just uses the defaults values).
Also, a new configuration option called "config_dir" has been added.
This allows users to configure whatever directory they want to save the
created VirtualBMCs where before it always pointed to ~/.vbmc/config.
This patch is fixing few errors related to Python3 and tests:
* Add the attribute "message" to the exception because it doesn't exist
* Add the py35 runtime to tox.ini since we now run tests on Python3.5
* Drop the spec=file syntax because "file" is not a builtin type for
This patch allows users to configure the IPMI session timeout
when starting a virtual BMC. This timeout indicates how long it should
wait for the data to come across.
The timeout can be configured using the "session_timeout" configuration
option under the [ipmi] section in the virtualbmc.conf.
This patch is adding unittests for the config.py module. The patch also
adds a method called "initialize" in the VirtualBMCConfig class to
facilitate the tests.
This patch is making the result of "vbmc list" command to sort the table
by the domain name, that's visually easier to follow.
This patch also makes use of the PrettyTable's get_string() method when
printing a table for the "list" and "show" commands.
This patch is adding unittests for the utils.py module. The functions
str2bool() and mask_dict_password() are not being unittested because
they should be removed and replaced oslo functions.
This patch is restructuring the VirtualBMC repository according to the
OpenStack template for projects (Cookiecutter).
This patch also removes the dependency on the python-daemon library
since it is not present in the OpenStack global-requirements, now a new
class called "detach_process" has been added to the virtualbmc/utils.py
module that will take care of detaching the process context from its
parent and session.