From 0e7bdfd96bca38494ed86053812b9dabd53b2a80 Mon Sep 17 00:00:00 2001 From: Haibin Huang Date: Thu, 22 Nov 2018 08:40:06 +0000 Subject: Add server action for windriver APIv1 Change-Id: Iebab7cdf4b9e9190a32e3ce05aaca6fbb4901b76 Issue-ID: MULTICLOUD-414 Signed-off-by: Haibin Huang (cherry picked from commit e6815a7940c20c14ca670e5393b296d3b3dce888) --- share/newton_base/openoapi/server.py | 7 +++++++ windriver/titanium_cloud/requests/urlsV1.py | 2 ++ 2 files changed, 9 insertions(+) diff --git a/share/newton_base/openoapi/server.py b/share/newton_base/openoapi/server.py index 57f76196..5796f4f3 100644 --- a/share/newton_base/openoapi/server.py +++ b/share/newton_base/openoapi/server.py @@ -558,3 +558,10 @@ class ServerAction(APIView): logger.error(traceback.format_exc()) return Response(data={'error': str(e)}, status=status.HTTP_500_INTERNAL_SERVER_ERROR) + +class APIv1ServerAction(ServerAction): + def post(self, request, cloud_owner="", cloud_region_id="", tenantid="", serverid=""): + self._logger.info("%s, %s" % (cloud_owner, cloud_region_id)) + + vimid = extsys.encode_vim_id(cloud_owner, cloud_region_id) + return super(APIv1ServerAction, self).post(request, vimid, tenantid, serverid) diff --git a/windriver/titanium_cloud/requests/urlsV1.py b/windriver/titanium_cloud/requests/urlsV1.py index f1552443..6e884ab1 100644 --- a/windriver/titanium_cloud/requests/urlsV1.py +++ b/windriver/titanium_cloud/requests/urlsV1.py @@ -34,6 +34,8 @@ urlpatterns = [ image.APIv1Images.as_view()), url(r'^volumes(/(?P[0-9a-zA-Z_-]+))?', volume.APIv1Volumes.as_view()), + url(r'^servers(/(?P[0-9a-zA-Z_-]+))/action/?$', + server.APIv1ServerAction.as_view()), url(r'^servers(/(?P[0-9a-zA-Z_-]+))?', server.APIv1Servers.as_view()), url(r'^ports(/(?P[0-9a-zA-Z_-]+))?', -- cgit 1.2.3-korg