← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1865040] Re: Able to show update and delete aggregate with invalid id

 

** Changed in: nova/train
       Status: New => 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/1865040

Title:
  Able to show update and delete aggregate with invalid id

Status in OpenStack Compute (nova):
  Fix Released
Status in OpenStack Compute (nova) pike series:
  New
Status in OpenStack Compute (nova) queens series:
  New
Status in OpenStack Compute (nova) rocky series:
  New
Status in OpenStack Compute (nova) stein series:
  New
Status in OpenStack Compute (nova) train series:
  Fix Released

Bug description:
  Description
  ===========
  Able to show, update and delete the aggregate with invalid id. Invalid id means it will start with the same id but appended with some alphanumeric string(ex - actual_id: 5 invalid_id: 5abcd or invalid_id: 5abcd123).

  This issue is only with actual_id appended with alphanumeric value
  started with alphabets not with numbers.

  The aggregate id which is being received on routes is not converting
  to integer anywhere in the code and later it gets transfer to db ,
  which truncates the appended string with original id -

  ex below warning -

  /usr/local/lib/python2.7/dist-packages/pymysql/cursors.py:166:
  Warning: (1292, u"Truncated incorrect DOUBLE value: '6abcd123'")

  There are ways to change the setting and convert the warning into
  error but the code should handle such situation and raise an exception
  with proper error message.

  Steps to reproduce
  ==================

  1. Create an aggregate -

  +----+----------+-------------------+
  | ID | Name     | Availability Zone |
  +----+----------+-------------------+
  |  5 | new_name | None              |
  +----+----------+-------------------+

  2. Get the above created aggregate with a wrong id Ex - 5abcd (started
  with correct id but appended with some alphabets)

  curl -g -i -X GET http://192.168.56.5:8774/v2.1/os-aggregates/5abcd -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: $TOKEN"HTTP/1.1 200 OK
  Content-Length: 226
  Content-Type: application/json
  Openstack-Api-Version: compute 2.1
  X-Openstack-Nova-Api-Version: 2.1
  Vary: OpenStack-API-Version
  Vary: X-OpenStack-Nova-API-Version
  X-Compute-Request-Id: req-c76d66ad-c4ce-430a-bcd5-a5ec5e962d2e
  Date: Thu, 27 Feb 2020 13:44:07 GMT

  {"aggregate": {"name": "new_name", "availability_zone": null,
  "deleted": false, "created_at": "2020-02-27T13:34:00.000000",
  "updated_at": "2020-02-27T13:41:14.000000", "hosts": [], "deleted_at":
  null, "id": 5, "metadata":
  {}}}stack@a:~/nova/nova/api/openstack/compute$

  3. Update the above created aggregate with a wrong id Ex - 5abcd
  (started with correct id but appended with some alphabets) -

  Response (0.169s) - http://192.168.56.5:8774/v2.1/os-aggregates/5abcd
  200 OK

  {
    "aggregate": {
      "name": "new_updated",
      "availability_zone": null,
      "deleted": false,
      "created_at": "2020-02-27T13:34:00.000000",
      "updated_at": "2020-02-27T13:45:17.542075",
      "hosts": [],
      "deleted_at": null,
      "id": 5,
      "metadata": {}
    }
  }

  4. Delete the above created aggregate with a wrong id Ex - 5abcd
  (started with correct id but appended with some alphabets) -

  curl -g -i -X DELETE http://192.168.56.5:8774/v2.1/os-aggregates/5abcd -H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: $TOKEN"
  HTTP/1.1 200 OK
  Content-Length: 0
  Content-Type: application/json
  Openstack-Api-Version: compute 2.1
  X-Openstack-Nova-Api-Version: 2.1
  Vary: OpenStack-API-Version
  Vary: X-OpenStack-Nova-API-Version
  X-Compute-Request-Id: req-8d4a2d57-934b-4c66-9a48-9e114b1b4e9f
  Date: Thu, 27 Feb 2020 13:46:10 GMT

  Expected result
  ===============
  Show, update and delete should not work for invalid id (mentioned in summary).

  Actual result
  =============
  Show, update and delete is working for invalid id (mentioned in summary).

  Environment
  ===========
  1. Openstack Release - Ocata
  2. Hypervisor - QEMU

To manage notifications about this bug go to:
https://bugs.launchpad.net/nova/+bug/1865040/+subscriptions


References