# octavia.amphorae.drivers.haproxy package

## Submodules

## octavia.amphorae.drivers.haproxy.data_models module

class CPU(total=None, user=None, system=None, soft_irq=None)

  Bases: `BaseDataModel`

class Details(hostname=None, uuid=None, version=None, api_version=None, network_tx=None, network_rx=None, active=None, haproxy_count=None, cpu=None, memory=None, disk=None, load=None, listeners=None, packages=None)

  Bases: `BaseDataModel`

class Disk(used=None, available=None)

  Bases: `BaseDataModel`

class Info(hostname=None, uuid=None, version=None, api_version=None)

  Bases: `BaseDataModel`

class ListenerStatus(status=None, uuid=None, provisioning_status=None, type=None, pools=None)

  Bases: `BaseDataModel`

class Memory(total=None, free=None, available=None, buffers=None, cached=None, swap_used=None, shared=None, slab=None, committed_as=None)

  Bases: `BaseDataModel`

class Pool(uuid=None, status=None, members=None)

  Bases: `BaseDataModel`

class Topology(hostname=None, uuid=None, topology=None, role=None, ip=None, ha_ip=None)

  Bases: `BaseDataModel`

## octavia.amphorae.drivers.haproxy.exceptions module

exception APIException(**kwargs)

  Bases: `HTTPClientError`

  code = 500
  msg = 'Something unknown went wrong'

exception Conflict(**kwargs)

  Bases: `APIException`

  code = 409
  msg = 'Conflict'

exception Forbidden(**kwargs)

  Bases: `APIException`

  code = 403
  msg = 'Forbidden'

exception InternalServerError(**kwargs)

  Bases: `APIException`

  code = 500
  msg = 'Internal Server Error'

exception InvalidRequest(**kwargs)

  Bases: `APIException`

  code = 400
  msg = 'Invalid request'

exception NotFound(**kwargs)

  Bases: `APIException`

  code = 404
  msg = 'Not Found'

exception ServiceUnavailable(**kwargs)

  Bases: `APIException`

  code = 503
  msg = 'Service Unavailable'

exception Unauthorized(**kwargs)

  Bases: `APIException`

  code = 401
  msg = 'Unauthorized'

check_exception(response, ignore=(), log_error=True)

## octavia.amphorae.drivers.haproxy.rest_api_driver module

class AmphoraAPIClient1_0

  Bases: `AmphoraAPIClientBase`

  delete_cert_pem(amp, loadbalancer_id, pem_filename)
  delete_listener(amp, object_id)
  get_all_listeners(amp)
  get_cert_md5sum(amp, loadbalancer_id, pem_filename, ignore=())
  get_details(amp)
  get_info(amp, raise_retry_exception=False, timeout_dict=None)
  get_interface(amp, ip_addr, timeout_dict=None, log_error=True)
  get_listener_status(amp, listener_id)
  plug_network(amp, port)
  plug_vip(amp, vip, net_info)
  set_interface_rules(amp, ip_address, rules, timeout_dict=None)
  update_agent_config(amp, agent_config, timeout_dict=None)
  update_cert_for_rotation(amp, pem_file)
  upload_cert_pem(amp, loadbalancer_id, pem_filename, pem_file)
  upload_config(amp, loadbalancer_id, config, timeout_dict=None)
  upload_udp_config(amp, listener_id, config, timeout_dict=None)
  upload_vrrp_config(amp, config)

class AmphoraAPIClientBase

  Bases: `object`

  get_api_version(amp, timeout_dict=None, raise_retry_exception=False)
  request(method: str, amp: Amphora, path: str = '/', timeout_dict: dict | None = None, retry_404: bool = True, raise_retry_exception: bool = False, **kwargs)

class CustomHostNameCheckingAdapter(pool_connections=10, pool_maxsize=10, max_retries=0, pool_block=False)

  Bases: `HTTPAdapter`

  cert_verify(conn, url, verify, cert)

    Verify a SSL certificate. This method should not be called from user code, and is only exposed for use when subclassing the `HTTPAdapter`.

    Parameters:

      - conn – The urllib3 connection object associated with the cert.

      - url – The requested URL.

      - verify – Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use

      - cert – The SSL certificate to verify.

  init_poolmanager(*pool_args, **pool_kwargs)

    Initializes a urllib3 PoolManager.

    This method should not be called from user code, and is only exposed for use when subclassing the `HTTPAdapter`.

    Parameters:

      - connections – The number of urllib3 connection pools to cache.

      - maxsize – The maximum number of connections to save in the pool.

      - block – Block when no free connections are available.

      - pool_kwargs – Extra keyword arguments used to initialize the Pool Manager.

class HaproxyAmphoraLoadBalancerDriver

  Bases: `AmphoraLoadBalancerDriver`, `KeepalivedAmphoraDriverMixin`

  check(amphora: Amphora, timeout_dict: dict | None = None)

    Check connectivity to the amphora.

  delete(listener)

    Delete the listener on the vip.

    Parameters:

      listener (octavia.db.models.Listener) – listener object, need to use its protocol_port property

    Returns:

      return a value list (listener, vip, status flag–delete)

    At this moment, we just build the basic structure for testing, will add more function along with the development.

  finalize_amphora(amphora)

    Finalize the amphora before any listeners are configured.

    Parameters:

      amphora (octavia.db.models.Amphora) – amphora object, need to use its id property

    Returns:

      None

    At this moment, we just build the basic structure for testing, will add more function along with the development. This is a hook for drivers who need to do additional work before an amphora becomes ready to accept listeners. Please keep in mind that amphora might be kept in an offline pool after this call.

  get_diagnostics(amphora)

    Return ceilometer ready diagnostic data.

    Parameters:

      amphora (octavia.db.models.Amphora) – amphora object, need to use its id property

    Returns:

      return a value list (amphora.id, status flag–‘ge t_diagnostics’)

    At this moment, we just build the basic structure for testing, will add more function along with the development, eventually, we want it run some expensive self tests to determine if the amphora and the lbs are healthy the idea is that those tests are triggered more infrequent than the health gathering.

  get_info(amphora, raise_retry_exception=False, timeout_dict=None)

    Returns information about the amphora.

    Parameters:

      - amphora (octavia.db.models.Amphora) – amphora object, need to use its id property

      - raise_retry_exception – Flag if outside task should be retried

    Returns:

      return a value list (amphora.id, status flag–‘info’)

    At this moment, we just build the basic structure for testing, will add more function along with the development, eventually, we want it to return information as: {“Rest Interface”: “1.0”, “Amphorae”: “1.0”, “packages”:{“ha proxy”:”1.5”}} some information might come from querying the amphora

  get_interface_from_ip(amphora, ip_address, timeout_dict=None)

    Get the interface name for an IP address.

    Parameters:

      - amphora (octavia.db.models.Amphora) – The amphora to query.

      - ip_address (string) – The IP address to lookup. (IPv4 or IPv6)

      - timeout_dict (dict) – Dictionary of timeout values for calls to the amphora. May contain: req_conn_timeout, req_read_timeout, conn_max_retries, conn_retry_interval

    Returns:

      the interface name string if found.

    Raises:

      - octavia.amphorae.drivers.haproxy.exceptions.NotFound – No interface found on the amphora

      - TimeOutException – The amphora didn’t reply

  post_network_plug(amphora, port, amphora_network_config)

    Called after amphora added to network

    Parameters:

      - amphora (octavia.db.models.Amphora) – amphora object, needs id and network ip(s)

      - port (octavia.network.data_models.Port) – contains information of the plugged port

      - amphora_network_config (octavia.network.data_models. AmphoraNetworkConfig) – A data model containing information about the subnets and ports that an amphorae owns.

    This method is optional to implement. After adding an amphora to a network, there may be steps necessary on the amphora to allow it to access said network. Ex: creating an interface on an amphora for a neutron network to utilize.

  post_vip_plug(amphora, load_balancer, amphorae_network_config, vrrp_port, vip_subnet, additional_vip_data=None)

    Called after network driver has allocated and plugged the VIP

    Parameters:

      - amphora (octavia.db.models.Amphora)

      - load_balancer (octavia.common.data_models.LoadBalancer) – A load balancer that just had its vip allocated and plugged in the network driver.

      - amphorae_network_config (octavia.network.data_models. AmphoraNetworkConfig) – A data model containing information about the subnets and ports that an amphorae owns.

      - vrrp_port (octavia.network.data_models.Port) – VRRP port associated with the load balancer

      - vip_subnet (octavia.network.data_models.Subnet) – VIP subnet associated with the load balancer

    Returns:

      None

    This is to do any additional work needed on the amphorae to plug the vip, such as bring up interfaces.

  reload(loadbalancer, amphora=None, timeout_dict=None)

    Reload the listeners on the amphora.

    Parameters:

      - loadbalancer (octavia.db.models.LoadBalancer) – loadbalancer object to reload listeners

      - amphora (octavia.db.models.Amphora) – Amphora to start. If None, reload on all amphora

      - timeout_dict (dict) – Dictionary of timeout values for calls to the amphora. May contain: req_conn_timeout, req_read_timeout, conn_max_retries, conn_retry_interval

    Returns:

      return a value list (listener, vip, status flag–enable)

    At this moment, we just build the basic structure for testing, will add more function along with the development.

  set_interface_rules(amphora: Amphora, ip_address, rules, timeout_dict=None)

    Sets interface firewall rules in the amphora

    Parameters:

      - amphora – The amphora to query.

      - ip_address – The IP address assigned to the interface the rules will be applied on.

      - rules – The l1st of allow rules to apply.

  start(loadbalancer, amphora=None, timeout_dict=None)

    Start the listeners on the amphora.

    Parameters:

      - loadbalancer (octavia.db.models.LoadBalancer) – loadbalancer object to start listeners

      - amphora (octavia.db.models.Amphora) – Amphora to start. If None, start on all amphora

      - timeout_dict (dict) – Dictionary of timeout values for calls to the amphora. May contain: req_conn_timeout, req_read_timeout, conn_max_retries, conn_retry_interval

    Returns:

      return a value list (listener, vip, status flag–enable)

    At this moment, we just build the basic structure for testing, will add more function along with the development.

  update(loadbalancer)

    Update the amphora with a new configuration.

    Parameters:

      loadbalancer (octavia.db.models.LoadBalancer) – loadbalancer object, need to use its vip.ip_address property

    Returns:

      None

    At this moment, we just build the basic structure for testing, will add more function along with the development.

  update_amphora_agent_config(amphora, agent_config, timeout_dict=None)

    Update the amphora agent configuration file.

    Parameters:

      - amphora (object) – The amphora to update.

      - agent_config (string) – The new amphora agent configuration.

      - timeout_dict – Dictionary of timeout values for calls to the amphora. May contain: req_conn_timeout, req_read_timeout, conn_max_retries, conn_retry_interval

    Returns:

      None

    Note: This will mutate the amphora agent config and adopt the

      new values.

  update_amphora_listeners(loadbalancer, amphora, timeout_dict=None)

    Update the amphora with a new configuration.

    Parameters:

      - loadbalancer (object) – The load balancer to update

      - amphora (object) – The amphora to update

      - timeout_dict – Dictionary of timeout values for calls to the amphora. May contain: req_conn_timeout, req_read_timeout, conn_max_retries, conn_retry_interval

    Returns:

      None

    Updates the configuration of the listeners on a single amphora.

  upload_cert_amp(amp, pem)

    Upload cert info to the amphora.

    Parameters:

      - amphora (octavia.db.models.Amphora) – amphora object, needs id and network ip(s)

      - pem_file (file object) – a certificate file

    Upload cert file to amphora for Controller Communication.

## Module contents

this page last updated: 2025-10-06 11:22:08

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

found an error? report a bug