Skip to main content

Hypervisor

The Hypervisor class provides an interface to interact with OpenStack hypervisors, allowing you to retrieve information about hypervisor hosts and the servers running on them.

Constructor

Hypervisor(hypervisor_id=None, name=None, cloud=Cloud())
Initialize a Hypervisor instance.
hypervisor_id
str
The unique identifier of the hypervisor. Either hypervisor_id or name should be provided.
name
str
The hostname of the hypervisor. Either hypervisor_id or name should be provided.
cloud
Cloud
default:"Cloud()"
The Cloud instance to use for OpenStack operations. Defaults to a new Cloud instance.

Properties

hostname

@property
def hostname(self) -> str
hostname
str
Returns the hostname associated to this Hypervisor.

name

@property
def name(self) -> str
name
str
Returns the hostname associated to this Hypervisor. Note: name and hostname are the same thing for this class.

id

@property
def id(self) -> str
id
str
Returns the hypervisor_id associated to this Hypervisor.

status

@property
def status(self) -> str
status
str
Returns the status of this Hypervisor.

state

@property
def state(self) -> str
state
str
Returns the state of this Hypervisor.

servers

@property
def servers(self) -> EntityList
servers
EntityList
Returns the list of Servers running on this Hypervisor.

Usage Example

from myos.hypervisor import Hypervisor

# Initialize hypervisor by name
hv = Hypervisor(name='hv-a100x8-8.nubes.rl.ac.uk')

# Access hypervisor properties
print(hv.id)       # Get hypervisor ID
print(hv.status)   # Get hypervisor status
print(hv.state)    # Get hypervisor state

# List servers on this hypervisor
print(len(hv.servers))  # Count of servers

for server in hv.servers:
    print(server.id)

Build docs developers (and LLMs) love