At the time of reporting I thought this is a combination of client and server side bugs. But now I think this should be fixed purely on server side.
My original thinking was based on the fact that neutronclient can update a qos rule, while osc cannot. And my first attempt for a fix was to get osc to send the same body as neutronclient does.
But if you take a closer look at the PUT bodies sent by both clients, you may ask why neutron-server mandates the presence of the direction field in the body even when the direction field is not being updated? We only want to update min_kbps here. So the body sent by osc should be accepted by neutron-server as a valid request.
While debugging I also realized it's practically impossible to get osc (ie. openstacksdk more precisely) to send the same body as neutronclient does. The basic reason is the logic in the _update() method here:
Instead of sending a single PUT, it first GETs the resource and only includes the changed fields into the PUT body. By that it does not care if '[--ingress|--egress]' was present on the command line as long as the direction field's value does not change. In the source I don't see a way to force the inclusion a field that didn't change. So with the current openstacksdk I don't think this can be fixed on the client side.
Anyway there's an easy workaround if someone is willing to fiddle with curl:
$ cat min-bw-rule-update
#! /bin/sh
# export TOKEN="$( openstack token issue -f value -c id )"
# min-bw-rule-update NEUTRON-BASE-URL POLICY-ID RULE-ID DIRECTION MIN-KBPS
# min-bw-rule-update http://127.0.0.1:9696 188a2f59-ab90-41a3-9e6f-58e641a34544 f392837a-09e2-4b5e-8c29-86670797679e egress 1001
Quick summary of my findings so far:
At the time of reporting I thought this is a combination of client and server side bugs. But now I think this should be fixed purely on server side.
My original thinking was based on the fact that neutronclient can update a qos rule, while osc cannot. And my first attempt for a fix was to get osc to send the same body as neutronclient does.
But if you take a closer look at the PUT bodies sent by both clients, you may ask why neutron-server mandates the presence of the direction field in the body even when the direction field is not being updated? We only want to update min_kbps here. So the body sent by osc should be accepted by neutron-server as a valid request.
While debugging I also realized it's practically impossible to get osc (ie. openstacksdk more precisely) to send the same body as neutronclient does. The basic reason is the logic in the _update() method here:
https:/ /github. com/openstack/ openstacksdk/ blob/master/ openstack/ proxy.py# L178
Instead of sending a single PUT, it first GETs the resource and only includes the changed fields into the PUT body. By that it does not care if '[--ingress| --egress] ' was present on the command line as long as the direction field's value does not change. In the source I don't see a way to force the inclusion a field that didn't change. So with the current openstacksdk I don't think this can be fixed on the client side.
Anyway there's an easy workaround if someone is willing to fiddle with curl:
$ cat min-bw-rule-update
#! /bin/sh
# export TOKEN="$( openstack token issue -f value -c id )" 127.0.0. 1:9696 188a2f59- ab90-41a3- 9e6f-58e641a345 44 f392837a- 09e2-4b5e- 8c29-8667079767 9e egress 1001
# min-bw-rule-update NEUTRON-BASE-URL POLICY-ID RULE-ID DIRECTION MIN-KBPS
# min-bw-rule-update http://
neutron_ base_url= "${1:?} "
policy_id="${2:?}"
rule_id="${3:?}"
direction="${4:?}"
min_kbps="${5:?}"
cat <<EOF | bandwidth_ rule": neutron_ base_url: ?}/v2.0/ qos/policies/ $policy_ id/minimum_ bandwidth_ rules/$ rule_id" \
{"minimum_
{"direction": "$direction",
"min_kbps": "$min_kbps"}}
EOF
curl \
--silent \
--insecure \
--request PUT \
--header "content-type: application/json" \
--header "x-auth-token: ${TOKEN:?}" \
--data @- \
"${
| json_pp
lajoskatona told me he's looking into the server side of this bug, the next update may be coming from him.