Add server action for windriver APIv1 45/73645/2
authorHaibin Huang <haibin.huang@intel.com>
Thu, 22 Nov 2018 08:40:06 +0000 (08:40 +0000)
committerHuang Haibin <haibin.huang@intel.com>
Tue, 27 Nov 2018 10:50:34 +0000 (10:50 +0000)
Change-Id: Iebab7cdf4b9e9190a32e3ce05aaca6fbb4901b76
Issue-ID: MULTICLOUD-414
Signed-off-by: Haibin Huang <haibin.huang@intel.com>
(cherry picked from commit e6815a7940c20c14ca670e5393b296d3b3dce888)

share/newton_base/openoapi/server.py
windriver/titanium_cloud/requests/urlsV1.py

index 57f7619..5796f4f 100644 (file)
@@ -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)
index f155244..6e884ab 100644 (file)
@@ -34,6 +34,8 @@ urlpatterns = [
         image.APIv1Images.as_view()),
     url(r'^volumes(/(?P<volumeid>[0-9a-zA-Z_-]+))?',
         volume.APIv1Volumes.as_view()),
+    url(r'^servers(/(?P<serverid>[0-9a-zA-Z_-]+))/action/?$',
+        server.APIv1ServerAction.as_view()),
     url(r'^servers(/(?P<serverid>[0-9a-zA-Z_-]+))?',
         server.APIv1Servers.as_view()),
     url(r'^ports(/(?P<portid>[0-9a-zA-Z_-]+))?',