← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1843379] Re: Tagging is not work for tags of QoS Policy

 

Thanks for your report. While the server shouldn't return a 500, your
request is incorrect. I tested this in my local environment with the
following request:

PUT $APIIP:9696/v2.0/policies/<policy-id>/tags
         Request body:
           {
             "tags": ["sss","vvvvv"]
           }

and the response I get is code 200 with body:

{
    "tags": [
      "sss",
      "vvvvv"
    ]
}

Please note that url you are using for your request is different to the
one I used: the resource is policies instead of qos/policies

** Changed in: neutron
       Status: New => Invalid

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

Title:
  Tagging is not work for tags of QoS Policy

Status in neutron:
  Invalid

Bug description:
  hi,
   I found it is not work when put tags for Qos policy, and there were any errors occured.
  neutron version:Pike
  Folling steps:
  step 1: PUT 10.125.30.76:9696/v2.0/qos/policies/b10e702c-dac6-44e9-aadc-7a58182ae722/tags
           Request body:
             {
               "tags": ["sss","vvvvv"]
             }
           Response:
             {
               "NeutronError": {
               "message": "Request Failed: internal server error while processing your request.",
               "type": "HTTPInternalServerError",
                "detail": ""
               }
             }
     logs of neutron:
      2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation [req-223f2107-8dea-442d-8d74-049862635abc 08f74f4a-5693-4ec0-9723-b9293716db36 c7ad318f-6faa-4c83-8675-be6a46e62f72
  - default default] PUT failed.: TypeError: argument of type 'NoneType' is not iterable
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation Traceback (most recent call last):
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/pecan/core.py", line 678, in __call__
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     self.invoke_controller(controller, args, kwargs, state)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/pecan/core.py", line 569, in invoke_controller
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     result = controller(*args, **kwargs)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/neutron/db/api.py", line 93, in wrapped
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     setattr(e, '_RETRY_EXCEEDED', True)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     self.force_reraise()
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     six.reraise(self.type_, self.value, self.tb)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/neutron/db/api.py", line 89, in wrapped
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     return f(*args, **kwargs)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 150, in wrapper
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     ectxt.value = e.inner_exc
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     self.force_reraise()
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     six.reraise(self.type_, self.value, self.tb)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/oslo_db/api.py", line 138, in wrapper
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     return f(*args, **kwargs)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/neutron/db/api.py", line 128, in wrapped
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     LOG.debug("Retry wrapper got retriable exception: %s", e)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     self.force_reraise()
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     six.reraise(self.type_, self.value, self.tb)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/neutron/db/api.py", line 124, in wrapped
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     return f(*dup_args, **dup_kwargs)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/neutron/pecan_wsgi/controllers/utils.py", line 76, in wrapped
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     return f(*args, **kwargs)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/neutron/pecan_wsgi/controllers/utils.py", line 398, in index
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     result = controller_method(*args, **uri_identifiers)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/neutron/extensions/tagging.py", line 136, in update_all
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     validate_tags(body)
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation   File "/usr/lib/python2.7/site-packages/neutron/extensions/tagging.py", line 74, in validate_tags
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation     if 'tags' not in body:
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation TypeError: argument of type 'NoneType' is not iterable
  2019-09-10 14:32:13.740 87718 ERROR neutron.pecan_wsgi.hooks.translation

  step 2: I used PDB to add breakpoints to the /usr/lib/python2.7/site-
  packages/neutron/extensions/tagging.py, like this:

   def validate_tags(body):
       import pdb;pdb.set_trace()
       if 'tags' not in body:
           raise exceptions.InvalidInput(error_message=_("Invalid tags body"))
       msg = validators.validate_list_of_unique_strings(body['tags'], MAX_TAG_LEN)
       if msg:
           raise exceptions.InvalidInput(error_message=msg)

     Retry step 1, I found the body was None

  step 3: I found there is not path_prefix where the method
  get_resources call  extensions.ResourceExtension().So I modified the
  /usr/lib/python2.7/site-packages/neutron/extensions/tagging.py, like
  this:

      def get_resources(cls):
          """Returns Ext Resources."""
          exts = []
          action_status = {'index': 200, 'show': 204, 'update': 201,
                           'update_all': 200, 'delete': 204, 'delete_all': 204}
          controller = api_resource.Resource(TaggingController(),
                                             base.FAULT_MAP,
                                             action_status=action_status)
          collection_methods = {"delete_all": "DELETE",
                                "update_all": "PUT"}
          exts = []
          path_prefix = ""
          for collection_name, member_name in TAG_SUPPORTED_RESOURCES.items():
              if 'security_group' in collection_name:
                  collection_name = collection_name.replace('_', '-')
              parent = {'member_name': member_name,
                        'collection_name': collection_name}
              if 'policies' in collection_name:
                  path_prefix = "/qos"
              exts.append(extensions.ResourceExtension(
                  TAGS, controller,path_prefix=path_prefix, parent,
                  collection_methods=collection_methods))
          return exts

    Retry step 1, it wokrs

  I think there is a bug for some plugins those have path_prefix when put tags.
  Does anyone else have an idea?

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


References