Skip to main content

Quota

The Quota class provides an interface to access OpenStack project quotas, allowing you to retrieve limit values for various resources such as cores, instances, RAM, volumes, and network resources.

Constructor

Quota(data)
Initialize a Quota instance.
data
list
required
A list of quota resources with their limits. Each item in the list should be a dictionary with Resource and Limit keys.Example format:
[
  {"Resource": "cores", "Limit": 10},
  {"Resource": "instances", "Limit": 10},
  {"Resource": "ram", "Limit": 51200}
]

Properties

Compute Quotas

cores
int
Returns the quota limit for CPU cores.
instances
int
Returns the quota limit for instances.
ram
int
Returns the quota limit for RAM (in MB).
key_pairs
int
Returns the quota limit for key pairs.
server_groups
int
Returns the quota limit for server groups.
server_group_members
int
Returns the quota limit for server group members.
injected_files
int
Returns the quota limit for injected files.
injected_file_size
int
Returns the quota limit for injected file size.
injected_path_size
int
Returns the quota limit for injected path size.

Storage Quotas

volumes
int
Returns the quota limit for volumes.
snapshots
int
Returns the quota limit for snapshots.
gigabytes
int
Returns the quota limit for gigabytes.
backups
int
Returns the quota limit for backups.
backup_gigabytes
int
Returns the quota limit for backup gigabytes.
per_volume_gigabytes
int
Returns the quota limit for per-volume gigabytes.
volumes___DEFAULT__
int
Returns the default volume type quota limit for volumes.
gigabytes___DEFAULT__
int
Returns the default volume type quota limit for gigabytes.
snapshots___DEFAULT__
int
Returns the default volume type quota limit for snapshots.
volumes_rbd
int
Returns the RBD volume type quota limit for volumes.
gigabytes_rbd
int
Returns the RBD volume type quota limit for gigabytes.
snapshots_rbd
int
Returns the RBD volume type quota limit for snapshots.
groups
int
Returns the quota limit for volume groups.

Network Quotas

networks
int
Returns the quota limit for networks.
subnets
int
Returns the quota limit for subnets.
subnet_pools
int
Returns the quota limit for subnet pools.
ports
int
Returns the quota limit for ports.
routers
int
Returns the quota limit for routers.
fixed_ips
int
Returns the quota limit for fixed IPs.
floating_ips
int
Returns the quota limit for floating IPs.
secgroups
int
Returns the quota limit for security groups.
secgroup_rules
int
Returns the quota limit for security group rules.
rbac_policies
int
Returns the quota limit for RBAC policies.

Load Balancer Quotas

load_balancers
int
Returns the quota limit for load balancers.
listeners
int
Returns the quota limit for load balancer listeners.
pools
int
Returns the quota limit for load balancer pools.
health_monitors
int
Returns the quota limit for health monitors.
l7_policies
int
Returns the quota limit for L7 policies.

Other Properties

project_id
str
Returns the project ID associated with these quotas.
properties
int
Returns the quota limit for properties.
check_limit
int
Returns the check limit value.

Usage Example

from myos.quota import Quota

# Initialize quota with data
quota_data = [
    {"Resource": "cores", "Limit": 10},
    {"Resource": "instances", "Limit": 10},
    {"Resource": "ram", "Limit": 51200},
    {"Resource": "volumes", "Limit": 20},
    {"Resource": "floating-ips", "Limit": 5}
]

quota = Quota(data=quota_data)

# Access quota properties
print(quota.cores)        # Get cores limit
print(quota.instances)    # Get instances limit
print(quota.ram)          # Get RAM limit in MB
print(quota.volumes)      # Get volumes limit
print(quota.floating_ips) # Get floating IPs limit

# Check network quotas
print(quota.networks)     # Get networks limit
print(quota.ports)        # Get ports limit
print(quota.routers)      # Get routers limit

Build docs developers (and LLMs) love