COT.deploy
module¶
Module for deploying VM descriptions to a hypervisor to instantiate VMs.
Classes
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
()[source]¶ Create ‘deploy’ CLI subparser if it doesn’t already exist.
Note
Unlike most submodules, this one has subparsers of its own -
'cot deploy PACKAGE <hypervisor>'
so subclasses of this module should callsuper().create_subparser()
(to create the main ‘deploy’ subparser if it doesn’t already exist) then callself.UI.add_parser(..., parent=self.subparsers, ...)
to add their own sub-subparser.
-
ready_to_run
()[source]¶ Check whether the module is ready to
run()
.Returns: (True, ready_message)
or(False, reason_why_not)
-
configuration
¶ 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
¶ Hypervisor to deploy to.
Raise: InvalidInputError
if not a recognized value.
-
network_map
¶ Mapping of network names to networks.
-
password
= None¶ Server login password.
-
power_on
¶ Whether to automatically power on the VM after deployment.
-
serial_connection
¶ 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 withparent=
subparsers
.
-
username
= None¶ Server login username.
-
vm_name
= None¶ Name of the created virtual machine
-
-
class
SerialConnection
(kind, value, options)[source]¶ Bases:
object
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.
Parameters: - kind (str) – Validated ‘kind’ string.
- _value (str) – Validated ‘value’ string. Currently unused.
- options (dict) – Input options dictionary.
Returns: 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.
Parameters: - kind (str) – Connection type, valid per
validate_kind()
. - value (str) – Connection value such as ‘/dev/ttyS0’ or ‘1.1.1.1:80’
Returns: Munged value string.
Raises: InvalidInputError – if value string is not recognized as valid
- kind (str) – Connection type, valid per
-
classmethod