octavia.common package

octavia.common package

Submodules

octavia.common.base_taskflow module

class BaseTaskFlowEngine[source]

Bases: object

This is the task flow engine

Use this engine to start/load flows in the code

octavia.common.clients module

class GlanceAuth[source]

Bases: object

classmethod get_glance_client(region, service_name=None, endpoint=None, endpoint_type='publicURL', insecure=False, cacert=None)[source]

Create glance client object.

Parameters:
  • region – The region of the service
  • service_name – The name of the glance service in the catalog
  • endpoint – The endpoint of the service
  • endpoint_type – The endpoint_type of the service
  • insecure – Turn off certificate validation
  • cacert – CA Cert file path
Returns:

a Glance Client object.

Raises:

Exception – if the client cannot be created

glance_client = None
class NeutronAuth[source]

Bases: object

classmethod get_neutron_client(region, service_name=None, endpoint=None, endpoint_type='publicURL', insecure=False, ca_cert=None)[source]

Create neutron client object.

Parameters:
  • region – The region of the service
  • service_name – The name of the neutron service in the catalog
  • endpoint – The endpoint of the service
  • endpoint_type – The endpoint_type of the service
  • insecure – Turn off certificate validation
  • ca_cert – CA Cert file path
Returns:

a Neutron Client object.

Raises:

Exception – if the client cannot be created

neutron_client = None
class NovaAuth[source]

Bases: object

classmethod get_nova_client(region, service_name=None, endpoint=None, endpoint_type='publicURL', insecure=False, cacert=None)[source]

Create nova client object.

Parameters:
  • region – The region of the service
  • service_name – The name of the nova service in the catalog
  • endpoint – The endpoint of the service
  • endpoint_type – The type of the endpoint
  • insecure – Turn off certificate validation
  • cacert – CA Cert file path
Returns:

a Nova Client object.

Raises:

Exception – if the client cannot be created

nova_client = None

octavia.common.config module

Routines for configuring Octavia

handle_deprecation_compatibility()[source]
init(args, **kwargs)[source]
setup_logging(conf)[source]

Sets up the logging options for a log with supplied name.

Parameters:conf – a cfg.ConfOpts object

octavia.common.constants module

octavia.common.context module

class Context(user_id=None, project_id=None, **kwargs)[source]

Bases: oslo_context.context.RequestContext

project_id
session

octavia.common.data_models module

class Amphora(id=None, load_balancer_id=None, compute_id=None, status=None, lb_network_ip=None, vrrp_ip=None, ha_ip=None, vrrp_port_id=None, ha_port_id=None, load_balancer=None, role=None, cert_expiration=None, cert_busy=False, vrrp_interface=None, vrrp_id=None, vrrp_priority=None)[source]

Bases: octavia.common.data_models.BaseDataModel

delete()[source]
class AmphoraHealth(amphora_id=None, last_update=None, busy=False)[source]

Bases: octavia.common.data_models.BaseDataModel

class BaseDataModel[source]

Bases: object

classmethod from_dict(dict)[source]
to_dict(calling_classes=None, recurse=False, **kwargs)[source]

Converts a data model to a dictionary.

update(update_dict)[source]

Generic update method which works for simple,

non-relational attributes.

class HealthMonitor(id=None, project_id=None, pool_id=None, type=None, delay=None, timeout=None, fall_threshold=None, rise_threshold=None, http_method=None, url_path=None, expected_codes=None, enabled=None, pool=None, name=None, provisioning_status=None, operating_status=None, created_at=None, updated_at=None)[source]

Bases: octavia.common.data_models.BaseDataModel

delete()[source]
class L7Policy(id=None, name=None, description=None, listener_id=None, action=None, redirect_pool_id=None, redirect_url=None, position=None, listener=None, redirect_pool=None, enabled=None, l7rules=None, provisioning_status=None, operating_status=None, project_id=None, created_at=None, updated_at=None)[source]

Bases: octavia.common.data_models.BaseDataModel

delete()[source]
update(update_dict)[source]
class L7Rule(id=None, l7policy_id=None, type=None, enabled=None, compare_type=None, key=None, value=None, l7policy=None, invert=False, provisioning_status=None, operating_status=None, project_id=None, created_at=None, updated_at=None)[source]

Bases: octavia.common.data_models.BaseDataModel

delete()[source]
class Listener(id=None, project_id=None, name=None, description=None, default_pool_id=None, load_balancer_id=None, protocol=None, protocol_port=None, connection_limit=None, enabled=None, provisioning_status=None, operating_status=None, tls_certificate_id=None, stats=None, default_pool=None, load_balancer=None, sni_containers=None, peer_port=None, l7policies=None, pools=None, insert_headers=None, created_at=None, updated_at=None)[source]

Bases: octavia.common.data_models.BaseDataModel

delete()[source]
update(update_dict)[source]
class ListenerStatistics(listener_id=None, amphora_id=None, bytes_in=0, bytes_out=0, active_connections=0, total_connections=0, request_errors=0)[source]

Bases: octavia.common.data_models.BaseDataModel

get_stats()[source]
class LoadBalancer(id=None, project_id=None, name=None, description=None, provisioning_status=None, operating_status=None, enabled=None, topology=None, vip=None, listeners=None, amphorae=None, pools=None, vrrp_group=None, server_group_id=None, created_at=None, updated_at=None)[source]

Bases: octavia.common.data_models.BaseDataModel

class LoadBalancerStatistics(bytes_in=0, bytes_out=0, active_connections=0, total_connections=0, request_errors=0, listeners=None)[source]

Bases: octavia.common.data_models.BaseDataModel

get_stats()[source]
class Member(id=None, project_id=None, pool_id=None, ip_address=None, protocol_port=None, weight=None, enabled=None, subnet_id=None, operating_status=None, pool=None, created_at=None, updated_at=None, provisioning_status=None, name=None, monitor_address=None, monitor_port=None)[source]

Bases: octavia.common.data_models.BaseDataModel

delete()[source]
class Pool(id=None, project_id=None, name=None, description=None, protocol=None, lb_algorithm=None, enabled=None, operating_status=None, members=None, health_monitor=None, session_persistence=None, load_balancer_id=None, load_balancer=None, listeners=None, l7policies=None, created_at=None, updated_at=None, provisioning_status=None)[source]

Bases: octavia.common.data_models.BaseDataModel

delete()[source]
update(update_dict)[source]
class Quotas(project_id=None, load_balancer=None, listener=None, pool=None, health_monitor=None, member=None, in_use_health_monitor=None, in_use_listener=None, in_use_load_balancer=None, in_use_member=None, in_use_pool=None)[source]

Bases: octavia.common.data_models.BaseDataModel

class SNI(listener_id=None, position=None, listener=None, tls_container_id=None)[source]

Bases: octavia.common.data_models.BaseDataModel

class SessionPersistence(pool_id=None, type=None, cookie_name=None, pool=None)[source]

Bases: octavia.common.data_models.BaseDataModel

delete()[source]
class TLSContainer(id=None, primary_cn=None, certificate=None, private_key=None, passphrase=None, intermediates=None)[source]

Bases: octavia.common.data_models.BaseDataModel

class VRRPGroup(load_balancer_id=None, vrrp_group_name=None, vrrp_auth_type=None, vrrp_auth_pass=None, advert_int=None, smtp_server=None, smtp_connect_timeout=None, load_balancer=None)[source]

Bases: octavia.common.data_models.BaseDataModel

class Vip(load_balancer_id=None, ip_address=None, subnet_id=None, network_id=None, port_id=None, load_balancer=None)[source]

Bases: octavia.common.data_models.BaseDataModel

octavia.common.decorators module

Decorators to provide backwards compatibility for V1 API.

rename_kwargs(**renamed_kwargs)[source]

Renames a class’s variables and maintains backwards compatibility.

Parameters:renamed_kwargs – mapping of old kwargs to new kwargs. For example, to say a class has renamed variable foo to bar the decorator would be used like: rename_kwargs(foo=’bar’)

octavia.common.exceptions module

Octavia base exception handling.

exception APIException(**kwargs)[source]

Bases: webob.exc.HTTPClientError

code = 500
msg = 'Something unknown went wrong'
exception CertificateGenerationException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Could not sign the certificate request: %(msg)s'
exception CertificateStorageException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Could not store certificate: %(msg)s'
exception ComputeBuildException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Failed to build compute instance due to: %(fault)s'
exception ComputeBuildQueueTimeoutException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Failed to get an amphora build slot.'
exception ComputeDeleteException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Failed to delete compute instance.'
exception ComputeGetException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Failed to retrieve compute instance.'
exception ComputeGetInterfaceException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Failed to retrieve compute virtual interfaces.'
exception ComputeStatusException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Failed to retrieve compute instance status.'
exception ComputeWaitTimeoutException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Waiting for compute to go active timeout.'
exception DisabledOption(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u'The selected %(option)s is not allowed in this deployment: %(value)s'
exception DuplicateHealthMonitor(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 409
msg = u'This pool already has a health monitor'
exception DuplicateListenerEntry(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 409
msg = u'Another Listener on this Load Balancer is already using protocol_port %(port)d'
exception DuplicateMemberEntry(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 409
msg = u'Another member on this pool is already using ip %(ip_address)s on protocol_port %(port)d'
exception DuplicatePoolEntry(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 409
msg = u'This listener already has a default pool'
exception GlanceNoTaggedImages(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'No Glance images are tagged with %(tag)s tag.'
exception IDAlreadyExists(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 409
msg = u'Already an entity with that specified id.'
exception ImmutableObject(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 409
msg = u'%(resource)s %(id)s is immutable and cannot be updated.'
exception InvalidAmphoraOperatingSystem(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Invalid amphora operating system: %(os_name)s'
exception InvalidHMACException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u"HMAC hashes didn't match"
exception InvalidL7PolicyAction(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u'Invalid L7 Policy action specified: %(action)s'
exception InvalidL7PolicyArgs(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u'Invalid L7 Policy arguments: %(msg)s'
exception InvalidL7Rule(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Invalid L7 Rule: %(msg)s'
exception InvalidLimit(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u"Supplied pagination limit '%(key)s' is not valid."
exception InvalidMarker(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u"Supplied pagination marker '%(key)s' is not valid."
exception InvalidOption(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u'%(value)s is not a valid option for %(option)s'
exception InvalidRegex(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Unable to parse regular expression: %(e)s'
exception InvalidSortDirection(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u"Supplied sort direction '%(key)s' is not valid."
exception InvalidSortKey(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u"Supplied sort key '%(key)s' is not valid."
exception InvalidString(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Invalid characters in %(what)s'
exception InvalidSubresource(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u'%(resource)s %(id)s not found.'
exception InvalidTopology(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Invalid topology specified: %(topology)s'
exception InvalidURL(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Not a valid URL: %(url)s'
exception InvalidURLPath(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u'Not a valid URLPath: %(url_path)s'
exception L7RuleValidation(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u'Error parsing L7Rule: %(error)s'
exception LBPendingStateError(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 409
msg = u'Invalid state %(state)s of loadbalancer resource %(id)s'
exception MisMatchedKey(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Key and x509 certificate do not match'
exception MissingAPIProjectID(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
message = u'Missing project ID in request where one is required.'
exception MissingArguments(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Missing arguments.'
exception MissingProjectID(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Missing project ID in request where one is required.'
exception NeedsPassphrase(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Passphrase needed to decrypt key but client did not provide one.'
exception NetworkConfig(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Unable to allocate network resource from config'
exception NoReadyAmphoraeException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'There are not any READY amphora available.'
exception NoSuitableAmphoraException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Unable to allocate an amphora due to: %(msg)s'
exception NotFound(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 404
msg = u'%(resource)s %(id)s not found.'
exception OctaviaException(*args, **kwargs)[source]

Bases: exceptions.Exception

Base Octavia Exception.

To correctly use this class, inherit from it and define a ‘message’ property. That message will get printf’d with the keyword arguments provided to the constructor.

message = u'An unknown exception occurred.'
orig_code = None
orig_msg = None
static use_fatal_exceptions()[source]
exception PolicyForbidden(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 403
msg = u'Policy does not allow this request to be performed.'
exception PoolInUseByL7Policy(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 409
msg = u'Pool %(id)s is in use by L7 policy %(l7policy_id)s'
exception ProjectBusyException(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 503
msg = u'Project busy. Unable to lock the project. Please try again.'
exception QuotaException(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 403
msg = u'Quota has been met.'
exception ServerGroupObjectCreateException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Failed to create server group object.'
exception ServerGroupObjectDeleteException(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Failed to delete server group object.'
exception SingleCreateDetailsMissing(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u'Missing details for %(type)s object: %(name)'
exception TooManyL7RulesOnL7Policy(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 409
msg = u'Too many rules on L7 policy %(id)s'
exception UnreadableCert(*args, **kwargs)[source]

Bases: octavia.common.exceptions.OctaviaException

message = u'Could not read X509 from PEM'
exception VIPValidationException(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u'Validation failure: VIP must contain one of: %(objects)s.'
exception ValidationException(**kwargs)[source]

Bases: octavia.common.exceptions.APIException

code = 400
msg = u'Validation failure: %(detail)s'

octavia.common.keystone module

class KeystoneSession(section='service_auth')[source]

Bases: object

get_session()[source]

Initializes a Keystone session.

Returns:a Keystone Session object
class SkippingAuthProtocol(app, conf)[source]

Bases: keystonemiddleware.auth_token.AuthProtocol

SkippingAuthProtocol to reach special endpoints

Bypasses keystone authentication for special request paths, such as the api version discovery path.

Note:
SkippingAuthProtocol is lean customization of keystonemiddleware.auth_token.AuthProtocol that disables keystone communication if the request path is in the _NOAUTH_PATHS list.
process_request(request)[source]

octavia.common.policy module

Policy Engine For Octavia.

class IsAdminCheck(kind, match)[source]

Bases: oslo_policy._checks.Check

An explicit check for is_admin.

class Policy(conf=<oslo_config.cfg.ConfigOpts object>, policy_file=None, rules=None, default_rule=None, use_conf=True, overwrite=True)[source]

Bases: oslo_policy.policy.Enforcer

authorize(action, target, context, do_raise=True, exc=None)[source]

Verifies that the action is valid on the target in this context.

Parameters:
  • context – The oslo context for this request.
  • action – string representing the action to be checked this should be colon separated for clarity. i.e. compute:create_instance, compute:attach_volume, volume:attach_volume
  • target – dictionary representing the object of the action for object creation this should be a dictionary representing the location of the object e.g. {'project_id': context.project_id}
  • do_raise – if True (the default), raises PolicyForbidden; if False, returns False
  • exc – Class of the exceptions to raise if the check fails. Any remaining arguments passed to enforce() (both positional and keyword arguments) will be passed to the exceptions class. If not specified, PolicyForbidden will be used.
Raises:

PolicyForbidden – if verification fails and do_raise is True. Or if ‘exc’ is specified it will raise an exceptions of that type.

Returns:

returns a non-False value (not necessarily “True”) if authorized, and the exact value False if not authorized and do_raise is False.

check_is_admin(context)[source]

Does roles contains ‘admin’ role according to policy setting.

get_rules()[source]
get_enforcer()[source]
get_no_context_enforcer()[source]
reset()[source]

octavia.common.service module

prepare_service(argv=None)[source]

Sets global config from config file and sets up logging.

octavia.common.stats module

class StatsMixin[source]

Bases: object

get_listener_stats(session, listener_id)[source]

Gets the listener statistics data_models object.

get_loadbalancer_stats(session, loadbalancer_id)[source]

octavia.common.utils module

Utilities and helper functions.

base64_sha1_string(string_to_hash)[source]
class exception_logger(logger=None)[source]

Bases: object

Wrap a function and log raised exception

Parameters:logger – the logger to log the exception default is LOG.exception
Returns:origin value if no exception raised; re-raise the exception if any occurred
get_hostname()[source]
get_network_driver()[source]
ip_port_str(ip_address, port)[source]

Return IP port as string representation depending on address family.

is_ipv6(ip_address)[source]

Check if ip address is IPv6 address.

is_ipv6_lla(ip_address)[source]

Check if ip address is IPv6 link local address.

netmask_to_prefix(netmask)[source]

octavia.common.validate module

Several handy validation functions that go beyond simple type checking. Defined here so these can also be used at deeper levels than the API.

cookie_value_string(value, what=None)[source]

Raises an error if the value string contains invalid characters.

header_name(header, what=None)[source]

Raises an error if header does not look like an HTML header name.

header_value_string(value, what=None)[source]

Raises an error if the value string contains invalid characters.

is_ip_member_of_cidr(address, cidr)[source]
l7rule_data(l7rule)[source]

Raises an error if the l7rule given is invalid in some way.

network_allowed_by_config(network_id)[source]
network_exists_optionally_contains_subnet(network_id, subnet_id=None)[source]

Raises an exception when a network does not exist.

If a subnet is provided, also validate the network contains that subnet.

port_exists(port_id)[source]

Raises an exception when a port does not exist.

regex(regex)[source]

Raises an error if the string given is not a valid regex.

sanitize_l7policy_api_args(l7policy, create=False)[source]

Validate and make consistent L7Policy API arguments.

This method is mainly meant to sanitize L7 Policy create and update API dictionaries, so that we strip ‘None’ values that don’t apply for our particular update. This method does not verify that any redirect_pool_id exists in the database, but will raise an error if a redirect_url doesn’t look like a URL.

Parameters:l7policy – The L7 Policy dictionary we are santizing / validating
subnet_exists(subnet_id)[source]

Raises an exception when a subnet does not exist.

url(url, require_scheme=True)[source]

Raises an error if the url doesn’t look like a URL.

url_path(url_path)[source]

Raises an error if the url_path doesn’t look like a URL Path.

Module contents

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.