octavia.db package¶
Submodules¶
octavia.db.api module¶
octavia.db.base_models module¶
- class IdMixin[source]¶
Bases:
object
Id mixin, add to subclasses that have an id.
- id = Column(None, String(length=36), table=None, primary_key=True, nullable=False, default=CallableColumnDefault(<function generate_uuid>))¶
- class LookupTableMixin[source]¶
Bases:
object
Mixin to add to classes that are lookup tables.
- description = Column(None, String(length=255), table=None)¶
- name = Column(None, String(length=255), table=None, primary_key=True, nullable=False)¶
- class NameMixin[source]¶
Bases:
object
Name mixin to add to classes which need a name.
- name = Column(None, String(length=255), table=None)¶
- class OctaviaBase[source]¶
Bases:
ModelBase
- to_data_model(_graph_nodes=None, recursion_depth: int | None = None)[source]¶
Converts to a data model graph.
In order to make the resulting data model graph usable no matter how many internal references are followed, we generate a complete graph of OctaviaBase nodes connected to the object passed to this method.
- Parameters:
_graph_nodes – Used only for internal recursion of this method. Should not be called from the outside. Contains a dictionary of all OctaviaBase type objects in the generated graph
recursion_depth – Used only for configuring recursion. This option allows to limit recursion depth. It could be used when we need only main node and its first level relationships. It allows to save time on recursion calls for huge graphs, when only main object is necessary.
- class ProjectMixin[source]¶
Bases:
object
Tenant mixin, add to subclasses that have a project.
- project_id = Column(None, String(length=36), table=None)¶
octavia.db.healthcheck module¶
- check_database_connection(session)[source]¶
This is a simple database connection check function.
It will do a simple no-op query (low overhead) against the sqlalchemy session passed in.
- Parameters:
session – A Sql Alchemy database session.
- Returns:
True if the connection check is successful, False if not.
octavia.db.models module¶
- class AdditionalVip(**kwargs)[source]¶
Bases:
Base
- ip_address¶
- load_balancer¶
- load_balancer_id¶
- network_id¶
- port_id¶
- subnet_id¶
- class Algorithm(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class Amphora(**kwargs)[source]¶
Bases:
Base
,IdMixin
,TimestampMixin
- cached_zone¶
- cert_busy¶
- cert_expiration¶
- compute_flavor¶
- compute_id¶
- created_at¶
- ha_ip¶
- ha_port_id¶
- id¶
- image_id¶
- lb_network_ip¶
- load_balancer¶
- load_balancer_id¶
- role¶
- status¶
- updated_at¶
- vrrp_id¶
- vrrp_interface¶
- vrrp_ip¶
- vrrp_port_id¶
- vrrp_priority¶
- class AmphoraBuildRequest(**kwargs)[source]¶
Bases:
Base
- amphora_id¶
- created_time¶
- priority¶
- status¶
- class AmphoraRoles(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class AvailabilityZone(**kwargs)[source]¶
Bases:
Base
,NameMixin
- availability_zone_profile: Mapped[AvailabilityZoneProfile]¶
- availability_zone_profile_id¶
- description¶
- enabled¶
- name¶
- class AvailabilityZoneProfile(**kwargs)[source]¶
Bases:
Base
,IdMixin
,NameMixin
- availability_zone_data¶
- id¶
- name¶
- provider_name¶
- class Flavor(**kwargs)[source]¶
Bases:
Base
,IdMixin
,NameMixin
- description¶
- enabled¶
- flavor_profile: Mapped[FlavorProfile]¶
- flavor_profile_id¶
- id¶
- name¶
- class FlavorProfile(**kwargs)[source]¶
Bases:
Base
,IdMixin
,NameMixin
- flavor_data¶
- id¶
- name¶
- provider_name¶
- class HealthMonitor(**kwargs)[source]¶
Bases:
Base
,IdMixin
,ProjectMixin
,TimestampMixin
,NameMixin
,TagMixin
- created_at¶
- delay¶
- domain_name¶
- enabled¶
- expected_codes¶
- fall_threshold¶
- http_method¶
- http_version¶
- id¶
- name¶
- operating_status¶
- pool¶
- pool_id¶
- project_id¶
- provisioning_status¶
- rise_threshold¶
- timeout¶
- type¶
- updated_at¶
- url_path¶
- class HealthMonitorType(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class L7Policy(**kwargs)[source]¶
Bases:
Base
,IdMixin
,ProjectMixin
,TimestampMixin
,NameMixin
,TagMixin
- action¶
- created_at¶
- description¶
- enabled¶
- id¶
- l7rules¶
- listener¶
- listener_id¶
- name¶
- operating_status¶
- position¶
- project_id¶
- provisioning_status¶
- redirect_http_code¶
- redirect_pool¶
- redirect_pool_id¶
- redirect_prefix¶
- redirect_url¶
- updated_at¶
- class L7PolicyAction(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class L7Rule(**kwargs)[source]¶
Bases:
Base
,IdMixin
,ProjectMixin
,TimestampMixin
,TagMixin
- compare_type¶
- created_at¶
- enabled¶
- id¶
- invert¶
- key¶
- l7policy¶
- l7policy_id¶
- operating_status¶
- project_id¶
- provisioning_status¶
- type¶
- updated_at¶
- value¶
- class L7RuleCompareType(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class L7RuleType(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class LBTopology(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class Listener(**kwargs)[source]¶
Bases:
Base
,IdMixin
,ProjectMixin
,TimestampMixin
,NameMixin
,TagMixin
- allowed_cidrs¶
- alpn_protocols¶
- client_authentication¶
- client_ca_tls_certificate_id¶
- client_crl_container_id¶
- connection_limit¶
- created_at¶
- default_pool¶
- default_pool_id¶
- description¶
- enabled¶
- hsts_include_subdomains¶
- hsts_max_age¶
- hsts_preload¶
- id¶
- insert_headers¶
- l7policies¶
- load_balancer¶
- load_balancer_id¶
- name¶
- operating_status¶
- peer_port¶
- property pools¶
- project_id¶
- protocol¶
- protocol_port¶
- provisioning_status¶
- sni_containers¶
- timeout_client_data¶
- timeout_member_connect¶
- timeout_member_data¶
- timeout_tcp_inspect¶
- tls_certificate_id¶
- tls_ciphers¶
- tls_versions¶
- updated_at¶
- class ListenerStatistics(**kwargs)[source]¶
Bases:
Base
- active_connections¶
- amphora_id¶
- bytes_in¶
- bytes_out¶
- listener_id¶
- request_errors¶
- total_connections¶
- class LoadBalancer(**kwargs)[source]¶
Bases:
Base
,IdMixin
,ProjectMixin
,TimestampMixin
,NameMixin
,TagMixin
- additional_vips¶
- amphorae¶
- availability_zone¶
- created_at¶
- description¶
- enabled¶
- flavor_id¶
- id¶
- listeners¶
- name¶
- operating_status¶
- pools¶
- project_id¶
- provider¶
- provisioning_status¶
- server_group_id¶
- topology¶
- updated_at¶
- vip¶
- vrrp_group¶
- class Member(**kwargs)[source]¶
Bases:
Base
,IdMixin
,ProjectMixin
,TimestampMixin
,NameMixin
,TagMixin
- backup¶
- created_at¶
- enabled¶
- id¶
- ip_address¶
- monitor_address¶
- monitor_port¶
- name¶
- operating_status¶
- pool¶
- pool_id¶
- project_id¶
- protocol_port¶
- provisioning_status¶
- subnet_id¶
- updated_at¶
- weight¶
- class OperatingStatus(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class Pool(**kwargs)[source]¶
Bases:
Base
,IdMixin
,ProjectMixin
,TimestampMixin
,NameMixin
,TagMixin
- alpn_protocols¶
- ca_tls_certificate_id¶
- created_at¶
- crl_container_id¶
- description¶
- enabled¶
- health_monitor¶
- id¶
- l7policies¶
- lb_algorithm¶
- property listeners¶
- load_balancer¶
- load_balancer_id¶
- members¶
- name¶
- operating_status¶
- project_id¶
- protocol¶
- provisioning_status¶
- session_persistence¶
- tls_certificate_id¶
- tls_ciphers¶
- tls_enabled¶
- tls_versions¶
- updated_at¶
- class Protocol(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class ProvisioningStatus(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class Quotas(**kwargs)[source]¶
Bases:
Base
- health_monitor¶
- in_use_health_monitor¶
- in_use_l7policy¶
- in_use_l7rule¶
- in_use_listener¶
- in_use_load_balancer¶
- in_use_member¶
- in_use_pool¶
- l7policy¶
- l7rule¶
- listener¶
- load_balancer¶
- member¶
- pool¶
- project_id¶
- class SessionPersistence(**kwargs)[source]¶
Bases:
Base
- cookie_name¶
- persistence_granularity¶
- persistence_timeout¶
- pool¶
- pool_id¶
- type¶
- class SessionPersistenceType(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
- class VRRPAuthMethod(**kwargs)[source]¶
Bases:
Base
,LookupTableMixin
- description¶
- name¶
octavia.db.prepare module¶
octavia.db.repositories module¶
Defines interface for DB access that Resource or Octavia Controllers may reference
- class AdditionalVipRepository[source]¶
Bases:
BaseRepository
- model_class¶
alias of
AdditionalVip
- class AmphoraBuildReqRepository[source]¶
Bases:
BaseRepository
- add_to_build_queue(session, amphora_id=None, priority=None)[source]¶
Adds the build request to the table.
- get_highest_priority_build_req(session)[source]¶
Fetches build request with highest priority and least created_time.
priority 20 = failover (highest) priority 40 = create_loadbalancer (lowest) :param session: A Sql Alchemy database session. :returns amphora_id corresponding to highest priority and least created time in ‘WAITING’ status.
- model_class¶
alias of
AmphoraBuildRequest
- class AmphoraBuildSlotsRepository[source]¶
Bases:
BaseRepository
- get_used_build_slots_count(session)[source]¶
Gets the number of build slots in use.
- Returns:
Number of current build slots.
- model_class¶
alias of
AmphoraBuildSlots
- class AmphoraHealthRepository[source]¶
Bases:
BaseRepository
- check_amphora_health_expired(session, amphora_id, exp_age=None)[source]¶
check if a specific amphora is expired in the amphora_health table
- Parameters:
session – A Sql Alchemy database session.
amphora_id – id of an amphora object
exp_age – A standard datetime delta which is used to see for how long can an amphora live without updates before it is considered expired (default: CONF.house_keeping.amphora_expiry_age)
- Returns:
boolean
- get_stale_amphora(lock_session: Session) Amphora | None [source]¶
Retrieves a stale amphora from the health manager database.
- Parameters:
lock_session – A Sql Alchemy database autocommit session.
- Returns:
[octavia.common.data_model]
- model_class¶
alias of
AmphoraHealth
- class AmphoraRepository[source]¶
Bases:
BaseRepository
- allocate_and_associate(session, load_balancer_id, availability_zone=None)[source]¶
Allocate an amphora for a load balancer.
For v0.5 this is simple, find a free amp and associate the lb. In the future this needs to be enhanced.
- Parameters:
session – A Sql Alchemy database session.
load_balancer_id – The load balancer id to associate
- Returns:
The amphora ID for the load balancer or None
- associate(session, load_balancer_id, amphora_id)[source]¶
Associates an amphora with a load balancer.
- Parameters:
session – A Sql Alchemy database session.
load_balancer_id – The load balancer id to associate
amphora_id – The amphora id to associate
- get_all_API_list(session, pagination_helper=None, **filters)[source]¶
Get a list of amphorae for the API list call.
This get_all returns a data set that is only one level deep in the data graph. This is an optimized query for the API amphora list method.
- Parameters:
session – A Sql Alchemy database session.
pagination_helper – Helper to apply pagination and sorting.
filters – Filters to decide which entities should be retrieved.
- Returns:
[octavia.common.data_model]
- get_cert_expiring_amphora(session)[source]¶
Retrieves an amphora whose cert is close to expiring..
- Parameters:
session – A Sql Alchemy database session.
- Returns:
one amphora with expiring certificate
- static get_lb_for_amphora(session, amphora_id)[source]¶
Get all of the load balancers on an amphora.
- Parameters:
session – A Sql Alchemy database session.
amphora_id – The amphora id to list the load balancers from
- Returns:
[octavia.common.data_model]
- get_lb_for_health_update(session, amphora_id)[source]¶
This method is for the health manager status update process.
This is a time sensitive query that occurs often. It is an explicit query as the ORM produces a poorly optimized query.
Use extreme caution making any changes to this query as it can impact the scalability of the health manager. All changes should be analyzed using SQL “EXPLAIN” to make sure only indexes are being used. Changes should also be evaluated using the stressHM tool.
- Note: The returned object is flat and not a graph representation
of the load balancer as it is not needed. This is on purpose to optimize the processing time. This is not in the normal data model objects.
- Parameters:
session – A Sql Alchemy database session.
amphora_id – The amphora ID to lookup the load balancer for.
- Returns:
A dictionary containing the required load balancer details.
- test_and_set_status_for_delete(lock_session, id)[source]¶
Tests and sets an amphora status.
Puts a lock on the amphora table to check the status of the amphora. The status must be either AMPHORA_READY or ERROR to successfully update the amphora status.
- Parameters:
lock_session – A Sql Alchemy database session.
id – id of Load Balancer
- Raises:
ImmutableObject – The amphora is not in a state that can be deleted.
NoResultFound – The amphora was not found or already deleted.
- Returns:
None
- class AvailabilityZoneProfileRepository[source]¶
Bases:
_GetALLExceptDELETEDIdMixin
,BaseRepository
- model_class¶
alias of
AvailabilityZoneProfile
- class AvailabilityZoneRepository[source]¶
Bases:
_GetALLExceptDELETEDIdMixin
,BaseRepository
- delete(serial_session, **filters)[source]¶
Special delete method for availability_zone.
Sets DELETED LBs availability_zone to NIL_UUID, then removes the availability_zone.
- Parameters:
serial_session – A Sql Alchemy database transaction session.
filters – Filters to decide which entity should be deleted.
- Returns:
None
- Raises:
odb_exceptions.DBReferenceError
- Raises:
sqlalchemy.orm.exc.NoResultFound
- model_class¶
alias of
AvailabilityZone
- class BaseRepository[source]¶
Bases:
object
- count(session, **filters)[source]¶
Retrieves a count of entities from the database.
- Parameters:
session – A Sql Alchemy database session.
filters – Filters to decide which entities should be retrieved.
- Returns:
int
- create(session, **model_kwargs)[source]¶
Base create method for a database entity.
- Parameters:
session – A Sql Alchemy database session.
model_kwargs – Attributes of the model to insert.
- Returns:
octavia.common.data_model
- delete(session, **filters)[source]¶
Deletes an entity from the database.
- Parameters:
session – A Sql Alchemy database session.
filters – Filters to decide which entity should be deleted.
- Returns:
None
- Raises:
sqlalchemy.orm.exc.NoResultFound
- exists(session, id)[source]¶
Determines whether an entity exists in the database by its id.
- Parameters:
session – A Sql Alchemy database session.
id – id of entity to check for existence.
- Returns:
octavia.common.data_model
- get(session, limited_graph=False, **filters)[source]¶
Retrieves an entity from the database.
- Parameters:
session – A Sql Alchemy database session.
limited_graph – Option controls number of processed nodes in the graph. Default (with False) behaviour is recursion iteration through all nodes in the graph via to_data_model. With True value recursion will stop at the first child node. It means, that only limited number of nodes be converted. This logic could be used for specific cases, where information about full graph is unnecessary.
filters – Filters to decide which entity should be retrieved.
- Returns:
octavia.common.data_model
- get_all(session, pagination_helper=None, query_options=None, limited_graph=False, **filters)[source]¶
Retrieves a list of entities from the database.
- Parameters:
session – A Sql Alchemy database session.
pagination_helper – Helper to apply pagination and sorting.
query_options – Optional query options to apply.
limited_graph – Option controls number of processed nodes in the graph. Default (with False) behaviour is recursion iteration through all nodes in the graph via to_data_model. With True value recursion will stop at the first child node. It means, that only limited number of nodes be converted. This logic could be used for specific cases, where information about full graph is unnecessary.
filters – Filters to decide which entities should be retrieved.
- Returns:
[octavia.common.data_model]
- get_all_deleted_expiring(session, exp_age)[source]¶
Get all previously deleted resources that are now expiring.
- Parameters:
session – A Sql Alchemy database session.
exp_age – A standard datetime delta which is used to see for how long can a resource live without updates before it is considered expired
- Returns:
A list of resource IDs
- model_class = None¶
- class FlavorProfileRepository[source]¶
Bases:
_GetALLExceptDELETEDIdMixin
,BaseRepository
- model_class¶
alias of
FlavorProfile
- class FlavorRepository[source]¶
Bases:
_GetALLExceptDELETEDIdMixin
,BaseRepository
- delete(serial_session, **filters)[source]¶
Sets DELETED LBs flavor_id to NIL_UUID, then removes the flavor
- Parameters:
serial_session – A Sql Alchemy database transaction session.
filters – Filters to decide which entity should be deleted.
- Returns:
None
- Raises:
odb_exceptions.DBReferenceError
- Raises:
sqlalchemy.orm.exc.NoResultFound
- class HealthMonitorRepository[source]¶
Bases:
BaseRepository
- get_all_API_list(session, pagination_helper=None, **filters)[source]¶
Get a list of health monitors for the API list call.
This get_all returns a data set that is only one level deep in the data graph. This is an optimized query for the API health monitor list method.
- Parameters:
session – A Sql Alchemy database session.
pagination_helper – Helper to apply pagination and sorting.
filters – Filters to decide which entities should be retrieved.
- Returns:
[octavia.common.data_model]
- model_class¶
alias of
HealthMonitor
- class L7PolicyRepository[source]¶
Bases:
BaseRepository
- create(session, **model_kwargs)[source]¶
Base create method for a database entity.
- Parameters:
session – A Sql Alchemy database session.
model_kwargs – Attributes of the model to insert.
- Returns:
octavia.common.data_model
- delete(session, id, **filters)[source]¶
Deletes an entity from the database.
- Parameters:
session – A Sql Alchemy database session.
filters – Filters to decide which entity should be deleted.
- Returns:
None
- Raises:
sqlalchemy.orm.exc.NoResultFound
- get_all(session, pagination_helper=None, **filters)[source]¶
Retrieves a list of entities from the database.
- Parameters:
session – A Sql Alchemy database session.
pagination_helper – Helper to apply pagination and sorting.
query_options – Optional query options to apply.
limited_graph – Option controls number of processed nodes in the graph. Default (with False) behaviour is recursion iteration through all nodes in the graph via to_data_model. With True value recursion will stop at the first child node. It means, that only limited number of nodes be converted. This logic could be used for specific cases, where information about full graph is unnecessary.
filters – Filters to decide which entities should be retrieved.
- Returns:
[octavia.common.data_model]
- class L7RuleRepository[source]¶
Bases:
BaseRepository
- create(session, **model_kwargs)[source]¶
Base create method for a database entity.
- Parameters:
session – A Sql Alchemy database session.
model_kwargs – Attributes of the model to insert.
- Returns:
octavia.common.data_model
- get_all_API_list(session, pagination_helper=None, **filters)[source]¶
Get a list of L7 Rules for the API list call.
This get_all returns a data set that is only one level deep in the data graph. This is an optimized query for the API L7 Rule list method.
- Parameters:
session – A Sql Alchemy database session.
pagination_helper – Helper to apply pagination and sorting.
filters – Filters to decide which entities should be retrieved.
- Returns:
[octavia.common.data_model]
- class ListenerCidrRepository[source]¶
Bases:
BaseRepository
- create(session, listener_id, allowed_cidrs)[source]¶
Base create method for a database entity.
- Parameters:
session – A Sql Alchemy database session.
model_kwargs – Attributes of the model to insert.
- Returns:
octavia.common.data_model
- model_class¶
alias of
ListenerCidr
- class ListenerRepository[source]¶
Bases:
BaseRepository
- get_all_API_list(session, pagination_helper=None, **filters)[source]¶
Get a list of listeners for the API list call.
This get_all returns a data set that is only one level deep in the data graph. This is an optimized query for the API listener list method.
- Parameters:
session – A Sql Alchemy database session.
pagination_helper – Helper to apply pagination and sorting.
filters – Filters to decide which entities should be retrieved.
- Returns:
[octavia.common.data_model]
- class ListenerStatisticsRepository[source]¶
Bases:
BaseRepository
- increment(session, delta_stats)[source]¶
Updates a listener’s statistics, incrementing by the passed deltas.
- Parameters:
session – A Sql Alchemy database session
delta_stats (octavia.common.data_models.ListenerStatistics) – Listener statistics deltas to add
- model_class¶
alias of
ListenerStatistics
- replace(session, stats_obj)[source]¶
Create or override a listener’s statistics (insert/update)
- Parameters:
session – A Sql Alchemy database session
stats_obj (octavia.common.data_models.ListenerStatistics) – Listener statistics object to store
- class LoadBalancerRepository[source]¶
Bases:
BaseRepository
- get_all_API_list(session, pagination_helper=None, **filters)[source]¶
Get a list of load balancers for the API list call.
This get_all returns a data set that is only one level deep in the data graph. This is an optimized query for the API load balancer list method.
- Parameters:
session – A Sql Alchemy database session.
pagination_helper – Helper to apply pagination and sorting.
filters – Filters to decide which entities should be retrieved.
- Returns:
[octavia.common.data_model]
- model_class¶
alias of
LoadBalancer
- set_status_for_failover(session, id, status, raise_exception=False)[source]¶
Tests and sets a load balancer provisioning status.
Puts a lock on the load balancer table to check the status of a load balancer. If the status is ACTIVE or ERROR then the status of the load balancer is updated and the method returns True. If the status is not ACTIVE, then nothing is done and False is returned.
- Parameters:
session – A Sql Alchemy database session.
id – id of Load Balancer
status – Status to set Load Balancer if check passes.
raise_exception – If True, raise ImmutableObject on failure
- Returns:
bool
- test_and_set_provisioning_status(session, id, status, raise_exception=False)[source]¶
Tests and sets a load balancer and provisioning status.
Puts a lock on the load balancer table to check the status of a load balancer. If the status is ACTIVE then the status of the load balancer is updated and the method returns True. If the status is not ACTIVE, then nothing is done and False is returned.
- Parameters:
session – A Sql Alchemy database session.
id – id of Load Balancer
status – Status to set Load Balancer if check passes.
raise_exception – If True, raise ImmutableObject on failure
- Returns:
bool
- class MemberRepository[source]¶
Bases:
BaseRepository
- get_all_API_list(session, pagination_helper=None, limited_graph=False, **filters)[source]¶
Get a list of members for the API list call.
This get_all returns a data set that is only one level deep in the data graph. This is an optimized query for the API member list method.
- Parameters:
session – A Sql Alchemy database session.
pagination_helper – Helper to apply pagination and sorting.
limited_graph – Option to avoid recursion iteration through all nodes in the graph via to_data_model
filters – Filters to decide which entities should be retrieved.
- Returns:
[octavia.common.data_model]
- class PoolRepository[source]¶
Bases:
BaseRepository
- get_all_API_list(session, pagination_helper=None, **filters)[source]¶
Get a list of pools for the API list call.
This get_all returns a data set that is only one level deep in the data graph. This is an optimized query for the API pool list method.
- Parameters:
session – A Sql Alchemy database session.
pagination_helper – Helper to apply pagination and sorting.
filters – Filters to decide which entities should be retrieved.
- Returns:
[octavia.common.data_model]
- class QuotasRepository[source]¶
Bases:
BaseRepository
- class Repositories[source]¶
Bases:
object
- check_quota_met(session: Session, _class, project_id, count=1)[source]¶
Checks and updates object quotas.
This method makes sure the project has available quota for the resource and updates the quota to reflect the new ussage.
- Parameters:
session – Context database session
_class – Data model object requesting quota
project_id – Project ID requesting quota
count – Number of objects we’re going to create (default=1)
- Returns:
True if quota is met, False if quota was available
- create_load_balancer_and_vip(session, lb_dict, vip_dict, additional_vip_dicts=None)[source]¶
Inserts load balancer and vip entities into the database.
Inserts load balancer and vip entities into the database in one transaction and returns the data model of the load balancer.
- Parameters:
session – A Sql Alchemy database session.
lb_dict – Dictionary representation of a load balancer
vip_dict – Dictionary representation of a vip
additional_vip_dicts – Dict representations of additional vips
- Returns:
octavia.common.data_models.LoadBalancer
- create_pool_on_load_balancer(session, pool_dict, listener_id=None)[source]¶
Inserts a pool and session persistence entity into the database.
- Parameters:
session – A Sql Alchemy database session.
pool_dict – Dictionary representation of a pool
listener_id – Optional listener id that will reference this pool as its default_pool_id
- Returns:
octavia.common.data_models.Pool
- decrement_quota(lock_session, _class, project_id, quantity=1)[source]¶
Decrements the object quota for a project
- Parameters:
lock_session – Locking database session (autocommit=False)
_class – Data model object to decrement quota
project_id – Project ID to decrement quota on
quantity – Quantity of quota to decrement
- Returns:
None
- get_amphora_stats(session, amp_id)[source]¶
Gets the statistics for all listeners on an amphora.
- Parameters:
session – A Sql Alchemy database session.
amp_id – The amphora ID to query.
- Returns:
An amphora stats dictionary
- test_and_set_lb_and_listeners_prov_status(session, lb_id, lb_prov_status, listener_prov_status, listener_ids=None, pool_id=None, l7policy_id=None)[source]¶
Tests and sets a load balancer and listener provisioning status.
Puts a lock on the load balancer table to check the status of a load balancer. If the status is ACTIVE then the status of the load balancer and listener is updated and the method returns True. If the status is not ACTIVE, then nothing is done and False is returned.
- Parameters:
session – A Sql Alchemy database session.
lb_id – ID of the Load Balancer to check and lock
lb_prov_status – Status to set Load Balancer and Listener if check passes.
listener_prov_status – Status to set Listeners if check passes
listener_ids – List of IDs of listeners to check and lock (only use this when relevant to the operation)
pool_id – ID of the Pool to check and lock (only use this when relevant to the operation)
l7policy_id – ID of the L7Policy to check and lock (only use this when relevant to the operation)
- Returns:
bool
- class SNIRepository[source]¶
Bases:
BaseRepository
- class SessionPersistenceRepository[source]¶
Bases:
BaseRepository
- model_class¶
alias of
SessionPersistence
- class VRRPGroupRepository[source]¶
Bases:
BaseRepository