neutron_lib.placement.utils module¶
- neutron_lib.placement.utils.agent_resource_provider_uuid(namespace, host)¶
Generate a stable UUID for an agent.
- Parameters:
namespace – A UUID object identifying a mechanism driver (including its agent).
host – The hostname of the agent.
- Returns:
A unique and stable UUID identifying an agent.
- neutron_lib.placement.utils.device_resource_provider_uuid(namespace, host, device, separator=':')¶
Generate a stable UUID for a physical network device.
- Parameters:
namespace – A UUID object identifying a mechanism driver (including its agent).
host – The hostname of the agent.
device – A host-unique name of the physical network device.
separator – A string used in assembling a name for uuid5(). Choose one that cannot occur either in ‘host’ or ‘device’. Optional.
- Returns:
A unique and stable UUID identifying a physical network device.
- neutron_lib.placement.utils.parse_rp_bandwidths(bandwidths)¶
Parse and validate config option: resource_provider_bandwidths.
Input in the config:
resource_provider_bandwidths = eth0:10000:10000,eth1::10000,eth2::,eth3
Input here:
['eth0:10000:10000', 'eth1::10000', 'eth2::', 'eth3']
Output:
{ 'eth0': {'egress': 10000, 'ingress': 10000}, 'eth1': {'egress': None, 'ingress': 10000}, 'eth2': {'egress': None, 'ingress': None}, 'eth3': {'egress': None, 'ingress': None}, }
- Parameters:
bandwidths – The list of ‘interface:egress:ingress’ bandwidth config options as pre-parsed by oslo_config.
- Raises:
ValueError on invalid input.
- Returns:
The fully parsed bandwidth config as a dict of dicts.
- neutron_lib.placement.utils.parse_rp_inventory_defaults(inventory_defaults)¶
Parse and validate config option: parse_rp_inventory_defaults.
Cast the dict values to the proper numerical types.
Input in the config:
resource_provider_inventory_defaults = allocation_ratio:1.0,min_unit:1
Input here:
{ 'allocation_ratio': '1.0', 'min_unit': '1', }
Output here:
{ 'allocation_ratio': 1.0, 'min_unit': 1, }
- Parameters:
inventory_defaults – The dict of inventory parameters and values (as strings) as pre-parsed by oslo_config.
- Raises:
ValueError on invalid input.
- Returns:
The fully parsed inventory parameters and values (as numerical values) as a dict.
- neutron_lib.placement.utils.parse_rp_pp_with_direction(pkt_rates, host)¶
Parse and validate: resource_provider_packet_processing_with_direction.
Input in the config:
resource_provider_packet_processing_with_direction = host0:10000:10000,host1::10000,host2::,host3,:0:0
Input here:
['host0:10000:10000', 'host1::10000', 'host2::', 'host3', ':0:0']
Output:
{ 'host0': {'egress': 10000, 'ingress': 10000}, 'host1': {'egress': None, 'ingress': 10000}, 'host2': {'egress': None, 'ingress': None}, 'host3': {'egress': None, 'ingress': None}, '<host>': {'egress': 0, 'ingress': 0}, }
- Parameters:
pkt_rates – The list of ‘hypervisor:egress:ingress’ pkt rate config options as pre-parsed by oslo_config.
host – Hostname that will be used as a default key value if the user did not provide hypervisor name.
- Raises:
ValueError on invalid input.
- Returns:
The fully parsed pkt rate config as a dict of dicts.
- neutron_lib.placement.utils.parse_rp_pp_without_direction(pkt_rates, host)¶
Parse: resource_provider_packet_processing_without_direction.
Input in the config:
resource_provider_packet_processing_without_direction = host0:10000,host1:,host2,:0
Input here:
['host0:10000', 'host1:', 'host2', ':0']
Output:
{ 'host0': {'any': 10000}, 'host1': {'any': None}, 'host2': {'any': None}, '<DEFAULT.host>': {'any': 0}, }
- Parameters:
pkt_rates – The list of ‘hypervisor:pkt_rate’ config options as pre-parsed by oslo_config.
host – Hostname that will be used as a default key value if the user did not provide hypervisor name.
- Raises:
ValueError on invalid input.
- Returns:
The fully parsed pkt rate config as a dict of dicts.
- neutron_lib.placement.utils.physnet_trait(physnet)¶
A Placement trait name to represent being connected to a physnet.
- Parameters:
physnet – The physnet name.
- Returns:
The trait name representing the physnet.
- neutron_lib.placement.utils.resource_request_group_uuid(namespace, qos_rules, separator=':')¶
Generate a stable UUID for a resource request group.
- Parameters:
namespace – A UUID object identifying a port.
qos_rules – A list of QoS rules contributing to the group.
separator – A string used in assembling a name for uuid5(). Optional.
- Returns:
A unique and stable UUID identifying a resource request group.
- neutron_lib.placement.utils.six_uuid5(namespace, name)¶
A uuid.uuid5 variant that takes utf-8 ‘name’ both in Python 2 and 3.
- Parameters:
namespace – A UUID object used as a namespace in the generation of a v5 UUID.
name – Any string (either bytecode or unicode) used as a name in the generation of a v5 UUID.
- Returns:
A v5 UUID object.
- neutron_lib.placement.utils.vnic_type_trait(vnic_type)¶
A Placement trait name to represent support for a vnic_type.
- Parameters:
physnet – The vnic_type.
- Returns:
The trait name representing the vnic_type.