Solve the problem that the neutron client uri request is too long

Source: Internet
Author: User

Problem:


When the O & M personnel use the administrator to execute the neutron security-group-rule-list security group rule query, because there are too many security group rules, our neutron-client code version is old, error 414 is displayed.

Solution process:

Check the new code of the community. The bug has been fixed.


Fix listing security group rules

When querying security group rules, this patch splits the uri into multiple http requests if it finds that the uri is larger than 8192 bytes.

After the backport is returned, run the command again. neutron-server returns error 400.

ERROR: neutronclient. shell Your browser sent an invalid request.
</Body> Traceback (most recent call last ):
File "/usr/lib/python2.6/site-packages/neutronclient/shell. py", line 554, in run_subcommand
Return run_command (cmd, cmd_parser, sub_argv)
File "/usr/lib/python2.6/site-packages/neutronclient/shell. py", line 83, in run_command
Return cmd. run (known_args)
File "/usr/lib/python2.6/site-packages/neutronclient/common/command. py", line 34, in run
Return super (OpenStackCommand, self). run (parsed_args)
File "/usr/lib/python2.6/site-packages/cliff/display. py", line 84, in run
Column_names, data = self. take_action (parsed_args)
File "/usr/lib/python2.6/site-packages/neutronclient/common/command. py", line 40, in take_action
Return self. get_data (parsed_args)
File "/usr/lib/python2.6/site-packages/neutronclient/neutron/v2_0/_ init _. py", line 615, in get_data
Self. extend_list (data, parsed_args)
File "/usr/lib/python2.6/site-packages/neutronclient/neutron/v2_0/securitygroup. py", line 171, in extend_list
_ Get_sec_group_list (sec_group_ids [I: I + chunk_size])
File "/usr/lib/python2.6/site-packages/neutronclient/neutron/v2_0/securitygroup. py", line 153, in _ get_sec_group_list
** Search_opts). get ('Security _ groups ', [])
File "/usr/lib/python2.6/site-packages/neutronclient/v2_0/client. py", line 101, in with_params
Ret = self. function (instance, * args, ** kwargs)
File "/usr/lib/python2.6/site-packages/neutronclient/v2_0/client. py", line 476, in list_security_groups
Retrieve_all, ** _ params)
File "/usr/lib/python2.6/site-packages/neutronclient/v2_0/client. py", line 1330, in list
For r in self. _ pagination (collection, path, ** params ):
File "/usr/lib/python2.6/site-packages/neutronclient/v2_0/client. py", line 1343, in _ pagination
Res = self. get (path, params = params)
File "/usr/lib/python2.6/site-packages/neutronclient/v2_0/client. py", line 1316, in get
Headers = headers, params = params)
File "/usr/lib/python2.6/site-packages/neutronclient/v2_0/client. py", line 1301, in retry_request
Headers = headers, params = params)
File "/usr/lib/python2.6/site-packages/neutronclient/v2_0/client. py", line 1244, in do_request
Self. _ handle_fault_response (status_code, replybody)
File "/usr/lib/python2.6/site-packages/neutronclient/v2_0/client. py", line 1211, in _ handle_fault_response
Exception_handler_v20 (status_code, des_error_body)
File "/usr/lib/python2.6/site-packages/neutronclient/v2_0/client. py", line 81, in exception_handler_v20
Message = message)
NeutronClientException: Your browser sent an invalid request.
</Body>


When the neutron client executes the security-group-rule-list command, it first sends a request to obtain the security-group-rules and obtains the security-groups id, then, send the request again based on these IDs.

View the neutron server log and find that the neutron server did not receive the second request, but the uri length does not exceed eventlet. wsgi. server's default maximum length of 8192.

A bug was raised to the community, which was not confirmed by the community. Adjust the chunk_size in the code by yourself, so that the uri of a request is not that long, and the neutron-server returns the result correctly.

I am not sure whether this problem is caused by the master version and python-eventlet version I. Since the community Test has passed, it indicates that there should be no problem on the master, but it has not been verified yet. (After testing on the master version, the neutron server returns normal)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.