Add server action for windriver APIv1 52/73352/3
authorHaibin Huang <haibin.huang@intel.com>
Thu, 22 Nov 2018 08:40:06 +0000 (08:40 +0000)
committerHaibin Huang <haibin.huang@intel.com>
Thu, 22 Nov 2018 11:27:54 +0000 (11:27 +0000)
Change-Id: Iebab7cdf4b9e9190a32e3ce05aaca6fbb4901b76
Issue-ID: MULTICLOUD-414
Signed-off-by: Haibin Huang <haibin.huang@intel.com>
share/newton_base/openoapi/server.py
windriver/titanium_cloud/requests/urlsV1.py

index c4ef3f1..0c2382a 100644 (file)
@@ -567,3 +567,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_-]+))?',