← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1918565] Re: quota: invalid JSON for reservation value when positive

 

** Changed in: neutron
       Status: Confirmed => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1918565

Title:
  quota: invalid JSON for reservation value when positive

Status in neutron:
  Fix Released

Bug description:
  # High level description

  When a resource (e.g. port) is requested, QuotaDetail returns invalid
  JSON until all resources of that type are created (e.g. all ports
  requested are now created and there is no ongoing request to create
  any other port). The invalid JSON is only for the "reserved" key,
  which returns a string instead of an integer.

  This is incompatible with what the API is supposed to return:
  https://docs.openstack.org/api-ref/network/v2/index.html?expanded=show-quota-details-for-a-tenant-detail

  "The value for each resource type is itself an object (the quota set)
  containing the quota’s used, limit and reserved integer values."

  It is problematic in the context of gophercloud, which expect an integer to be returned, and not a string:
  https://github.com/gophercloud/gophercloud/blob/cd9c207e93f4f76af2c0a06c6d449ab342bfbe56/openstack/networking/v2/extensions/quotas/results.go#L125

  # Pre-conditions

  * Neutron QuotaDB driver is used.
  * Resources have to be under creation (e.g. ports)

  # Step-by-step reproduction steps

  * Get a token from Keystone:
  $ openstack token issue

  And export its ID as $token.

  * Run this loop:
  $ while true; do curl -H "X-Auth-Token: $token" <your-neutron-endpoint>:9696/v2.0/quotas/<your-project-id>/details.json | jq '.'|& tee -a logs; done

  * In another terminal, run this command:
  $ tail -f logs|grep 'reserved": "'

  * Now, create ports (e.g. 3 ports)
  $ openstack port create (...)

  * Expected output

  {
    "quota": {
      "port": {
        "limit": 500,
        "used": 0,
        "reserved": 3
      },
  ...
  }

  Then:

  {
    "quota": {
      "port": {
        "limit": 500,
        "used": 1,
        "reserved": 2
      },
  ...
  }

  Then:

  {
    "quota": {
      "port": {
        "limit": 500,
        "used": 2,
        "reserved": 1
      },
  ...
  }

  And then:

  {
    "quota": {
      "port": {
        "limit": 500,
        "used": 3,
        "reserved": 0
      },
  ...
  }

  * Actual output

  {
    "quota": {
      "port": {
        "limit": 500,
        "used": 0,
        "reserved": "3"
      },
  ...
  }

  Then:

  {
    "quota": {
      "port": {
        "limit": 500,
        "used": 1,
        "reserved": "2"
      },
  ...
  }

  Then:

  {
    "quota": {
      "port": {
        "limit": 500,
        "used": 2,
        "reserved": "1"
      },
  ...
  }

  And then:

  {
    "quota": {
      "port": {
        "limit": 500,
        "used": 3,
        "reserved": 0 // an integer!
      },
  ...
  }

  # Version:

  Master and stable branches.
  RHEL 8.3
  TripleO based deployment (OSP 17)

  # Environment:
  OSP17 deployed in standalone, OVN backend.

  # Perceived severity:
  Workaround is possible but currently blocking gophercloud to be working for QuotaDetails.

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



References