summaryrefslogtreecommitdiffstats
path: root/kilo
diff options
context:
space:
mode:
Diffstat (limited to 'kilo')
-rw-r--r--kilo/kilo/requests/views/flavor.py11
-rw-r--r--kilo/kilo/requests/views/hosts.py5
-rw-r--r--kilo/kilo/requests/views/image.py14
-rw-r--r--kilo/kilo/requests/views/limits.py5
-rw-r--r--kilo/kilo/requests/views/network.py11
-rw-r--r--kilo/kilo/requests/views/server.py11
-rw-r--r--kilo/kilo/requests/views/subnet.py11
-rw-r--r--kilo/kilo/requests/views/tenants.py5
-rw-r--r--kilo/kilo/requests/views/volume.py11
-rw-r--r--kilo/kilo/requests/views/vport.py11
10 files changed, 85 insertions, 10 deletions
diff --git a/kilo/kilo/requests/views/flavor.py b/kilo/kilo/requests/views/flavor.py
index fb8fb697..84cbc419 100644
--- a/kilo/kilo/requests/views/flavor.py
+++ b/kilo/kilo/requests/views/flavor.py
@@ -14,7 +14,7 @@
import logging
import json
import traceback
-
+from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -118,6 +118,9 @@ class Flavors(APIView):
return Response(data=content, status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -241,6 +244,9 @@ class Flavors(APIView):
self.delete_flavor(sess, flavorid)
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
@@ -309,6 +315,9 @@ class Flavors(APIView):
return Response(status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
diff --git a/kilo/kilo/requests/views/hosts.py b/kilo/kilo/requests/views/hosts.py
index dfd34513..022c59e9 100644
--- a/kilo/kilo/requests/views/hosts.py
+++ b/kilo/kilo/requests/views/hosts.py
@@ -14,7 +14,7 @@
import logging
import json
import traceback
-
+from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -76,6 +76,9 @@ class Hosts(APIView):
return Response(data=content, status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
diff --git a/kilo/kilo/requests/views/image.py b/kilo/kilo/requests/views/image.py
index c8f66b28..a3e70019 100644
--- a/kilo/kilo/requests/views/image.py
+++ b/kilo/kilo/requests/views/image.py
@@ -16,7 +16,7 @@ import json
import urllib2
import threading
import traceback
-
+from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -65,6 +65,9 @@ class imageThread (threading.Thread):
logger.debug("response status code of transfer_image %s" % resp.status_code)
return None
+ except HttpError as e:
+ logger.error("transfer_image, HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return None
except Exception as e:
logger.error(traceback.format_exc())
logger.debug("Failed to transfer_image:%s" % str(e))
@@ -90,6 +93,9 @@ class Images(APIView):
return Response(data=content, status=status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -203,6 +209,9 @@ class Images(APIView):
except urllib2.URLError as e:
return Response(data={'error': 'image is not accessible:%s' % str(e)},
status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -223,6 +232,9 @@ class Images(APIView):
return Response(status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
diff --git a/kilo/kilo/requests/views/limits.py b/kilo/kilo/requests/views/limits.py
index ee44124b..3b6f0528 100644
--- a/kilo/kilo/requests/views/limits.py
+++ b/kilo/kilo/requests/views/limits.py
@@ -14,7 +14,7 @@
import logging
import json
import traceback
-
+from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -75,6 +75,9 @@ class Limits(APIView):
return Response(data=content_all, status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
diff --git a/kilo/kilo/requests/views/network.py b/kilo/kilo/requests/views/network.py
index eb45189b..61a409e4 100644
--- a/kilo/kilo/requests/views/network.py
+++ b/kilo/kilo/requests/views/network.py
@@ -14,7 +14,7 @@
import logging
import json
import traceback
-
+from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -48,6 +48,9 @@ class Networks(APIView):
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -132,6 +135,9 @@ class Networks(APIView):
return Response(data=resp_body, status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -155,6 +161,9 @@ class Networks(APIView):
return Response(status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
diff --git a/kilo/kilo/requests/views/server.py b/kilo/kilo/requests/views/server.py
index 0da19c44..92440429 100644
--- a/kilo/kilo/requests/views/server.py
+++ b/kilo/kilo/requests/views/server.py
@@ -14,7 +14,7 @@
import logging
import json
import traceback
-
+from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -79,6 +79,9 @@ class Servers(APIView):
return Response(data=content, status=status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -240,6 +243,9 @@ class Servers(APIView):
return Response(data=resp_body, status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -260,6 +266,9 @@ class Servers(APIView):
return Response(status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
diff --git a/kilo/kilo/requests/views/subnet.py b/kilo/kilo/requests/views/subnet.py
index 3512a2f0..8dabafb1 100644
--- a/kilo/kilo/requests/views/subnet.py
+++ b/kilo/kilo/requests/views/subnet.py
@@ -14,7 +14,7 @@
import logging
import json
import traceback
-
+from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -50,6 +50,9 @@ class Subnets(APIView):
return Response(data=content, status=status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -134,6 +137,9 @@ class Subnets(APIView):
return Response(data=resp_body, status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -157,6 +163,9 @@ class Subnets(APIView):
return Response(status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
diff --git a/kilo/kilo/requests/views/tenants.py b/kilo/kilo/requests/views/tenants.py
index c8a7fff2..31b17a0b 100644
--- a/kilo/kilo/requests/views/tenants.py
+++ b/kilo/kilo/requests/views/tenants.py
@@ -14,7 +14,7 @@
import logging
import json
import traceback
-
+from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -70,6 +70,9 @@ class Tenants(APIView):
return Response(data=content, status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
diff --git a/kilo/kilo/requests/views/volume.py b/kilo/kilo/requests/views/volume.py
index 6682a4c4..41a8f852 100644
--- a/kilo/kilo/requests/views/volume.py
+++ b/kilo/kilo/requests/views/volume.py
@@ -14,7 +14,7 @@
import logging
import json
import traceback
-
+from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -50,6 +50,9 @@ class Volumes(APIView):
return Response(data=content, status=status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -136,6 +139,9 @@ class Volumes(APIView):
return Response(data=resp_body, status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -156,6 +162,9 @@ class Volumes(APIView):
return Response(status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
diff --git a/kilo/kilo/requests/views/vport.py b/kilo/kilo/requests/views/vport.py
index 987524dd..7fd6b900 100644
--- a/kilo/kilo/requests/views/vport.py
+++ b/kilo/kilo/requests/views/vport.py
@@ -14,7 +14,7 @@
import logging
import json
import traceback
-
+from keystoneauth1.exceptions import HttpError
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
@@ -50,6 +50,9 @@ class Vports(APIView):
return Response(data=content, status=status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -125,6 +128,9 @@ class Vports(APIView):
return self.create_port(request, vimid, tenantid)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},
@@ -189,6 +195,9 @@ class Vports(APIView):
return Response(status=resp.status_code)
except VimDriverKiloException as e:
return Response(data={'error': e.content}, status=e.status_code)
+ except HttpError as e:
+ logger.error("HttpError: status:%s, response:%s" % (e.http_status, e.response.json()))
+ return Response(data=e.response.json(), status=e.http_status)
except Exception as e:
logger.error(traceback.format_exc())
return Response(data={'error': str(e)},