octavia.common package¶
Subpackages¶
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
-
class
DynamicLoggingConductor
(name, jobboard, persistence=None, engine=None, engine_options=None, wait_timeout=None, log=None, max_simultaneous_jobs=1)[source]¶ Bases:
taskflow.conductors.backends.impl_blocking.BlockingConductor
-
class
RedisDynamicLoggingConductor
(name, jobboard, persistence=None, engine=None, engine_options=None, wait_timeout=None, log=None, max_simultaneous_jobs=1)[source]¶
octavia.common.clients module¶
-
class
CinderAuth
[source]¶ Bases:
object
-
cinder_client
= None¶
-
classmethod
get_cinder_client
(region, service_name=None, endpoint=None, endpoint_type='publicURL', insecure=False, cacert=None)[source]¶ Create cinder client object.
- Parameters
region – The region of the service
service_name – The name of the cinder 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 Cinder Client object
- Raises
Exception – if the client cannot be created
-
-
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¶
-
classmethod
-
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¶
-
classmethod
-
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¶
-
classmethod
octavia.common.config module¶
Routines for configuring Octavia
octavia.common.constants module¶
octavia.common.context module¶
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, cached_zone=None, created_at=None, updated_at=None, image_id=None, compute_flavor=None)[source]¶
-
class
AvailabilityZone
(name=None, description=None, enabled=None, availability_zone_profile_id=None)[source]¶
-
class
AvailabilityZoneProfile
(id=None, name=None, provider_name=None, availability_zone_data=None)[source]¶
-
class
BaseDataModel
[source]¶ Bases:
object
-
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, tags=None, http_version=None, domain_name=None)[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, redirect_prefix=None, tags=None, redirect_http_code=None)[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, tags=None)[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, timeout_client_data=None, timeout_member_connect=None, timeout_member_data=None, timeout_tcp_inspect=None, tags=None, client_ca_tls_certificate_id=None, client_authentication=None, client_crl_container_id=None, allowed_cidrs=None, tls_ciphers=None)[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]¶
-
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, provider=None, tags=None, flavor_id=None, availability_zone=None)[source]¶
-
class
LoadBalancerStatistics
(bytes_in=0, bytes_out=0, active_connections=0, total_connections=0, request_errors=0, listeners=None)[source]¶
-
class
Member
(id=None, project_id=None, pool_id=None, ip_address=None, protocol_port=None, weight=None, backup=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, tags=None)[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, tags=None, tls_certificate_id=None, ca_tls_certificate_id=None, crl_container_id=None, tls_enabled=None, tls_ciphers=None)[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]¶
-
class
SessionPersistence
(pool_id=None, type=None, cookie_name=None, pool=None, persistence_timeout=None, persistence_granularity=None)[source]¶
-
class
TLSContainer
(id=None, primary_cn=None, certificate=None, private_key=None, passphrase=None, intermediates=None)[source]¶
-
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]¶
octavia.common.decorators module¶
Decorators to provide backwards compatibility for V1 API.
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
= 'Could not sign the certificate request: %(msg)s'¶
-
-
exception
CertificateRetrievalException
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'Could not retrieve certificate: %(ref)s'¶
-
-
exception
CertificateStorageException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Could not store certificate: %(msg)s'¶
-
-
exception
ComputeBuildException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Failed to build compute instance due to: %(fault)s'¶
-
-
exception
ComputeBuildQueueTimeoutException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Failed to get an amphora build slot.'¶
-
-
exception
ComputeDeleteException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Failed to delete compute instance.'¶
-
-
exception
ComputeGetException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Failed to retrieve compute instance.'¶
-
-
exception
ComputeGetInterfaceException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Failed to retrieve compute virtual interfaces.'¶
-
-
exception
ComputeStatusException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Failed to retrieve compute instance status.'¶
-
-
exception
ComputeWaitTimeoutException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Waiting for compute id %(id)s to go active timeout.'¶
-
-
exception
DisabledOption
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'The selected %(option)s is not allowed in this deployment: %(value)s'¶
-
-
exception
DuplicateHealthMonitor
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 409¶
-
msg
= 'This pool already has a health monitor'¶
-
-
exception
DuplicateListenerEntry
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 409¶
-
msg
= 'Another Listener on this Load Balancer is already using protocol %(protocol)s and protocol_port %(port)d'¶
-
-
exception
DuplicateMemberEntry
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 409¶
-
msg
= '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
= 'This listener already has a default pool'¶
-
-
exception
GlanceNoTaggedImages
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'No Glance images are tagged with %(tag)s tag.'¶
-
-
exception
IDAlreadyExists
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 409¶
-
msg
= 'Already an entity with that specified id.'¶
-
-
exception
ImmutableObject
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 409¶
-
msg
= '%(resource)s %(id)s is immutable and cannot be updated.'¶
-
-
exception
InputFileError
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Error with file %(file_name)s. Reason: %(reason)s'¶
-
-
exception
InvalidAmphoraOperatingSystem
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Invalid amphora operating system: %(os_name)s'¶
-
-
exception
InvalidFilterArgument
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'One or more arguments are either duplicate or invalid'¶
-
-
exception
InvalidHMACException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= "HMAC hashes didn't match"¶
-
-
exception
InvalidL7PolicyAction
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'Invalid L7 Policy action specified: %(action)s'¶
-
-
exception
InvalidL7PolicyArgs
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'Invalid L7 Policy arguments: %(msg)s'¶
-
-
exception
InvalidL7Rule
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Invalid L7 Rule: %(msg)s'¶
-
-
exception
InvalidLimit
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= "Supplied pagination limit '%(key)s' is not valid."¶
-
-
exception
InvalidMarker
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= "Supplied pagination marker '%(key)s' is not valid."¶
-
-
exception
InvalidOption
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= '%(value)s is not a valid option for %(option)s'¶
-
-
exception
InvalidRegex
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Unable to parse regular expression: %(e)s'¶
-
-
exception
InvalidSortDirection
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= "Supplied sort direction '%(key)s' is not valid."¶
-
-
exception
InvalidSortKey
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= "Supplied sort key '%(key)s' is not valid."¶
-
-
exception
InvalidString
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Invalid characters in %(what)s'¶
-
-
exception
InvalidSubresource
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= '%(resource)s %(id)s not found.'¶
-
-
exception
InvalidTopology
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Invalid topology specified: %(topology)s'¶
-
-
exception
InvalidURL
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Not a valid URL: %(url)s'¶
-
-
exception
InvalidURLPath
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'Not a valid URLPath: %(url_path)s'¶
-
-
exception
L7RuleValidation
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'Error parsing L7Rule: %(error)s'¶
-
-
exception
LBPendingStateError
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 409¶
-
msg
= 'Invalid state %(state)s of loadbalancer resource %(id)s'¶
-
-
exception
MisMatchedKey
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Key and x509 certificate do not match'¶
-
-
exception
MissingAPIProjectID
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
message
= 'Missing project ID in request where one is required.'¶
-
-
exception
MissingArguments
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Missing arguments.'¶
-
-
exception
MissingProjectID
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Missing project ID in request where one is required.'¶
-
-
exception
MissingVIPSecurityGroup
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'VIP security group is missing for load balancer: %(lb_id)s'¶
-
-
exception
NeedsPassphrase
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Passphrase needed to decrypt key but client did not provide one.'¶
-
-
exception
NetworkConfig
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Unable to allocate network resource from config'¶
-
-
exception
NoReadyAmphoraeException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'There are not any READY amphora available.'¶
-
-
exception
NotFound
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 404¶
-
msg
= '%(resource)s %(id)s not found.'¶
-
-
exception
ObjectInUse
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 409¶
-
msg
= '%(object)s %(id)s is in use and cannot be modified.'¶
-
-
exception
OctaviaException
(*args, **kwargs)[source]¶ Bases:
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
= 'An unknown exception occurred.'¶
-
orig_code
= None¶
-
orig_msg
= None¶
-
-
exception
PolicyForbidden
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 403¶
-
msg
= 'Policy does not allow this request to be performed.'¶
-
-
exception
PoolInUseByL7Policy
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 409¶
-
msg
= 'Pool %(id)s is in use by L7 policy %(l7policy_id)s'¶
-
-
exception
ProjectBusyException
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 503¶
-
msg
= 'Project busy. Unable to lock the project. Please try again.'¶
-
-
exception
ProviderDriverError
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 500¶
-
msg
= "Provider '%(prov)s' reports error: %(user_msg)s"¶
-
-
exception
ProviderFlavorMismatchError
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= "Flavor '%(flav)s' is not compatible with provider '%(prov)s'"¶
-
-
exception
ProviderNotEnabled
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= "Provider '%(prov)s' is not enabled."¶
-
-
exception
ProviderNotFound
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 501¶
-
msg
= "Provider '%(prov)s' was not found."¶
-
-
exception
ProviderNotImplementedError
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 501¶
-
msg
= "Provider '%(prov)s' does not support a requested action: %(user_msg)s"¶
-
-
exception
ProviderUnsupportedOptionError
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 501¶
-
msg
= "Provider '%(prov)s' does not support a requested option: %(user_msg)s"¶
-
-
exception
QuotaException
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 403¶
-
msg
= 'Quota has been met for resources: %(resource)s'¶
-
-
exception
RecordAlreadyExists
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 409¶
-
msg
= 'A %(field)s of %(name)s already exists.'¶
-
-
exception
ServerGroupObjectCreateException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Failed to create server group object.'¶
-
-
exception
ServerGroupObjectDeleteException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Failed to delete server group object.'¶
-
-
exception
SingleCreateDetailsMissing
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'Missing details for %(type)s object: %(name)s'¶
-
-
exception
TooManyL7RulesOnL7Policy
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 409¶
-
msg
= 'Too many rules on L7 policy %(id)s'¶
-
-
exception
UnreadableCert
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Could not read X509 from PEM'¶
-
-
exception
UnreadablePKCS12
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'The PKCS12 bundle is unreadable. Please check the PKCS12 bundle validity. In addition, make sure it does not require a pass phrase. Error: %(error)s'¶
-
-
exception
VIPValidationException
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'Validation failure: VIP must contain one of: %(objects)s.'¶
-
-
exception
ValidationException
(**kwargs)[source]¶ Bases:
octavia.common.exceptions.APIException
-
code
= 400¶
-
msg
= 'Validation failure: %(detail)s'¶
-
-
exception
VolumeDeleteException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Failed to delete volume instance.'¶
-
-
exception
VolumeGetException
(*args, **kwargs)[source]¶ Bases:
octavia.common.exceptions.OctaviaException
-
message
= 'Failed to retrieve volume instance.'¶
-
octavia.common.keystone module¶
-
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]¶ Process request.
Evaluate the headers in a request and attempt to authenticate the request. If authenticated then additional headers are added to the request for use by applications. If not authenticated the request will be rejected or marked unauthenticated depending on configuration.
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
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.
octavia.common.rpc module¶
octavia.common.service module¶
octavia.common.stats module¶
octavia.common.utils module¶
Utilities and helper functions.
-
base64_sha1_string
(string_to_hash)[source]¶ Get a b64-encoded sha1 hash of a string. Not intended to be secure!
-
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
-
expand_expected_codes
(codes)[source]¶ Expand the expected code string in set of codes.
200-204 -> 200, 201, 202, 204 200, 203 -> 200, 203
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.
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.
-
network_exists_optionally_contains_subnet
(network_id, subnet_id=None, context=None)[source]¶ Raises an exception when a network does not exist.
If a subnet is provided, also validate the network contains that subnet.
-
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