The ironic_lib.mdns Module

Multicast DNS implementation for API discovery.

This implementation follows RFC 6763 as clarified by the API SIG guideline https://review.opendev.org/651222.

class ironic_lib.mdns.Zeroconf[source]

Bases: object

Multicast DNS implementation client and server.

Uses threading internally, so there is no start method. It starts automatically on creation.

Warning

The underlying library does not yet support IPv6.

close()[source]

Shut down mDNS and unregister services.

Note

If another server is running for the same services, it will re-register them immediately.

get_endpoint(service_type, skip_loopback=True, skip_link_local=False)[source]

Get an endpoint and its properties from mDNS.

If the requested endpoint is already in the built-in server cache, and its TTL is not exceeded, the cached value is returned.

Parameters
  • service_type – OpenStack service type.

  • skip_loopback – Whether to ignore loopback addresses.

  • skip_link_local – Whether to ignore link local V6 addresses.

Returns

tuple (endpoint URL, properties as a dict).

Raises

ServiceLookupFailure if the service cannot be found.

register_service(service_type, endpoint, params=None)[source]

Register a service.

This call announces the new services via multicast and instructs the built-in server to respond to queries about it.

Parameters
  • service_type – OpenStack service type, e.g. “baremetal”.

  • endpoint – full endpoint to reach the service.

  • params – optional properties as a dictionary.

Raises

ServiceRegistrationFailure if the service cannot be registered, e.g. because of conflicts.

ironic_lib.mdns.get_endpoint(service_type)[source]

Get an endpoint and its properties from mDNS.

If the requested endpoint is already in the built-in server cache, and its TTL is not exceeded, the cached value is returned.

Parameters

service_type – OpenStack service type.

Returns

tuple (endpoint URL, properties as a dict).

Raises

ServiceLookupFailure if the service cannot be found.

ironic_lib.mdns.list_opts()[source]

Entry point for oslo-config-generator.