Overall design of the slave

This part of the Python testing infrastructure is able to:

# prepare distributions and send them to virtual machine for execution # launch a series of tasks on the virtual machine # get back information about those tasks (output of those)

In other words, it is the implementation of one slave in a master/slave architecture. It is able to manage a set of different machines, get back results and rollback the VM in a known state.

Pretty much, the purpose of the slave boils down to testing the projects (as requested by master) in an isolated environment(VM).

A simple schema for the slave is given here :

_images/pyti-slave.png

All VM operations like starting/stopping rollback and snapshot is discussed in vms and all disk operations like copying into disk and viceversa is discussed in diskhandler

Launching the slave:

$ pyti-slave --config pyti_config

This launches a deamon for the slave to receive requests from the master and run the tests as per the requests. The pyti_config file is an optional configuration file which contains basic information like:

[config]
pyti_slave_root = /home/yeswanth/pyti
total_vms = 3

The above config file refers to the environment variable PYTI_SLAVE_ROOT and the total VMs supported by the VMs

The slave then listens to orders on it’s queue ‘pyti_requests’ as described in master

You also can run specific tasks on specific distributions by asking so:

Inorder to get the last version of the “foobar” project and run all tests on it,we need to provide a json file which contains project details. Here again the config file is optional:

$ pyti-vm-run --target json_file --config config_file

A sample json can for “foobar” project that represents which platforms it needs to run on:

{
 "project_name": "rarfile",
 "project_version": "1.0",
 "recipe_identifier": "recipe",
 "platform_identifier": "linux-debian",
 "platform_variants": Null
}

Internally, this means that the following things are done:

  • load all the connectionz to the VMs, know what is the state for each of them (stopped, processing, …) For this number of VMs available at any given time is stored . This is handled by pyti.slave.stateofvm
  • get a spare VM
  • download the wanted distribution, get its dependencies, save all of that on a IO disk. This is handled by pyti.slave.pypidownload
  • start the VM, wait until the tasks are all run.
  • read the content of the IO disk in a particular folder
  • put those results in a python dict
  • stop the vm + rollback it
  • return the results