Activity log for bug #1187698

Date Who What changed Old value New value Message
2013-06-05 09:17:15 Andrea Frittoli bug added bug
2013-06-05 09:21:55 Andrea Frittoli summary Status code missing in case of network quota exception Status code missing in case of quota exception
2013-06-05 09:22:57 Andrea Frittoli description When getting a network quota exception like follows: DEBUG: quantumclient.client RESP:{'date': 'Wed, 05 Jun 2013 09:02:11 GMT', 'status': '409', 'connection': 'close', 'content-type': 'application/json', 'content-length': '61'} {"QuantumError": "Quota exceeded for resources: ['network']"} The status code returned by the binding is 0. The error_dict built by the code below in client.py is actually a string "Quota exceeded for resources: ['network']". Thus it ends-up in the else case below, which does not pass the status_code along. I think there are two problems with the code here: - the quota exception shall be recognized properly - the else case shall pass the status code anyways if error_dict: # If QuantumError key is found, it will definitely contain # a 'message' and 'type' keys? try: error_type = error_dict['type'] error_message = (error_dict['message'] + "\n" + error_dict['detail']) except Exception: bad_quantum_error_flag = True if not bad_quantum_error_flag: ex = None try: # raise the appropriate error! ex = quantum_errors[error_type](message=error_message) ex.args = ([dict(status_code=status_code, message=error_message)], ) except Exception: pass if ex: raise ex else: raise exceptions.QuantumClientException(message=error_dict) When getting a network quota exception like follows: DEBUG: quantumclient.client RESP:{'date': 'Wed, 05 Jun 2013 09:02:11 GMT', 'status': '409', 'connection': 'close', 'content-type': 'application/json', 'content-length': '61'} {"QuantumError": "Quota exceeded for resources: ['network']"} The status code returned by the binding is 0. The error_dict built by the code below in client.py is actually a string "Quota exceeded for resources: ['network']". Thus it ends-up in the else case below, which does not pass the status_code along. I think there are two problems with the code here: - the quota exception shall be recognized properly - the else case shall pass the status code anyways The same issue applies to port and subnet quotas.     if error_dict:         # If QuantumError key is found, it will definitely contain         # a 'message' and 'type' keys?         try:             error_type = error_dict['type']             error_message = (error_dict['message'] + "\n" +                              error_dict['detail'])         except Exception:             bad_quantum_error_flag = True         if not bad_quantum_error_flag:             ex = None             try:                 # raise the appropriate error!                 ex = quantum_errors[error_type](message=error_message)                 ex.args = ([dict(status_code=status_code,                                  message=error_message)], )             except Exception:                 pass             if ex:                 raise ex         else:             raise exceptions.QuantumClientException(message=error_dict)
2013-07-26 10:21:45 ZhiQiang Fan bug added subscriber Zhiqiang Fan
2015-12-03 16:29:46 Akihiro Motoki python-neutronclient: status New Fix Released