16 Commits

Author SHA1 Message Date
Stanislav Kudriashev
48da7226c0 Unify doc-strings format
Change-Id: If6cf2caeae294db30a8988ab861441211b651580
2014-08-28 11:42:12 +03:00
Matt Riedemann
5eeba0ca19 Add MacAddressInUseClient exception handling
Nova needs a specific client exception defined for the server's
MacAddressInUse exception when allocating ports so it can handle the
exception properly, otherwise the NeutronClientException with a 409 can
be confused with other errors.

Partial-Bug: #1347778

Change-Id: Ia02dbc8fe32a43adeb229e3b640b9b33ec0dd6c7
2014-07-23 10:37:30 -07:00
Jenkins
855811edd9 Merge "Ensure .status_code is defined for all NeutronClientExceptions" 2014-06-25 17:08:14 +00:00
Angus Lees
181a9c7be6 Ensure .status_code is defined for all NeutronClientExceptions
nova contains plenty of code like:
  except neutron_client_exc.NeutronClientException as e:
      if e.status_code == 409:
          ...

This change declares a fallback of 0 for exceptions without a more
explicit status code.  This was the behaviour prior to Change-Id
I99b9560b3afaf5884fd00353323267da450338fa

Change-Id: Ib736205066fd5cd9738fd3fb3b64f6590803cf39
2014-06-25 14:41:24 +10:00
jichenjc
cbdd56da30 Add OverQuotaClient as exception to neutronclient
In nova, there is no way to explictly knows whether the neutron
fails due to over quota or no more floating ips and fixed ips.
so nova need to check whether the return value is 409 in order to
raise an over quota exception. It's easier in neutronclient to
raise the exception then nova will handle it.

Related-Bug: #1210598

Change-Id: I8788993578ac872da9f676fe3e2fb8f98414289d
2014-05-31 11:22:53 +08:00
Akihiro Motoki
ecad086e59 Rearrange neutronclient exceptions for more easy use
- Map exceptions from neutron server into corresponding client
  exceptions automatically (without exception mapping dict).
  An exception from Neutron server 'SomeException' will be
  mapped to an exception 'SomeExceptionClient' ('Client' suffix)
  if it is defined.

- If no corresponding exception is defined in client side,
  an exception per response code will be used. Previously
  NeutronClientException was used for all cases and a user
  of client library cannot know exception type without
  checking exception.status_code. It allows client lib users
  (such as Horizon) to handle exceptions more easily.

- All exceptions from client libarry inherit NeutronClientException
  and all CLI related exceptions inherits NeutronCLIError now.

- Remove unused exceptions (including Quantum v1 related)
- MalformedRequestBody is renamed to MalformedResponseBody
  because it is raised in deserializer and deserializer is
  used to parse not request but response.

Closes-Bug: #1296148
Change-Id: I99b9560b3afaf5884fd00353323267da450338fa
2014-03-24 06:02:08 +09:00
Drew Thorstensen
e49819caf9 New exception when auth_url is not specified
Certain scenarios into the neutron client will not specify the
auth_url.  This is typically when a token is specified.  However, when
the token is expired the neutron client will attempt to refresh the
token.  Users of this may not have passed in all of the required
information for this reauthentication to properly occur.

This code fixes an error that occurs in this flow where the auth_url
(which is None) is appended to another string.  This results in a core
Python error.

The update will provide a more targetted error message specifying to
the user that the auth_url needs to be specified.  An associated unit
test is also included to validate this behavior.

Change-Id: I577ce0c009a9a281acdc238d290a22c5e561ff82
Closes-Bug: #1241275
2014-03-04 13:58:47 -06:00
liu-sheng
e955a1fc80 Remove vi modelines
We don't need to have the vi modelines in each source file,
it can be set in a user's vimrc if required.

Change-Id: Ic30e91df1b0e25beda9b8d8c19be58573cdae4f6
Closes-Bug: #1229324
2014-02-10 17:00:28 +08:00
armando-migliaccio
9235f83d68 Rename Nicira NVP to VMware NSX in neutronclient
Use new naming scheme to reflect rebranding.

Partial-implements blueprint nicira-plugin-renaming

Change-Id: I694fbda1c228e92a0b910358523787fa742d9ab2
2014-01-28 17:21:06 -08:00
Sergio Cazzolato
6d937f3e85 Fix i18n messages in neutronclient
Using tools/check_i18n.py to scan source directory, and fix most of
the errors.
    - Message internationalization
    - First letter must be capital
    - Using comma instead of percent in LOG.xxx

Partial-Bug: #1217100
Change-Id: I312f999f97e33d84c3f06fa1caacf32affc26a78
2013-11-29 19:16:22 -05:00
Matt Riedemann
2dd8f7afe2 Handle IpAddressInUse with client exception
Nova is not able to reliably distinguish between port OverQuota 409
errors and IpAddressInUse 409 errors when setting up networks for
instances. The client needs to provide a more granular exception so
nova can translate the error to it's own set of exceptions.

Also adds a test case for the exception_handler_v20 utility method which
was lacking explicit test coverage before this change.

Partial-Bug: #1247844

Change-Id: I71589097ae660c3385b3f4ff93ffae99ac7042b9
2013-11-25 03:44:07 -08:00
Chris Yeoh
0d532673d7 Adds ExternalIpAddressExhaustedClient exception
Adds the ExternalIpAddressExhaustedClient exception so
a more specific exception than NeutronClientException is raised
when IPs run out. This will allow for better exception
handling in Nova.

Closes-Bug: 1233143

Change-Id: I9f40bf14eec0f485dfd21b36605a2474b99a8941
2013-09-30 22:30:10 +09:30
Chris Yeoh
16bf2825ad Adds IpAddressGenerationFailureClient exception
Adds the IpAddressGenerationFailureClient exception so
a more specific exception than NeutronClientException is raised
when IPs run out. This will allow for better exception
handling in Nova and help fix nova bug 1212137

Change-Id: I921ba5d5f5ee3dc9620dcdbbd04d6fef824c9a53
Closes-Bug: 1231836
2013-09-27 17:04:44 +09:30
Roman Podolyaka
499ed84bd7 Handle host side SSL certificates validation
- add --os-cacert option which allows to set a file containing
   certificates of root CAs (certificate authorities) that are
   required for validation of HTTPS servers SSL certificates

 - wrap httplib2 SSL certificates validation errors with a
   custom quantumclient exception

Blueprint: quantum-client-ssl

Change-Id: I4e6a7d177ba14314ba9bed613ec2684bffc35222
2013-07-23 16:15:19 +03:00
Aaron Rosen
04178517bc raise better exception for duplicate match
When a duplicate match is found the client previously raised a
NeutronClientException which made it hard for programs using the client
to handle errors. This patch now  makes it raise a
NeutronClientNoUniqueMatch  exception instead.

Fixes bug: 1200323

Change-Id: I6ef6f9a9e257104f676dde7ec26be98417ec70e0
2013-07-16 13:46:01 -07:00
Mark McClain
93ac15bfeb Rename quantumclient to neutronclient
Implements Blueprint: remove-use-of-quantum

Change-Id: Idebe92d56d277435ffd23f292984f9b8b8fdb2df
2013-07-03 11:56:44 -04:00