@@ -55,10 +55,12 @@ def _attach_volume_response(response):
5555 if 'errortext' in response :
5656 if 'specify a volume that is not attached' in response ['errortext' ]:
5757 errors .invalid_volume_attached ()
58- if 'Invalid parameter virtualmachineid' in response ['errortext' ]:
58+ elif 'Invalid parameter virtualmachineid' in response ['errortext' ]:
5959 errors .invalid_instance_id ()
60- if 'Invalid parameter id' in response ['errortext' ]:
60+ elif 'Invalid parameter id' in response ['errortext' ]:
6161 errors .invalid_volume_id ()
62+ else :
63+ errors .invalid_request (response ['errortext' ])
6264
6365 response = response ['volume' ]
6466 return {
@@ -119,8 +121,10 @@ def _create_volume_response(response):
119121 if 'errortext' in response :
120122 if 'Invalid parameter snapshotid' in response ['errortext' ]:
121123 errors .invalid_snapshot_id ()
122- if 'unable to find a snapshot with id' in response ['errortext' ]:
124+ elif 'unable to find a snapshot with id' in response ['errortext' ]:
123125 errors .invalid_snapshot_id ()
126+ else :
127+ errors .invalid_request (response ['errortext' ])
124128
125129 response = response ['volume' ]
126130 return {
@@ -167,6 +171,8 @@ def _delete_volume_response(response):
167171 if 'errortext' in response :
168172 if 'Unable to aquire volume' in response ['errortext' ]:
169173 errors .invalid_volume_id ()
174+ else :
175+ errors .invalid_request (response ['errortext' ])
170176
171177 return {
172178 'template_name_or_list' : 'status.xml' ,
@@ -194,7 +200,7 @@ def describe_volumes():
194200
195201def _describe_volumes_response (response ):
196202 """
197- Generates a response for describe volume request.
203+ Generates a response for describe volumes request.
198204
199205 @param response: Response from cloudstack.
200206 @return: Response.
@@ -251,10 +257,12 @@ def _detach_volume_response(response):
251257 if 'errortext' in response :
252258 if 'specified volume is not attached' in response ['errortext' ]:
253259 errors .invalid_volume_detached ()
254- if 'Invalid parameter virtualmachineid' in response ['errortext' ]:
260+ elif 'Invalid parameter virtualmachineid' in response ['errortext' ]:
255261 errors .invalid_instance_id ()
256- if 'Invalid parameter id' in response ['errortext' ]:
262+ elif 'Invalid parameter id' in response ['errortext' ]:
257263 errors .invalid_volume_id ()
264+ else :
265+ errors .invalid_request (response ['errortext' ])
258266
259267 response = response ['volume' ]
260268 return {
0 commit comments