lnst-ctl: fix get_recipe_results for single matches

This patch spparates the code for the first match of a recipe from the
code for additional matches. This fixes a few issues introduced in the
multi match support patches, such as wrong error reporting when no
suitable match was found.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
NetTestResultSerializer: dont print match when there is none

When the first match of a recipe failed the result serializer still
tried to print the match description resulting in an Exception.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
SlavePool: small object construction fixes

This patch fixes some small problems in the SlavePool methods
responsible for Machine object construction.

When the machine isn't virtual it doesn't need the libvirt_domain
parameter. This can could cause exceptions when the match wasn't virtual
but the machine had the parameter defined and lnst-ctl wasn't running
with root privileges.

Proper initialization of the network parameter for interfaces. This is
purely so that it doesn't cause confusion in the future. Unused
interfaces don't have any network.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Machine: added methods get_interfaces and get_addresses

These methods will be used by the Python Task API. The both return
complete lists of either interfaces or ip addresses (tuple of address
and prefix) which can be iterated.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
TaskAPI: improved access to hosts and interfaces

The ControllerAPI class now supports returning all configured hosts in a
dictionary with this format:
{host_id: HostAPI instance, ...}

A new class InterfaceAPI was added, instances of this class represent
configured interfaces of a host and at the moment can be used for read
access of various interface attributes. In the future this could be
extended to changing these values as well.

HostAPI now has 2 new methods: get_interface and get_interfaces that
return an InterfaceAPI object or a dictionary of {interface_id:
InterfaceAPI object} respectively. The get_* methods that accessed
interface attributes now use the associated InterfaceAPI object while
keeping backwards compatibility.

ModuleAPI gained two new methods: get_options and set_options that make
it possible to reuse the same object multiple times with different
options, e.g. running the IcmpPing module with different intervals.

The ValueAPI class was renamed to VolatileValue and reimplemented to
support all the derived classes out of the box. The objects are
constructed by supplying a function that resolves the desired value with
some arguments. The value can be accessed by calling the get_value
method. This will always call the specified function to get an
up-to-date value. To keep backwards compatibility the __str__ function
is still defined and transforms the value returned by the get_value
method to a string.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>