summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vio/vio/pub/vim/drivers/vimsdk/compute.py13
-rw-r--r--vio/vio/pub/vim/vimapi/nova/OperateServers.py30
-rw-r--r--vio/vio/swagger/urls.py86
-rw-r--r--vio/vio/swagger/views/proxyplugin/dns/views.py34
-rw-r--r--vio/vio/swagger/views/proxyplugin/heat/views.py25
-rw-r--r--vio/vio/swagger/views/proxyplugin/identity/views.py64
-rw-r--r--vio/vio/swagger/views/proxyplugin/image/views.py34
-rw-r--r--vio/vio/swagger/views/proxyplugin/neutron/views.py34
-rw-r--r--vio/vio/swagger/views/proxyplugin/nova/views.py21
-rw-r--r--vio/vio/swagger/views/proxyplugin/volumn/views.py25
-rw-r--r--vio/vio/swagger/views/server/views.py46
11 files changed, 412 insertions, 0 deletions
diff --git a/vio/vio/pub/vim/drivers/vimsdk/compute.py b/vio/vio/pub/vim/drivers/vimsdk/compute.py
index 2326fff..e415573 100644
--- a/vio/vio/pub/vim/drivers/vimsdk/compute.py
+++ b/vio/vio/pub/vim/drivers/vimsdk/compute.py
@@ -77,6 +77,19 @@ class ComputeClient(base.DriverBase):
return list(ifaces)
@sdk.translate_exception
+ def start_server(self, server_id):
+ self.conn.compute.start_server(server=server_id)
+
+ @sdk.translate_exception
+ def stop_server(self, server_id):
+ self.conn.compute.stop_server(server=server_id)
+
+ @sdk.translate_exception
+ def reboot_server(self, server_id, reboot_type):
+ self.conn.compute.reboot_server(server=server_id,
+ reboot_type=reboot_type)
+
+ @sdk.translate_exception
def list_flavors(self, **query):
flavors = self.conn.compute.flavors(**query)
return flavors
diff --git a/vio/vio/pub/vim/vimapi/nova/OperateServers.py b/vio/vio/pub/vim/vimapi/nova/OperateServers.py
index 3075276..b14c7f4 100644
--- a/vio/vio/pub/vim/vimapi/nova/OperateServers.py
+++ b/vio/vio/pub/vim/vimapi/nova/OperateServers.py
@@ -162,3 +162,33 @@ class OperateServers(OperateNova):
'project_id': project_id}
project = self.compute(param).delete_server(server_id)
return project
+
+ def start_server(self, data, project_id, server_id):
+ param = {'username': data['username'],
+ 'user_domain_name': 'default',
+ 'project_domain_name': 'default',
+ 'password': data['password'],
+ 'auth_url': data['url'],
+ 'project_id': project_id}
+ project = self.compute(param).start_server(server_id)
+ return project
+
+ def stop_server(self, data, project_id, server_id):
+ param = {'username': data['username'],
+ 'user_domain_name': 'default',
+ 'project_domain_name': 'default',
+ 'password': data['password'],
+ 'auth_url': data['url'],
+ 'project_id': project_id}
+ project = self.compute(param).stop_server(server_id)
+ return project
+
+ def reboot_server(self, data, project_id, server_id, reboot_type):
+ param = {'username': data['username'],
+ 'user_domain_name': 'default',
+ 'project_domain_name': 'default',
+ 'password': data['password'],
+ 'auth_url': data['url'],
+ 'project_id': project_id}
+ project = self.compute(param).reboot_server(server_id, reboot_type)
+ return project
diff --git a/vio/vio/swagger/urls.py b/vio/vio/swagger/urls.py
index b7bdbcf..8456d71 100644
--- a/vio/vio/swagger/urls.py
+++ b/vio/vio/swagger/urls.py
@@ -25,6 +25,8 @@ from vio.swagger.views.image.views import GetImageFileView
from vio.swagger.views.volume.views import CreateListVolumeView
from vio.swagger.views.volume.views import GetDeleteVolumeView
from vio.swagger.views.server.views import ListServersView, GetServerView
+from vio.swagger.views.server.views import ServerActionView
+from vio.swagger.views.server.views import ServerActionViewV1
from vio.swagger.views.flavor.views import FlavorsView, FlavorView
from vio.swagger.views.network.views import CreateNetworkView
from vio.swagger.views.network.views import DeleteNetworkView
@@ -65,6 +67,21 @@ from vio.swagger.views.proxyplugin.heat.views import HeatServer
from vio.swagger.views.proxyplugin.dns.views import DesignateServer
from vio.swagger.views.proxyplugin.dns.views import DesignateVersionLink
+# proxy V1
+from vio.swagger.views.proxyplugin.identity.views import TokenViewV1
+from vio.swagger.views.proxyplugin.identity.views import TokenV2ViewV1
+from vio.swagger.views.proxyplugin.identity.views import IdentityServerV1
+from vio.swagger.views.proxyplugin.identity.views import IdentityVersionLinkV1
+from vio.swagger.views.proxyplugin.nova.views import ComputeServerV1
+from vio.swagger.views.proxyplugin.image.views import ImageServerV1
+from vio.swagger.views.proxyplugin.image.views import ImageVersionLinkV1
+from vio.swagger.views.proxyplugin.neutron.views import NetWorkServerV1
+from vio.swagger.views.proxyplugin.neutron.views import NetworkVersionLinkV1
+from vio.swagger.views.proxyplugin.volumn.views import VolumeServerV1
+from vio.swagger.views.proxyplugin.heat.views import HeatServerV1
+from vio.swagger.views.proxyplugin.dns.views import DesignateServerV1
+from vio.swagger.views.proxyplugin.dns.views import DesignateVersionLinkV1
+
# Registry
from vio.swagger.views.registry.views import Registry, RegistryV1
from vio.swagger.views.registry.views import UnRegistry, UnRegistryV1
@@ -134,6 +151,10 @@ urlpatterns = [
r'(?P<tenantid>[0-9a-zA-Z]+)/servers/(?P<serverid>[0-9a-zA-Z_-]+)$',
GetServerView.as_view()),
url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-zA-Z_-]+)/'
+ r'(?P<tenantid>[0-9a-zA-Z]+)/servers/'
+ r'(?P<serverid>[0-9a-zA-Z_-]+)/action$',
+ ServerActionView.as_view()),
+ url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-zA-Z_-]+)/'
r'(?P<tenantid>[0-9a-zA-Z]+)/flavors$',
FlavorsView.as_view()),
url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-zA-Z_-]+)/'
@@ -170,6 +191,7 @@ urlpatterns = [
r'(?P<portid>[0-9a-zA-Z\-\_]+)$',
DeletePortView.as_view()),
+
# V1 urls
url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
r'(?P<cloud_region>[0-9a-zA-Z_-]+)/tenants$',
@@ -208,6 +230,10 @@ urlpatterns = [
GetServerViewV1.as_view()),
url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/'
+ r'servers/(?P<serverid>[0-9a-zA-Z_-]+)/action$',
+ ServerActionViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/(?P<tenantid>[0-9a-zA-Z]+)/'
r'flavors$',
FlavorsViewV1.as_view()),
url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
@@ -420,6 +446,66 @@ urlpatterns = [
r'designate/(?P<other>(.*))$',
DesignateServer.as_view()),
+ # proxy V1
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/identity/v3',
+ TokenViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/identity/v2.0$',
+ TokenV2ViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/identity/v2.0/tokens$',
+ TokenV2ViewV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/identity$',
+ IdentityVersionLinkV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/identity/(?P<other>(.*))$',
+ IdentityServerV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/glance$',
+ ImageVersionLinkV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/glance/(?P<other>(.*))$',
+ ImageServerV1.as_view()),
+ url(
+ r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/'
+ r'cinder/(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$',
+ VolumeServerV1.as_view()),
+ url(
+ r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/'
+ r'cinderv2/(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$',
+ VolumeServerV1.as_view()),
+ url(
+ r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/cinderv3/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$',
+ VolumeServerV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/neutron$',
+ NetworkVersionLinkV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/neutron/(?P<other>(.*))$',
+ NetWorkServerV1.as_view()),
+ url(
+ r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/heat/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$',
+ HeatServerV1.as_view()),
+ url(
+ r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/nova/'
+ r'(?P<tenantid>[0-9a-z-A-Z\-\_]+)/(?P<other>(.*))$',
+ ComputeServerV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/designate$',
+ DesignateVersionLinkV1.as_view()),
+ url(r'^api/multicloud-vio/v1/(?P<cloud_owner>[0-9a-zA-Z_-]+)/'
+ r'(?P<cloud_region>[0-9a-zA-Z_-]+)/designate/(?P<other>(.*))$',
+ DesignateServerV1.as_view()),
+
# Extensions
url(r'^api/multicloud-vio/v0/(?P<vimid>[0-9a-z-A-Z\-\_]+)'
r'/extensions$',
diff --git a/vio/vio/swagger/views/proxyplugin/dns/views.py b/vio/vio/swagger/views/proxyplugin/dns/views.py
index 6b4819d..5878481 100644
--- a/vio/vio/swagger/views/proxyplugin/dns/views.py
+++ b/vio/vio/swagger/views/proxyplugin/dns/views.py
@@ -55,6 +55,15 @@ class DesignateVersionLink(BaseClient):
return Response(data=res, status=status.HTTP_200_OK)
+class DesignateVersionLinkV1(DesignateVersionLink):
+
+ serverType = 'designate'
+
+ def get(self, request, cloud_owner, cloud_region):
+ return super(DesignateVersionLinkV1, self).get(
+ request, cloud_owner + "_" + cloud_region)
+
+
class DesignateServer(BaseClient):
serverType = "designate"
@@ -85,3 +94,28 @@ class DesignateServer(BaseClient):
return self.send(request=request, method="DELETE",
vimid=vimid, other=other)
+
+
+class DesignateServerV1(DesignateServer):
+
+ serverType = 'designate'
+
+ def get(self, request, cloud_owner, cloud_region, other=None):
+ return super(DesignateServerV1, self).get(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def post(self, request, cloud_owner, cloud_region, other):
+ return super(DesignateServerV1, self).post(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def patch(self, request, cloud_owner, cloud_region, other):
+ return super(DesignateServerV1, self).patch(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def put(self, request, cloud_owner, cloud_region, other):
+ return super(DesignateServerV1, self).put(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def delete(self, request, cloud_owner, cloud_region, other):
+ return super(DesignateServerV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, other)
diff --git a/vio/vio/swagger/views/proxyplugin/heat/views.py b/vio/vio/swagger/views/proxyplugin/heat/views.py
index 5e0de68..4c56f18 100644
--- a/vio/vio/swagger/views/proxyplugin/heat/views.py
+++ b/vio/vio/swagger/views/proxyplugin/heat/views.py
@@ -43,3 +43,28 @@ class HeatServer(BaseClient):
return self.send(request=request, method="PATCH",
vimid=vimid, tenantid=tenantid, other=other)
+
+
+class HeatServerV1(HeatServer):
+
+ serverType = 'heat'
+
+ def get(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(HeatServerV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def post(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(HeatServerV1, self).post(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def patch(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(HeatServerV1, self).patch(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def put(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(HeatServerV1, self).put(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def delete(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(HeatServerV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
diff --git a/vio/vio/swagger/views/proxyplugin/identity/views.py b/vio/vio/swagger/views/proxyplugin/identity/views.py
index c6db117..6ff8b2a 100644
--- a/vio/vio/swagger/views/proxyplugin/identity/views.py
+++ b/vio/vio/swagger/views/proxyplugin/identity/views.py
@@ -64,6 +64,15 @@ class IdentityVersionLink(BaseClient):
return Response(data=res, status=status.HTTP_200_OK)
+class IdentityVersionLinkV1(IdentityVersionLink):
+
+ serverType = 'keystone'
+
+ def get(self, request, cloud_owner, cloud_region):
+ return super(IdentityVersionLinkV1, self).get(
+ request, cloud_owner + "_" + cloud_region)
+
+
class IdentityServer(BaseClient):
serverType = 'keystone'
@@ -96,6 +105,31 @@ class IdentityServer(BaseClient):
vimid=vimid, other=other)
+class IdentityServerV1(IdentityServer):
+
+ serverType = 'keystone'
+
+ def get(self, request, cloud_owner, cloud_region, other=None):
+ return super(IdentityServerV1, self).get(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def post(self, request, cloud_owner, cloud_region, other):
+ return super(IdentityServerV1, self).post(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def patch(self, request, cloud_owner, cloud_region, other):
+ return super(IdentityServerV1, self).patch(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def put(self, request, cloud_owner, cloud_region, other):
+ return super(IdentityServerV1, self).put(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def head(self, request, cloud_owner, cloud_region, other):
+ return super(IdentityServerV1, self).head(
+ request, cloud_owner + "_" + cloud_region, other)
+
+
class TokenView(BaseClient):
serverType = 'identity'
@@ -238,6 +272,23 @@ class TokenView(BaseClient):
return Res
+class TokenViewV1(TokenView):
+
+ serverType = 'identity'
+
+ def get(self, request, cloud_owner, cloud_region):
+ return super(TokenViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region)
+
+ def post(self, request, cloud_owner, cloud_region):
+ return super(TokenViewV1, self).post(
+ request, cloud_owner + "_" + cloud_region)
+
+ def delete(self, request, cloud_owner, cloud_region):
+ return super(TokenViewV1, self).delete(
+ request, cloud_owner + "_" + cloud_region)
+
+
class TokenV2View(BaseClient):
serverType = "identity"
@@ -294,6 +345,19 @@ class TokenV2View(BaseClient):
create_req=create_req)
+class TokenV2ViewV1(TokenV2View):
+
+ serverType = 'identity'
+
+ def get(self, request, cloud_owner, cloud_region):
+ return super(TokenV2ViewV1, self).get(
+ request, cloud_owner + "_" + cloud_region)
+
+ def post(self, request, cloud_owner, cloud_region):
+ return super(TokenV2ViewV1, self).post(
+ request, cloud_owner + "_" + cloud_region)
+
+
def _keystoneV2Token(url, vimid=None, create_req=None):
try:
diff --git a/vio/vio/swagger/views/proxyplugin/image/views.py b/vio/vio/swagger/views/proxyplugin/image/views.py
index 0156131..e183152 100644
--- a/vio/vio/swagger/views/proxyplugin/image/views.py
+++ b/vio/vio/swagger/views/proxyplugin/image/views.py
@@ -53,6 +53,15 @@ class ImageVersionLink(BaseClient):
return Response(data=res, status=status.HTTP_300_MULTIPLE_CHOICES)
+class ImageVersionLinkV1(ImageVersionLink):
+
+ serverType = 'glance'
+
+ def get(self, request, cloud_owner, cloud_region):
+ return super(ImageVersionLinkV1, self).get(
+ request, cloud_owner + "_" + cloud_region)
+
+
class ImageServer(BaseClient):
serverType = "glance"
@@ -83,3 +92,28 @@ class ImageServer(BaseClient):
return self.send(request=request, method="DELETE",
vimid=vimid, other=other)
+
+
+class ImageServerV1(ImageServer):
+
+ serverType = 'glance'
+
+ def get(self, request, cloud_owner, cloud_region, other=None):
+ return super(ImageServerV1, self).get(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def post(self, request, cloud_owner, cloud_region, other):
+ return super(ImageServerV1, self).post(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def patch(self, request, cloud_owner, cloud_region, other):
+ return super(ImageServerV1, self).patch(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def put(self, request, cloud_owner, cloud_region, other):
+ return super(ImageServerV1, self).put(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def delete(self, request, cloud_owner, cloud_region, other):
+ return super(ImageServerV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, other)
diff --git a/vio/vio/swagger/views/proxyplugin/neutron/views.py b/vio/vio/swagger/views/proxyplugin/neutron/views.py
index d6b23e6..47590ed 100644
--- a/vio/vio/swagger/views/proxyplugin/neutron/views.py
+++ b/vio/vio/swagger/views/proxyplugin/neutron/views.py
@@ -53,6 +53,15 @@ class NetworkVersionLink(BaseClient):
return Response(data=res, status=status.HTTP_200_OK)
+class NetworkVersionLinkV1(NetworkVersionLink):
+
+ serverType = 'neutron'
+
+ def get(self, request, cloud_owner, cloud_region):
+ return super(NetworkVersionLinkV1, self).get(
+ request, cloud_owner + "_" + cloud_region)
+
+
class NetWorkServer(BaseClient):
serverType = "neutron"
@@ -83,3 +92,28 @@ class NetWorkServer(BaseClient):
return self.send(request=request, method="DELETE",
vimid=vimid, other=other)
+
+
+class NetWorkServerV1(NetWorkServer):
+
+ serverType = 'neutron'
+
+ def get(self, request, cloud_owner, cloud_region, other=None):
+ return super(NetWorkServerV1, self).get(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def post(self, request, cloud_owner, cloud_region, other):
+ return super(NetWorkServerV1, self).post(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def patch(self, request, cloud_owner, cloud_region, other):
+ return super(NetWorkServerV1, self).patch(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def put(self, request, cloud_owner, cloud_region, other):
+ return super(NetWorkServerV1, self).put(
+ request, cloud_owner + "_" + cloud_region, other)
+
+ def delete(self, request, cloud_owner, cloud_region, other):
+ return super(NetWorkServerV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, other)
diff --git a/vio/vio/swagger/views/proxyplugin/nova/views.py b/vio/vio/swagger/views/proxyplugin/nova/views.py
index c61ec37..3527b88 100644
--- a/vio/vio/swagger/views/proxyplugin/nova/views.py
+++ b/vio/vio/swagger/views/proxyplugin/nova/views.py
@@ -38,3 +38,24 @@ class ComputeServer(BaseClient):
return self.send(request=request, method="DELETE", vimid=vimid,
tenantid=tenantid, other=other)
+
+
+class ComputeServerV1(ComputeServer):
+
+ serverType = 'nova'
+
+ def get(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(ComputeServerV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def post(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(ComputeServerV1, self).post(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def put(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(ComputeServerV1, self).put(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def delete(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(ComputeServerV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
diff --git a/vio/vio/swagger/views/proxyplugin/volumn/views.py b/vio/vio/swagger/views/proxyplugin/volumn/views.py
index 3b3013c..01902e1 100644
--- a/vio/vio/swagger/views/proxyplugin/volumn/views.py
+++ b/vio/vio/swagger/views/proxyplugin/volumn/views.py
@@ -45,6 +45,31 @@ class VolumeServer(BaseClient):
tenantid=tenantid, other=other)
+class VolumeServerV1(VolumeServer):
+
+ serverType = 'cinder'
+
+ def get(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(VolumeServerV1, self).get(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def post(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(VolumeServerV1, self).post(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def patch(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(VolumeServerV1, self).patch(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def put(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(VolumeServerV1, self).put(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+ def delete(self, request, cloud_owner, cloud_region, tenantid, other):
+ return super(VolumeServerV1, self).delete(
+ request, cloud_owner + "_" + cloud_region, tenantid, other)
+
+
class VolumeServer2(VolumeServer):
serverType = "cinderv2"
diff --git a/vio/vio/swagger/views/server/views.py b/vio/vio/swagger/views/server/views.py
index 8172f7f..eb8acf0 100644
--- a/vio/vio/swagger/views/server/views.py
+++ b/vio/vio/swagger/views/server/views.py
@@ -189,3 +189,49 @@ class GetServerViewV1(GetServerView):
def delete(self, request, cloud_owner, cloud_region, tenantid, serverid):
return super(GetServerViewV1, self).delete(
request, cloud_owner + "_" + cloud_region, tenantid, serverid)
+
+
+class ServerActionView(APIView):
+
+ def post(self, request, vimid, tenantid, serverid):
+ try:
+ action_req = json.loads(request.body)
+ except Exception as e:
+ return Response(data={'error': 'Fail to decode request body.'},
+ status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+
+ try:
+ vim_info = extsys.get_vim_by_id(vimid)
+ except VimDriverVioException as e:
+ return Response(data={'error': str(e)}, status=e.status_code)
+ data = {'vimid': vim_info['vimId'],
+ 'vimName': vim_info['name'],
+ 'username': vim_info['userName'],
+ 'password': vim_info['password'],
+ 'url': vim_info['url']}
+
+ server_op = OperateServers.OperateServers()
+ try:
+ if 'os-start' in action_req:
+ server_op.start_server(data, tenantid, serverid)
+ elif 'os-stop' in action_req:
+ server_op.stop_server(data, tenantid, serverid)
+ elif 'reboot' in action_req:
+ reboot_type = action_req.get('reboot').get('type')
+ server_op.reboot_server(data, tenantid, serverid, reboot_type)
+ else:
+ return Response(data={'error': 'invalid request body.'},
+ status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ except Exception as e:
+ if hasattr(e, "http_status"):
+ return Response(data={'error': str(e)}, status=e.http_status)
+ else:
+ return Response(data={'error': str(e)},
+ status=status.HTTP_500_INTERNAL_SERVER_ERROR)
+ return Response(status=status.HTTP_202_ACCEPTED)
+
+
+class ServerActionViewV1(ServerActionView):
+ def post(self, request, cloud_owner, cloud_region, tenantid, serverid):
+ return super(ServerActionViewV1, self).post(
+ request, cloud_owner + "_" + cloud_region, tenantid, serverid)