schema: Fixing address and alias bugs

The scheme cover situations when we omit the value of the address tag
and replace it with text instead:

    <address value="1.2.3.4/32"/>
    <address>1.2.3.4/32</address>

The same problem occured with defining aliases. This patch fixes those
issues.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
NmConfigDevice: soft device removal not needed for new NM

This commit encapsulates the removal of soft devices in a try-except
block. The cade is there only because the current version of NM doesn't
remove these devices on its own. In the future however NM will handle
it, and it already works on the current git build. In these cases the
device removal would fail with an exception which is unwanted.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Machine: remember original hwaddr for virt devices

Since the controller now recieves updates about interface hwaddrs from
the slave, we need to remember the original hwaddr of dynamically
created devices, because it's the only one we can use for deleting the
interface later.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Machine: exceptions during deconfiguration fix

This patch adds a few try-except blocks for machine deconfiguration. The
important part is that the slave is always disconnected in the end, and
that dynamic devices get detached when something fails.

Exceptions during deconfiguration caused that the controller never
disconnected from the slave, and the slave would be locked listening on
this socket. This would cause problems when there are multiple recipes
being processed in a single lnst-ctl call.

It is also important to continue the cleanup of remaining machines when
cleanup on one machine fails.

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

Object specific attributes have to be initialized in the constructor. If
they are initialized under the class definition, the attribute objects
will be shared between instances.

This caused a bug to appear- when running multiple recipes, if a slave
machine is available during one recipe, but becomes unavailable before
the next recipe it will still be considered during machine matching for
the next recipe.

This commit fixes that bug.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
SlavePool: Check for duplicate configs

This commit adds a checkf for machine duplicity in the pool. Sometimes,
one might forget an old slavemachine in the pool. Having two configs
reference the same machine will most likely lead to lockups.

This situation is very hard to debug, so we're adding a check for it.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
SlavePool: Adding a warning when a pool dir is empty

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Config: Create pool dir with user config

When there controller initializes user configuration in his home dir (in
case it is not present during the first run), it only prepared the
config. However, a config without a pool is useless. This required the
user to edit the file manually to add it's own pool dir.

This commit adds automatic creation of the 'pool/' directory to the
initialization sequence, so users don't have to do it manualy.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
NetTestCommand: change exception handling

This commit fixes a bug that appears when a test option is missing in
the recipe. When such a situation appears, the slave throws an exception
that wasn't handled anywhere and resulted in the crash of the
controller.

After this commit the commands can either return properly- the have a
result, end with a KeyboardInterrupt or be killed - a default result is
set, or a different exception is raised - the command result is set to
fail and the exception is saved in result data. This shows up nicely in
results on the controller.

The missing option exception now also says which option is missing.

Another problem that appears is when an unexpected exception is raised
on the slave and is not handled- in such a situation the controller will
crash, and nothing nice can be written to the results. This situation is
now handled and the results will contain an exception logged into debug
logs (on the slave and sent to controller), and the controller will
report an unexpected exception being raised on a certain slave machine.

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

This patch adds support for the rpc_port parameter to slave machine
configuration files, which was erroneously dropped during the
refactoring of the parsers.

Issue #42.

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Machine: default command timeout

We used to have a default timeout for commands with the previous rpc
implementation, but didn't implement it in the new one. This commit adds
a default timeout for commands, the time is set in the DEFAULT_TIMEOUT
constant, which for now is 60 seconds.

This also fixes result reporting for killed commands.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
NetTestController: print value of slave exceptions

Previously the controller would only print that there was an exception
raised on a certain slave machine, and there would be a traceback in
debug logs from that slave. Now the value of the exception will be added
to our controller logs, that makes it easier to spot what went wrong
without looking up the traceback.

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

This commit removes the old source attributes, since we moved to using
XInclude. But since using XInclude for such simple recipe generation is
a bit of an overkill the generation script uses simple string replacing.

Signed-off-by: Ondrej Lichtner <olichtne@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
NetTestController: Check tasks before configuration

The tasks were checked after all the machines were configured. And in
case there was some trivial error in the task (such as a wrong path),
the whole network configuration was just a plain waste of time.

This commit moves the checks before the configuration is processed.

Issue #36

Signed-off-by: Radek Pazdera <rpazdera@redhat.com>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>