Module sysbot.modules.virtualization.vmware.vsphere
VMware vSphere Module
This module provides methods for managing VMware vSphere environments including virtual machines, hosts, datastores, clusters, and resource pools using the vCenter REST API. Requires HTTP session with Basic authentication.
Classes
class Vsphere-
VMware vSphere module for managing virtual machines, hosts, and datastores. Requires a session opened with protocol="http", product="basicauth".
Ancestors
Methods
def get_cluster(self, alias: str, cluster_id: str, **kwargs) ‑> dict-
Get detailed information about a specific cluster.
Args
alias:str- Session alias.
cluster_id:str- Cluster identifier.
Returns
dict- Cluster detailed information.
def get_datacenter(self, alias: str, datacenter_id: str, **kwargs) ‑> dict-
Get detailed information about a specific datacenter.
Args
alias:str- Session alias.
datacenter_id:str- Datacenter identifier.
Returns
dict- Datacenter detailed information.
def get_datastore(self, alias: str, datastore_id: str, **kwargs) ‑> dict-
Get detailed information about a specific datastore.
Args
alias:str- Session alias.
datastore_id:str- Datastore identifier.
Returns
dict- Datastore detailed information.
def get_host(self, alias: str, host_id: str, **kwargs) ‑> dict-
Get detailed information about a specific host.
Args
alias:str- Session alias.
host_id:str- Host identifier.
Returns
dict- Host detailed information.
def get_network(self, alias: str, network_id: str, **kwargs) ‑> dict-
Get detailed information about a specific network.
Args
alias:str- Session alias.
network_id:str- Network identifier.
Returns
dict- Network detailed information.
def get_timezone(self, alias: str, **kwargs) ‑> str-
Get the configured timezone of vCenter Server.
Args
alias:str- Session alias.
Returns
str- Timezone identifier (e.g., "UTC", "America/Los_Angeles").
def get_utc_datetime(self, alias: str, **kwargs) ‑> str-
Get the current UTC date and time from vCenter Server.
Args
alias:str- Session alias.
Returns
str- Current UTC date and time in ISO 8601 format.
def get_version(self, alias: str, **kwargs) ‑> dict-
Get vCenter Server version information.
Args
alias:str- Session alias.
Returns
dict- Version information including product, type, version, build, and release date.
def get_vm(self, alias: str, vm_id: str, **kwargs) ‑> dict-
Get detailed information about a specific virtual machine.
Args
alias:str- Session alias.
vm_id:str- Virtual machine identifier.
Returns
dict- VM detailed information.
def get_vm_power_state(self, alias: str, vm_id: str, **kwargs) ‑> str-
Get the power state of a virtual machine.
Args
alias:str- Session alias.
vm_id:str- Virtual machine identifier.
Returns
str- Power state (POWERED_ON, POWERED_OFF, SUSPENDED).
def list_clusters(self, alias: str, **kwargs) ‑> list-
List all clusters in vCenter.
Args
alias:str- Session alias.
Returns
list- List of cluster objects.
def list_datacenters(self, alias: str, **kwargs) ‑> list-
List all datacenters in vCenter.
Args
alias:str- Session alias.
Returns
list- List of datacenter objects.
def list_datastores(self, alias: str, **kwargs) ‑> list-
List all datastores in vCenter.
Args
alias:str- Session alias.
Returns
list- List of datastore objects.
def list_hosts(self, alias: str, **kwargs) ‑> list-
List all ESXi hosts in vCenter.
Args
alias:str- Session alias.
Returns
list- List of host objects.
def list_networks(self, alias: str, **kwargs) ‑> list-
List all networks in vCenter.
Args
alias:str- Session alias.
Returns
list- List of network objects.
def list_vms(self, alias: str, **kwargs) ‑> list-
List all virtual machines in vCenter.
Args
alias:str- Session alias.
Returns
list- List of VM objects with basic information.
def power_off_vm(self, alias: str, vm_id: str, **kwargs) ‑> dict-
Power off a virtual machine.
Args
alias:str- Session alias.
vm_id:str- Virtual machine identifier.
Returns
dict- Operation result.
def power_on_vm(self, alias: str, vm_id: str, **kwargs) ‑> dict-
Power on a virtual machine.
Args
alias:str- Session alias.
vm_id:str- Virtual machine identifier.
Returns
dict- Operation result.
def reset_vm(self, alias: str, vm_id: str, **kwargs) ‑> dict-
Reset a virtual machine.
Args
alias:str- Session alias.
vm_id:str- Virtual machine identifier.
Returns
dict- Operation result.
def suspend_vm(self, alias: str, vm_id: str, **kwargs) ‑> dict-
Suspend a virtual machine.
Args
alias:str- Session alias.
vm_id:str- Virtual machine identifier.
Returns
dict- Operation result.