如何使用 Ansible 创建 Open vSwitch QoS 设置?

问题描述 投票:0回答:1

我正在尝试使用 Ansible openvswitch_db 模块创建 Open vSwitch QoS 设置。

Ansible 任务应模拟如下命令:

ovs-vsctl set port vm00-eth1 qos=@newqos -- --id=@newqos create qos type=egress-policer other-config:cir=30000000 other-config:cbs=3000000

我尝试了如下所示的 Ansible 任务,但它不会更改任何 QoS 设置。

- openvswitch.openvswitch.openvswitch_db:
    table: Port
    record: vm00-eth1
    col: other_config
    key: cir
    value: 30000000

Ansible 任务成功运行,但该端口上仍然没有 QoS 设置:

root@host00 ~ # ovs-appctl qos/show vm00-eth1
QoS not configured on vm00-eth1
ansible openvswitch
1个回答
0
投票

ovs-vsctl 设置端口 vm00-eth1 qos=@newqos -- --id=@newqos 创建 qos type=egress-policer other-config:cir=30000000 other-config:cbs=3000000

当你使用上面的命令时,实际上是在操作两个表。 Port表和QoS表用“--”一起引用。

命令执行的操作:

  • Port 表中条目 vm00-eth1 的列 qos 的值设置为 newqos
  • QoS表中条目newqos的列type的值设置为egress-policer
  • 将条目 newqosQoS 表中 other_config 中的键 cir 的值设置为 30000000
  • 将条目 newqosQoS 表中 other_config 中的键 cbs 的值设置为 * 3000000*

所以你得了解ovsdb中key、column、table的关系。以及表之间的连接。

将所有数据库操作放在ansible openvswitch_db模块中并不容易。我建议您改用 ansible shell 命令:

- name: setting qos
  shell: "{{ item.command }}"
  args:
    warn: false
  with_items:
    - { "command": "ovs-vsctl set port vm00-eth1 qos=@newqos -- --id=@newqos create qos type=egress-policer other-config:cir=30000000 other-config:cbs=3000000" }
© www.soinside.com 2019 - 2024. All rights reserved.