COT.deploy_esxi module

Module for deploying VMs to ESXi, vCenter, and vSphere.

Classes

COTDeployESXi Submodule for deploying VMs on ESXi and VMware vCenter/vSphere.
SmarterConnection A smarter version of pyVmomi’s SmartConnection context manager.
PyVmomiVMReconfigSpec Context manager for reconfiguring an ESXi VM using PyVmomi.
class COTDeployESXi(UI)[source]

Bases: COT.deploy.COTDeploy

Submodule for deploying VMs on ESXi and VMware vCenter/vSphere.

Inherited attributes: UI, package, generic_parser, parser, subparsers, hypervisor, configuration, username, password, power_on, vm_name, network_map serial_connection

Attributes: locator, datastore, ovftool_args

create_subparser(parent, storage)[source]

Add subparser for the CLI of this submodule.

This will create the shared parser under parent, then create our own sub-subparser under subparsers.

Parameters:
  • 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.
fixup_serial_ports(serial_count)[source]

Use PyVmomi to create and configure serial ports for the new VM.

ready_to_run()[source]

Check whether the module is ready to run().

Returns:(True, ready_message) or (False, reason_why_not)
run()[source]

Do the actual work of this submodule - deploying to ESXi.

Raises InvalidInputError:
 if ready_to_run() reports False
datastore = None

ESXi datastore to deploy to.

host = None

vSphere host to deploy to - set implicitly by self.locator.

locator

Target vSphere locator.

ovftool_args

List of CLI arguments to pass through to ovftool.

serial_connection

Mapping of serial ports to various connection types.

server = None

vCenter server or vSphere host - set implicitly by self.locator.

class PyVmomiVMReconfigSpec(conn, vm_name)[source]

Context manager for reconfiguring an ESXi VM using PyVmomi.

get_obj(conn, vimtype, name)[source]

Look up an object by name.

class SmarterConnection(UI, server, username, password, port=443)[source]

Bases: pyVim.connect.SmartConnection

A smarter version of pyVmomi’s SmartConnection context manager.