Quota set sends invalid messages

Bug #1451640 reported by Jamie Lennox
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-openstackclient
Fix Released
Undecided
Unassigned

Bug Description

Calling:

# openstack --debug --os-identity-api-version=3 --os-user-domain-id default --os-project-domain-id default quota set --cores 4 demo

on OSC 1.0.3 results in a request that looks like:

'{"quota_set": {"gigabytes": null, "tenant_id": "9d33152f0d27406382b072806bbf66bf", "snapshots": null, "volumes": null}}'

There are two problems here:

1. Cinder cannot handle Null values for its values and returns a 400 which fails the command
2. OSC should not send this request to cinder if there are no cinder values present.

The problem is that we build the quota set requests using getattr(key, val, None) and do not check the return and so we create a full dictionary with None values for options we do not wish to change.

This was fixed for volume in OSC 1.1.0 as a side effect of bug 1438377 where you can see the addition of the if value check, however this does not get backported into the stable 1.0 series.

The problem still affects compute in master.

Revision history for this message
Jamie Lennox (jamielennox) wrote :

Changing the title as this same problem will apply to compute in current master, I do not know if compute raises a similar error though.

summary: - Calling quota set in 1.0 sends invalid messages to cinder
+ Quota set sends invalid messages
description: updated
tags: added: kilo-backport-potential
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to python-openstackclient (master)

Reviewed: https://review.openstack.org/180012
Committed: https://git.openstack.org/cgit/openstack/python-openstackclient/commit/?id=179ed18c30cea438e13ba92997d3f671e5f76a84
Submitter: Jenkins
Branch: master

commit 179ed18c30cea438e13ba92997d3f671e5f76a84
Author: Jamie Lennox <email address hidden>
Date: Tue May 5 12:43:12 2015 +1000

    Don't create empty quota set requests

    The way that getattr is called with the None default you will always
    create a compute_kwargs dictionary with key: None values. This means
    that we will always send these empty requests to the servers.

    Change so that only actually changed values end up in the quota set
    requests and get sent.

    Change-Id: I33bc3f4e1a8013ec672e995648d27513064baf26
    Closes-Bug: #1451640

Changed in python-openstackclient:
status: New → Fix Committed
Dean Troyer (dtroyer)
Changed in python-openstackclient:
milestone: none → m11
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-openstackclient (stable/kilo)

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/182472

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on python-openstackclient (stable/kilo)

Change abandoned by Jamie Lennox (<email address hidden>) on branch: stable/kilo
Review: https://review.openstack.org/182472

Dean Troyer (dtroyer)
Changed in python-openstackclient:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.