Documentation Virtualization Abstraction Layer (VAL) Plugins

class motey.val.plugins.abstractVAL.AbstractVAL[source]

An abstract implementation for a virtualization abstraction layer (VAL). Should be inherited to build an custom VAL plugin. A VAL plugin is implemented as an yapsy plugin. Each plugin must be configured via a yapsy-plugin file. See more at http://yapsy.sourceforge.net/

activate()[source]

Called at plugin activation.

create_instance(image_name, parameters={})[source]

Create and start an instance of an image.

Parameters:
  • image_name – the name of the image which should be created
  • parameters – execution parameters
Returns:

the id of the created instance

deactivate()[source]

Called when the plugin is disabled.

delete_image(image_name)[source]

Delete an image, but not the instance of it.

Parameters:image_name – the image to be deleted.
get_all_instances_stats()[source]

Returns object which is type of Status. Represents the status of all instances of this plugin type.

Returns:object from type Status
get_all_running_instances()[source]

Returns a list with all running instance in this VAL.

Returns:list of instances
get_plugin_type()[source]

Returns the specific plugin type.

Returns:the specific plugin type.
get_stats(instance_name)[source]

Returns object which is type of Status. Represents the status of an instance.

Parameters:instance_name – the name of the instance
Returns:object from type Status
has_image(image_name)[source]

Checks if an specific images exists.

Parameters:image_name – the name of the image to search for.
Returns:True if the image exist, otherwise False.
has_instance(instance_name)[source]

Checks if an image instance exists.

Parameters:instance_name – the name of an existing instance
load_image(image_name)[source]

Load the image to the device, but does not start the image himself.

Parameters:image_name – the image to be loaded.
start_instance(instance_name, parameters={})[source]

Start an existing image instance.

Parameters:
  • instance_name – the name of the existing instance
  • parameters – execution parameters
Returns:

should return the id of the started instance

stop_instance(instance_name)[source]

Stop an existing image instance.

Parameters:instance_name – the name of the container to be stopped
class motey.val.plugins.dockerVAL.DockerVAL[source]

Concrete implementation of the docker virtualization abstraction layer (VAL).

create_instance(image_name, parameters={})[source]

Create and start an instance of an image. It is a wrapper around the docker.containers.create command.

Parameters:
  • image_name – the name of the image which should be created
  • parameters – execution parameters. Same as in the docker.create_container.
Returns:

the id of the created instance

delete_image(image_name)[source]

Delete an image, but not the instance of it. It is a wrapper around the docker.images.remove command.

Parameters:image_name – the image to be deleted.
get_all_instances_stats()[source]

Returns object which is type of Status. Represents the status of all docker container.

Returns:object from type Status
get_all_running_instances()[source]

Returns a list with all running instance in this VAL. It is a wrapper around the docker.containers.list(filters={'status': 'running'}) command.

Returns:list of instances
get_docker_client()[source]

Instantiates the docker client.

Returns:the docker client
get_plugin_type()[source]

Returns the specific plugin type.

Returns:the specific plugin type.
get_stats(container_name)[source]

Returns object which is type of Status. Represents the status of a container.

Parameters:container_name – the name of the container
Returns:object from type Status
has_image(image_name)[source]

Checks if an specific images exists.

Parameters:image_name – the name of the image to search for. Can be the image.id or the image.short_id.
Returns:True if the image exist, otherwise False.
has_instance(container_name)[source]

Checks if an image instance exists. It is a wrapper around the docker.containers.get command.

Parameters:container_name – the name of an existing instance
load_image(image_name)[source]

Load the image to the device, but does not start the image himself. It is a wrapper around the docker.images.pull command.

Parameters:image_name – the image to be loaded.
start_instance(instance_name, parameters={})[source]

Start an existing image instance. It is a wrapper around the docker.containers.run command.

Parameters:
  • instance_name – the name of the existing instance
  • parameters – execution parameters. Same as in the docker.create_container.
Returns:

the id of the started instance

stop_instance(container_name)[source]

Stop an existing image instance. It is a wrapper around the docker.containers.stop command.

Parameters:container_name – the name of the container to be stopped