Reviewed: https://review.openstack.org/536545 Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=5a4872ed306ad33a2bceb50846a4b38ad3b95c73 Submitter: Zuul Branch: master
commit 5a4872ed306ad33a2bceb50846a4b38ad3b95c73 Author: Eric Fried <efr...@us.ibm.com> Date: Mon Jan 22 13:49:52 2018 -0600 Report Client: PUT empty (not None) JSON data Previously if a False-ish payload was sent to SchedulerReportClient.put, we wouldn't send it through in the API call at all. But False-ish payloads may be legitimate: e.g. there is currently no DELETE API for /resource_providers/{u}/aggregates so this is how you would remove all aggregate associations for a provider. In any case, placement's PUT API refuses to accept a request that doesn't have Content-Type: application/json, which is set automatically by Session if json is not None. With this change set, we send payloads through to PUT unless they're actually None. Change-Id: I69d2b16d515590907ca0e0dc4da77dcf8e539976 Closes-Bug: #1744786 ** Changed in: nova Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to OpenStack Compute (nova). https://bugs.launchpad.net/bugs/1744786 Title: SchedulerReportClient.put with empty (not None) payload errors 415 Status in OpenStack Compute (nova): Fix Released Bug description: https://github.com/openstack/nova/blob/f0d830d56d20c7f34372cd3c68d13a94bdf645a6/nova/scheduler/client/report.py#L295-L302 295 def put(self, url, data, version=None): 296 # NOTE(sdague): using json= instead of data= sets the 297 # media type to application/json for us. Placement API is 298 # more sensitive to this than other APIs in the OpenStack 299 # ecosystem. 300 kwargs = {'microversion': version} 301 if data: 302 kwargs['json'] = data On line 301, if data is a False value other than None, we won't set the json kwarg, so Session won't set the content type to application/json, and we'll run afoul of: <html> <head> <title>415 Unsupported Media Type</title> </head> <body> <h1>415 Unsupported Media Type</h1> The request media type None is not supported by this server. <br /><br /> The media type None is not supported, use application/json </body> </html> A normal "workaround" - which is being used for e.g. inventories - is for the caller to check for "empty" and hit the DELETE API instead. But we don't have a DELETE API for resource provider aggregates (/resource_providers/{u}/aggregates). To manage notifications about this bug go to: https://bugs.launchpad.net/nova/+bug/1744786/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp