COT.deploy module

Module for deploying VM descriptions to a hypervisor to instantiate VMs.


COTDeploy Semi-abstract class for submodules used to deploy a VM to a hypervisor.
SerialConnection Generic class defining a serial port connection.
class COTDeploy(UI)[source]

Bases: COT.submodule.COTReadOnlySubmodule

Semi-abstract class for submodules used to deploy a VM to a hypervisor.

Provides some baseline parameters and input validation that are expected to be common across all concrete subclasses.

Inherited attributes: UI, package,

Attributes: generic_parser, parser, subparsers, hypervisor, configuration, username, password, power_on, vm_name, network_map

create_subparser(parent, storage)[source]

Add subparser for the CLI of this submodule.


Unlike most submodules, this one has subparsers of its own - 'cot deploy PACKAGE <hypervisor>' so subclasses of this module should call super().create_subparser(parent, storage) (to create the main ‘deploy’ subparser if it doesn’t already exist) then call self.subparsers.add_parser() to add their own sub-subparser.

  • parent (object) – Subparser grouping object returned by ArgumentParser.add_subparsers()
  • storage (dict) – Dict of { ‘label’: subparser } to be updated with subparser(s) created, if any.

Check whether the module is ready to run().

Returns:(True, ready_message) or (False, reason_why_not)

Do the actual work of this submodule.


VM configuration profile to use for deployment.

Raise:InvalidInputError if not a profile defined in the VM.
generic_parser = None

Generic parser object providing args that most subclasses will use.

Subclasses can call self.subparsers.add_parser(parents=[self.generic_parser]) to automatically inherit this set of args


Hypervisor to deploy to.

Raise:InvalidInputError if not a recognized value.

Mapping of network names to networks.

password = None

Server login password.


Whether to automatically power on the VM after deployment.


Mapping of serial ports to various connection types.

subparsers = None

Subparser grouping for hypervisor-specific sub-subparsers.

Subclasses should generally have their create_subparser() implementations create their sub-subparsers under subparsers and NOT under parent.

username = None

Server login username.

vm_name = None

Name of the created virtual machine

class SerialConnection(kind, value, options)[source]

Generic class defining a serial port connection.

classmethod from_cli_string(cli_string)[source]

Parse a string ‘kind:value[,opts]’ to build a SerialConnection.

Based on the QEMU CLI for serial ports.

classmethod validate_kind(kind)[source]

Validate the connection type string and munge it as needed.

Parameters:kind (str) – Connection type string, possibly in need of munging.
Returns:A valid type string
Raises ValueUnsupportedError:
 if type string is not recognized as valid
classmethod validate_options(kind, value, options)[source]

Check that the given set of options are valid for this connection.

  • kind (str) – Validated ‘kind’ string.
  • value (str) – Validated ‘value’ string.
  • options (dict) – Input options dictionary.

validated options dict

Raises InvalidInputError:

if options are not valid.

classmethod validate_value(kind, value)[source]

Check that the given value is valid for the given connection kind.

  • kind (str) – Connection type, valid per validate_kind().
  • value (str) – Connection value such as ‘/dev/ttyS0’ or ‘’

Munged value string.

Raises InvalidInputError:

if value string is not recognized as valid