neutron_lib.placement.utils 模块¶
- neutron_lib.placement.utils.agent_resource_provider_uuid(namespace, host)¶
为代理生成一个稳定的 UUID。
- 参数:
namespace – 标识机制驱动程序(包括其代理)的 UUID 对象。
host – 代理的主机名。
- 返回值:
标识代理的唯一且稳定的 UUID。
- neutron_lib.placement.utils.device_resource_provider_uuid(namespace, host, device, separator=':')¶
为物理网络设备生成一个稳定的 UUID。
- 参数:
namespace – 标识机制驱动程序(包括其代理)的 UUID 对象。
host – 代理的主机名。
device – 物理网络设备的宿主机唯一名称。
separator – 用于组装 uuid5() 名称的字符串。选择一个在“host”或“device”中都不会出现的字符串。可选。
- 返回值:
标识物理网络设备的唯一且稳定的 UUID。
- neutron_lib.placement.utils.parse_rp_bandwidths(bandwidths)¶
解析并验证配置选项:resource_provider_bandwidths。
配置中的输入
resource_provider_bandwidths = eth0:10000:10000,eth1::10000,eth2::,eth3
在此处输入
['eth0:10000:10000', 'eth1::10000', 'eth2::', 'eth3']
输出
{ 'eth0': {'egress': 10000, 'ingress': 10000}, 'eth1': {'egress': None, 'ingress': 10000}, 'eth2': {'egress': None, 'ingress': None}, 'eth3': {'egress': None, 'ingress': None}, }
- 参数:
bandwidths – oslo_config 预解析的 ‘interface:egress:ingress’ 带宽配置选项列表。
- 引发:
输入无效时引发 ValueError。
- 返回值:
完全解析的带宽配置,为字典的字典。
- neutron_lib.placement.utils.parse_rp_inventory_defaults(inventory_defaults)¶
解析并验证配置选项:parse_rp_inventory_defaults。
将字典值转换为适当的数值类型。
配置中的输入
resource_provider_inventory_defaults = allocation_ratio:1.0,min_unit:1
在此处输入
{ 'allocation_ratio': '1.0', 'min_unit': '1', }
此处输出
{ 'allocation_ratio': 1.0, 'min_unit': 1, }
- 参数:
inventory_defaults – oslo_config 预解析的库存参数和值(作为字符串)的字典。
- 引发:
输入无效时引发 ValueError。
- 返回值:
完全解析的库存参数和值(作为数值)的字典。
- neutron_lib.placement.utils.parse_rp_pp_with_direction(pkt_rates, host)¶
解析并验证:resource_provider_packet_processing_with_direction。
配置中的输入
resource_provider_packet_processing_with_direction = host0:10000:10000,host1::10000,host2::,host3,:0:0
在此处输入
['host0:10000:10000', 'host1::10000', 'host2::', 'host3', ':0:0']
输出
{ '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}, }
- 参数:
pkt_rates – oslo_config 预解析的 ‘hypervisor:egress:ingress’ 数据包速率配置选项列表。
host – 将用作默认键值的主机名,如果用户未提供 hypervisor 名称。
- 引发:
输入无效时引发 ValueError。
- 返回值:
完全解析的数据包速率配置,为字典的字典。
- neutron_lib.placement.utils.parse_rp_pp_without_direction(pkt_rates, host)¶
解析:resource_provider_packet_processing_without_direction。
配置中的输入
resource_provider_packet_processing_without_direction = host0:10000,host1:,host2,:0
在此处输入
['host0:10000', 'host1:', 'host2', ':0']
输出
{ 'host0': {'any': 10000}, 'host1': {'any': None}, 'host2': {'any': None}, '<DEFAULT.host>': {'any': 0}, }
- 参数:
pkt_rates – oslo_config 预解析的 ‘hypervisor:pkt_rate’ 配置选项列表。
host – 将用作默认键值的主机名,如果用户未提供 hypervisor 名称。
- 引发:
输入无效时引发 ValueError。
- 返回值:
完全解析的数据包速率配置,为字典的字典。
- neutron_lib.placement.utils.physnet_trait(physnet)¶
Placement trait 名称,用于表示连接到 physnet。
- 参数:
physnet – physnet 名称。
- 返回值:
表示 physnet 的 trait 名称。
- neutron_lib.placement.utils.resource_request_group_uuid(namespace, qos_rules, separator=':')¶
为资源请求组生成一个稳定的 UUID。
- 参数:
namespace – 用于在生成 v5 UUID 时用作命名空间的 UUID 对象。
qos_rules – 构成组的 QoS 规则列表。
separator – 用于组装 uuid5() 名称的字符串。可选。
- 返回值:
标识资源请求组的唯一且稳定的 UUID。
- neutron_lib.placement.utils.six_uuid5(namespace, name)¶
一个 uuid.uuid5 变体,可在 Python 2 和 3 中接受 utf-8 ‘name’。
- 参数:
namespace – 用作在生成 v5 UUID 时用作命名空间的 UUID 对象。
name – 用于在生成 v5 UUID 时用作名称的任何字符串(字节码或 Unicode)。
- 返回值:
一个 v5 UUID 对象。
- neutron_lib.placement.utils.vnic_type_trait(vnic_type)¶
Placement trait 名称,用于表示对 vnic_type 的支持。
- 参数:
physnet – vnic_type。
- 返回值:
表示 vnic_type 的 trait 名称。