Skip to main content

Cloud

The Cloud class provides access to OpenStack cloud resources including hypervisors, flavors, images, projects, and floating IPs.

Constructor

Cloud(cloud="admin")
cloud
str
default:"admin"
The name of the cloud configuration to use from your OpenStack configuration

Properties

hypervisors
EntityList[Hypervisor]
Returns the entire list of Hypervisor objects for this cloud instance
cloud = Cloud("admin")
hypervisors = cloud.hypervisors
print(len(hypervisors))
flavors
EntityList[Flavor]
Returns the entire list of Flavor objects for this cloud instance
cloud = Cloud("admin")
flavors = cloud.flavors
for flavor in flavors:
    print(flavor.name)
images
EntityList[Image]
Returns the entire list of Image objects for this cloud instance
cloud = Cloud("admin")
images = cloud.images
for image in images:
    print(image.name)
projects
EntityList[Project]
Returns the entire list of Project objects for this cloud instance
cloud = Cloud("admin")
projects = cloud.projects
for project in projects:
    print(project.name)
fips
EntityList[FloatingIP]
Returns the entire list of FloatingIP objects for this cloud instance
cloud = Cloud("admin")
fips = cloud.fips
print(f"Total floating IPs: {len(fips)}")

Usage Example

from myos.cloud import Cloud

# Initialize cloud connection
cloud = Cloud("admin")

# Get all hypervisors
hypervisors = cloud.hypervisors
print(f"Available hypervisors: {len(hypervisors)}")

# Get all flavors
flavors = cloud.flavors
for flavor in flavors:
    print(f"Flavor: {flavor.name}")

# Get all projects
projects = cloud.projects
for project in projects:
    print(f"Project: {project.name} (ID: {project.id})")

# Get floating IPs
fips = cloud.fips
for fip in fips:
    print(f"Floating IP: {fip.ip}")

Build docs developers (and LLMs) love