Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
RECIRCLE
/
portal
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
11
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
daea0676
authored
Jul 11, 2019
by
Chif Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify instance create view, add flavor list view
parent
15057b46
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
58 deletions
+123
-58
Pipfile.lock
+85
-52
recircle/instance/serializers.py
+11
-4
recircle/instance/urls.py
+1
-0
recircle/instance/views.py
+26
-2
No files found.
Pipfile.lock
View file @
daea0676
{
{
"_meta": {
"_meta": {
"hash": {
"hash": {
"sha256": "
5769a934a63e72f37fee8bb424742092d70539e55c61de9d2071a7281ebd9081
"
"sha256": "
2adbcb2f6437576c7ac5794c996bf94a73714555a6ccc0e393fcb24bf184c1da
"
},
},
"pipfile-spec": 6,
"pipfile-spec": 6,
"requires": {
"requires": {
...
@@ -39,10 +39,10 @@
...
@@ -39,10 +39,10 @@
},
},
"certifi": {
"certifi": {
"hashes": [
"hashes": [
"sha256:
59b7658e26ca9c7339e00f8f4636cdfe59d34fa37b9b04f6f9e9926b3cece1a5
",
"sha256:
046832c04d4e752f37383b628bc601a7ea7211496b4638f6514d0e5b9acc4939
",
"sha256:
b26104d6835d1f5e49452a26eb2ff87fe7090b89dfcaee5ea2212697e1e1d7ae
"
"sha256:
945e3ba63a0b9f577b1395204e13c3a231f9bc0223888be653286534e5873695
"
],
],
"version": "==2019.
3.9
"
"version": "==2019.
6.16
"
},
},
"cffi": {
"cffi": {
"hashes": [
"hashes": [
...
@@ -86,27 +86,24 @@
...
@@ -86,27 +86,24 @@
},
},
"cryptography": {
"cryptography": {
"hashes": [
"hashes": [
"sha256:066f815f1fe46020877c5983a7e747ae140f517f1b09030ec098503575265ce1",
"sha256:24b61e5fcb506424d3ec4e18bca995833839bf13c59fc43e530e488f28d46b8c",
"sha256:210210d9df0afba9e000636e97810117dc55b7157c903a55716bb73e3ae07705",
"sha256:25dd1581a183e9e7a806fe0543f485103232f940fcfc301db65e630512cce643",
"sha256:26c821cbeb683facb966045e2064303029d572a87ee69ca5a1bf54bf55f93ca6",
"sha256:3452bba7c21c69f2df772762be0066c7ed5dc65df494a1d53a58b683a83e1216",
"sha256:2afb83308dc5c5255149ff7d3fb9964f7c9ee3d59b603ec18ccf5b0a8852e2b1",
"sha256:41a0be220dd1ed9e998f5891948306eb8c812b512dc398e5a01846d855050799",
"sha256:2db34e5c45988f36f7a08a7ab2b69638994a8923853dec2d4af121f689c66dc8",
"sha256:5751d8a11b956fbfa314f6553d186b94aa70fdb03d8a4d4f1c82dcacf0cbe28a",
"sha256:409c4653e0f719fa78febcb71ac417076ae5e20160aec7270c91d009837b9151",
"sha256:5f61c7d749048fa6e3322258b4263463bfccefecb0dd731b6561cb617a1d9bb9",
"sha256:45a4f4cf4f4e6a55c8128f8b76b4c057027b27d4c67e3fe157fa02f27e37830d",
"sha256:72e24c521fa2106f19623a3851e9f89ddfdeb9ac63871c7643790f872a305dfc",
"sha256:48eab46ef38faf1031e58dfcc9c3e71756a1108f4c9c966150b605d4a1a7f659",
"sha256:7b97ae6ef5cba2e3bb14256625423413d5ce8d1abb91d4f29b6d1a081da765f8",
"sha256:6b9e0ae298ab20d371fc26e2129fd683cfc0cfde4d157c6341722de645146537",
"sha256:961e886d8a3590fd2c723cf07be14e2a91cf53c25f02435c04d39e90780e3b53",
"sha256:6c4778afe50f413707f604828c1ad1ff81fadf6c110cb669579dea7e2e98a75e",
"sha256:96d8473848e984184b6728e2c9d391482008646276c3ff084a1bd89e15ff53a1",
"sha256:8c33fb99025d353c9520141f8bc989c2134a1f76bac6369cea060812f5b5c2bb",
"sha256:ae536da50c7ad1e002c3eee101871d93abdc90d9c5f651818450a0d3af718609",
"sha256:9873a1760a274b620a135054b756f9f218fa61ca030e42df31b409f0fb738b6c",
"sha256:b0db0cecf396033abb4a93c95d1602f268b3a68bb0a9cc06a7cff587bb9a7292",
"sha256:9b069768c627f3f5623b1cbd3248c5e7e92aec62f4c98827059eed7053138cc9",
"sha256:cfee9164954c186b191b91d4193989ca994703b2fff406f71cf454a2d3c7327e",
"sha256:9e4ce27a507e4886efbd3c32d120db5089b906979a4debf1d5939ec01b9dd6c5",
"sha256:e6347742ac8f35ded4a46ff835c60e68c22a536a8ae5c4422966d06946b6d4c6",
"sha256:acb424eaca214cb08735f1a744eceb97d014de6530c1ea23beb86d9c6f13c2ad",
"sha256:f27d93f0139a3c056172ebb5d4f9056e770fdf0206c2f422ff2ebbad142e09ed",
"sha256:c8181c7d77388fe26ab8418bb088b1a1ef5fde058c6926790c8a0a3d94075a4a",
"sha256:f57b76e46a58b63d1c6375017f4564a28f19a5ca912691fd2e4261b3414b618d"
"sha256:d4afbb0840f489b60f5a580a41a1b9c3622e08ecb5eec8614d4fb4cd914c4460",
],
"sha256:d9ed28030797c00f4bc43c86bf819266c76a5ea61d006cd4078a93ebf7da6bfd",
"version": "==2.7"
"sha256:e603aa7bb52e4e8ed4119a58a03b60323918467ef209e6ff9db3ac382e5cf2c6"
],
"version": "==2.6.1"
},
},
"debtcollector": {
"debtcollector": {
"hashes": [
"hashes": [
...
@@ -124,11 +121,11 @@
...
@@ -124,11 +121,11 @@
},
},
"django": {
"django": {
"hashes": [
"hashes": [
"sha256:
6fcc3cbd55b16f9a01f37de8bcbe286e0ea22e87096557f1511051780338ea
ea",
"sha256:
4d23f61b26892bac785f07401bc38cbf8fa4cec993f400e9cd9ddf28fd51c0
ea",
"sha256:
bb407d0bb46395ca1241f829f5bd03f7e482f97f7d1936e26e98dacb201ed4e
c"
"sha256:
6e974d4b57e3b29e4882b244d40171d6a75202ab8d2402b8e8adbd182e25cf0
c"
],
],
"index": "pypi",
"index": "pypi",
"version": "==2.2.
1
"
"version": "==2.2.
3
"
},
},
"django-cors-headers": {
"django-cors-headers": {
"hashes": [
"hashes": [
...
@@ -275,11 +272,11 @@
...
@@ -275,11 +272,11 @@
},
},
"openstacksdk": {
"openstacksdk": {
"hashes": [
"hashes": [
"sha256:
57e7b3c613b08ea1f0c3d2b70c3ba1a11de4cda5e6df3e6e955d26a3858867d6
",
"sha256:
44a726ff8969072f766e178becff2d3933a8ea084e4cc2516c56b8ade80e4af9
",
"sha256:
a6e8916646900b12a5702a75c565d348be64e343fc51176b66f58770ff40cd5b
"
"sha256:
8d0607d08ac1d206040730dbbac5bb1a535e855616b11ad303847c5061f1f5ee
"
],
],
"index": "pypi",
"index": "pypi",
"version": "==0.
28.0
"
"version": "==0.
31.1
"
},
},
"os-service-types": {
"os-service-types": {
"hashes": [
"hashes": [
...
@@ -311,10 +308,10 @@
...
@@ -311,10 +308,10 @@
},
},
"pbr": {
"pbr": {
"hashes": [
"hashes": [
"sha256:
0ce920b865091450bbcd452b35cf6d6eb8a6d9ce13ad2210d6e77557f85cf32b
",
"sha256:
36ebd78196e8c9588c972f5571230a059ff83783fabbbbedecc07be263ccd7e6
",
"sha256:
93d2dc6ee0c9af4dbc70bc1251d0e545a9910ca8863774761f92716dece400b6
"
"sha256:
5a03f59455ad54f01a94c15829b8b70065462b7bd8d5d7e983306b59127fc841
"
],
],
"version": "==5.
2.1
"
"version": "==5.
4.0
"
},
},
"prettytable": {
"prettytable": {
"hashes": [
"hashes": [
...
@@ -354,19 +351,19 @@
...
@@ -354,19 +351,19 @@
},
},
"pyyaml": {
"pyyaml": {
"hashes": [
"hashes": [
"sha256:
1adecc22f88d38052fb787d959f003811ca858b799590a5eaa70e63dca50308c
",
"sha256:
57acc1d8533cbe51f6662a55434f0dbecfa2b9eaf115bede8f6fd00115a0c0d3
",
"sha256:
436bc774ecf7c103814098159fbb84c2715d25980175292c648f2da143909f95
",
"sha256:
588c94b3d16b76cfed8e0be54932e5729cc185caffaa5a451e7ad2f7ed8b4043
",
"sha256:
460a5a4248763f6f37ea225d19d5c205677d8d525f6a83357ca622ed541830c2
",
"sha256:
68c8dd247f29f9a0d09375c9c6b8fdc64b60810ebf07ba4cdd64ceee3a58c7b7
",
"sha256:
5a22a9c84653debfbf198d02fe592c176ea548cccce47553f35f466e15cf2fd4
",
"sha256:
70d9818f1c9cd5c48bb87804f2efc8692f1023dac7f1a1a5c61d454043c1d265
",
"sha256:
7a5d3f26b89d688db27822343dfa25c599627bc92093e788956372285c6298ad
",
"sha256:
86a93cccd50f8c125286e637328ff4eef108400dd7089b46a7be3445eecfa391
",
"sha256:
9372b04a02080752d9e6f990179a4ab840227c6e2ce15b95e1278456664cf2ba
",
"sha256:
a0f329125a926876f647c9fa0ef32801587a12328b4a3c741270464e3e4fa778
",
"sha256:a
5dcbebee834eaddf3fa7366316b880ff4062e4bcc9787b78c7fbb4a26ff2dd1
",
"sha256:a
3c252ab0fa1bb0d5a3f6449a4826732f3eb6c0270925548cac342bc9b22c225
",
"sha256:
aee5bab92a176e7cd034e57f46e9df9a9862a71f8f37cad167c6fc74c65f5b4e
",
"sha256:
b4bb4d3f5e232425e25dda21c070ce05168a786ac9eda43768ab7f3ac2770955
",
"sha256:c
51f642898c0bacd335fc119da60baae0824f2cde95b0330b56c0553439f0673
",
"sha256:c
d0618c5ba5bda5f4039b9398bb7fb6a317bb8298218c3de25c47c4740e4b95e
",
"sha256:c
68ea4d3ba1705da1e0d85da6684ac657912679a649e8868bd850d2c299cce13
",
"sha256:c
eacb9e5f8474dcf45b940578591c7f3d960e82f926c707788a570b51ba59190
",
"sha256:
e23d0cc5299223dcc37885dae624f382297717e459ea24053709675a976a3e19
"
"sha256:
fe6a88094b64132c4bb3b631412e90032e8cfe9745a58370462240b8cb7553cd
"
],
],
"version": "==5.1"
"version": "==5.1
.1
"
},
},
"requests": {
"requests": {
"hashes": [
"hashes": [
...
@@ -429,19 +426,18 @@
...
@@ -429,19 +426,18 @@
},
},
"wrapt": {
"wrapt": {
"hashes": [
"hashes": [
"sha256:1d7ac9b39b8c13180c1475efb315852864076113537112150c1cf523609087fa",
"sha256:565a021fd19419476b9362b05eeaa094178de64f8361e44468f9e9d7843901e1"
"sha256:4aea003270831cceb8a90ff27c4031da6ead7ec1886023b80ce0dfe0adf61533"
],
],
"version": "==1.11.
1
"
"version": "==1.11.
2
"
}
}
},
},
"develop": {
"develop": {
"certifi": {
"certifi": {
"hashes": [
"hashes": [
"sha256:
59b7658e26ca9c7339e00f8f4636cdfe59d34fa37b9b04f6f9e9926b3cece1a5
",
"sha256:
046832c04d4e752f37383b628bc601a7ea7211496b4638f6514d0e5b9acc4939
",
"sha256:
b26104d6835d1f5e49452a26eb2ff87fe7090b89dfcaee5ea2212697e1e1d7ae
"
"sha256:
945e3ba63a0b9f577b1395204e13c3a231f9bc0223888be653286534e5873695
"
],
],
"version": "==2019.
3.9
"
"version": "==2019.
6.16
"
},
},
"chardet": {
"chardet": {
"hashes": [
"hashes": [
...
@@ -464,6 +460,43 @@
...
@@ -464,6 +460,43 @@
],
],
"version": "==0.0.4"
"version": "==0.0.4"
},
},
"coverage": {
"hashes": [
"sha256:3684fabf6b87a369017756b551cef29e505cb155ddb892a7a29277b978da88b9",
"sha256:39e088da9b284f1bd17c750ac672103779f7954ce6125fd4382134ac8d152d74",
"sha256:3c205bc11cc4fcc57b761c2da73b9b72a59f8d5ca89979afb0c1c6f9e53c7390",
"sha256:465ce53a8c0f3a7950dfb836438442f833cf6663d407f37d8c52fe7b6e56d7e8",
"sha256:48020e343fc40f72a442c8a1334284620f81295256a6b6ca6d8aa1350c763bbe",
"sha256:5296fc86ab612ec12394565c500b412a43b328b3907c0d14358950d06fd83baf",
"sha256:5f61bed2f7d9b6a9ab935150a6b23d7f84b8055524e7be7715b6513f3328138e",
"sha256:68a43a9f9f83693ce0414d17e019daee7ab3f7113a70c79a3dd4c2f704e4d741",
"sha256:6b8033d47fe22506856fe450470ccb1d8ba1ffb8463494a15cfc96392a288c09",
"sha256:7ad7536066b28863e5835e8cfeaa794b7fe352d99a8cded9f43d1161be8e9fbd",
"sha256:7bacb89ccf4bedb30b277e96e4cc68cd1369ca6841bde7b005191b54d3dd1034",
"sha256:839dc7c36501254e14331bcb98b27002aa415e4af7ea039d9009409b9d2d5420",
"sha256:8f9a95b66969cdea53ec992ecea5406c5bd99c9221f539bca1e8406b200ae98c",
"sha256:932c03d2d565f75961ba1d3cec41ddde00e162c5b46d03f7423edcb807734eab",
"sha256:988529edadc49039d205e0aa6ce049c5ccda4acb2d6c3c5c550c17e8c02c05ba",
"sha256:998d7e73548fe395eeb294495a04d38942edb66d1fa61eb70418871bc621227e",
"sha256:9de60893fb447d1e797f6bf08fdf0dbcda0c1e34c1b06c92bd3a363c0ea8c609",
"sha256:9e80d45d0c7fcee54e22771db7f1b0b126fb4a6c0a2e5afa72f66827207ff2f2",
"sha256:a545a3dfe5082dc8e8c3eb7f8a2cf4f2870902ff1860bd99b6198cfd1f9d1f49",
"sha256:a5d8f29e5ec661143621a8f4de51adfb300d7a476224156a39a392254f70687b",
"sha256:aca06bfba4759bbdb09bf52ebb15ae20268ee1f6747417837926fae990ebc41d",
"sha256:bb23b7a6fd666e551a3094ab896a57809e010059540ad20acbeec03a154224ce",
"sha256:bfd1d0ae7e292105f29d7deaa9d8f2916ed8553ab9d5f39ec65bcf5deadff3f9",
"sha256:c62ca0a38958f541a73cf86acdab020c2091631c137bd359c4f5bddde7b75fd4",
"sha256:c709d8bda72cf4cd348ccec2a4881f2c5848fd72903c185f363d361b2737f773",
"sha256:c968a6aa7e0b56ecbd28531ddf439c2ec103610d3e2bf3b75b813304f8cb7723",
"sha256:df785d8cb80539d0b55fd47183264b7002077859028dfe3070cf6359bf8b2d9c",
"sha256:f406628ca51e0ae90ae76ea8398677a921b36f0bd71aab2099dfed08abd0322f",
"sha256:f46087bbd95ebae244a0eda01a618aff11ec7a069b15a3ef8f6b520db523dcf1",
"sha256:f8019c5279eb32360ca03e9fac40a12667715546eed5c5eb59eb381f2f501260",
"sha256:fc5f4d209733750afd2714e9109816a29500718b32dd9a5db01c0cb3a019b96a"
],
"index": "pypi",
"version": "==4.5.3"
},
"django-rest-swagger": {
"django-rest-swagger": {
"hashes": [
"hashes": [
"sha256:48f6aded9937e90ae7cbe9e6c932b9744b8af80cc4e010088b3278c700e0685b",
"sha256:48f6aded9937e90ae7cbe9e6c932b9744b8af80cc4e010088b3278c700e0685b",
...
...
recircle/instance/serializers.py
View file @
daea0676
from
rest_framework
import
serializers
from
rest_framework
import
serializers
from
.models
import
Flavor
from
.models
import
Instance
class
InstanceSerializer
(
serializers
.
Serializer
):
name
=
serializers
.
CharField
()
description
=
serializers
.
CharField
()
system
=
serializers
.
CharField
()
lease
=
serializers
.
RelatedField
(
read_only
=
True
)
flavor
=
serializers
.
RelatedField
(
read_only
=
True
)
class
InstanceSerializer
(
serializers
.
ModelSerializer
):
class
FlavorSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
class
Meta
:
model
=
Instance
model
=
Flavor
fields
=
"__all__"
fields
=
'__all__'
recircle/instance/urls.py
View file @
daea0676
...
@@ -6,6 +6,7 @@ urlpatterns = [
...
@@ -6,6 +6,7 @@ urlpatterns = [
path
(
"instances/"
,
views
.
InstanceList
.
as_view
()),
path
(
"instances/"
,
views
.
InstanceList
.
as_view
()),
path
(
"instances/<int:pk>/"
,
views
.
InstanceDetail
.
as_view
()),
path
(
"instances/<int:pk>/"
,
views
.
InstanceDetail
.
as_view
()),
# path('instances/<int:pk>/action/', views.InstanceAction.as_view())
# path('instances/<int:pk>/action/', views.InstanceAction.as_view())
path
(
"flavors/"
,
views
.
FlavorListView
.
as_view
()),
]
]
urlpatterns
=
format_suffix_patterns
(
urlpatterns
)
urlpatterns
=
format_suffix_patterns
(
urlpatterns
)
recircle/instance/views.py
View file @
daea0676
from
instance.models
import
Instance
from
instance.models
import
Instance
from
instance.serializers
import
InstanceSerializer
from
instance.serializers
import
InstanceSerializer
,
FlavorSerializer
from
django.http
import
Http404
from
django.http
import
Http404
from
rest_framework.views
import
APIView
from
rest_framework.views
import
APIView
from
rest_framework.response
import
Response
from
rest_framework.response
import
Response
...
@@ -25,12 +25,15 @@ class InstanceList(APIView):
...
@@ -25,12 +25,15 @@ class InstanceList(APIView):
def
post
(
self
,
request
,
format
=
None
):
def
post
(
self
,
request
,
format
=
None
):
data
=
request
.
data
data
=
request
.
data
template
=
InstanceTemplate
(
name
=
"test1"
,
description
=
"adsasdasd"
,
template
=
InstanceTemplate
(
name
=
"test1"
,
description
=
"adsasdasd"
,
remote_ID
=
"da51253f-867c-472d-8ce0-81e7b7126d60"
)
remote_ID
=
"da51253f-867c-472d-8ce0-81e7b7126d60"
)
flavor
=
Flavor
(
name
=
"asd"
,
description
=
"asd"
,
remote_id
=
"1"
)
flavor
=
Flavor
(
name
=
"asd"
,
description
=
"asd"
,
remote_id
=
"1"
)
flavor
.
save
()
lease
=
Lease
(
name
=
"test_lease"
,
description
=
"test"
,
lease
=
Lease
(
name
=
"test_lease"
,
description
=
"test"
,
suspend_interval_in_sec
=
100
,
suspend_interval_in_sec
=
100
,
delete_interval_in_sec
=
100
)
delete_interval_in_sec
=
100
)
lease
.
save
()
newInstance
=
Instance
.
create_instance_from_template
(
newInstance
=
Instance
.
create_instance_from_template
(
params
=
{
"name"
:
data
[
"name"
],
params
=
{
"name"
:
data
[
"name"
],
...
@@ -85,3 +88,24 @@ class InstanceDetail(APIView):
...
@@ -85,3 +88,24 @@ class InstanceDetail(APIView):
instance
=
self
.
get_object
(
pk
)
instance
=
self
.
get_object
(
pk
)
instance
.
delete
()
instance
.
delete
()
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
class
FlavorListView
(
APIView
):
"""
Create, update or delete a flavor.
"""
def
get
(
self
,
request
,
format
=
None
):
flavors
=
Flavor
.
objects
.
all
()
return
Response
(
FlavorSerializer
(
flavors
,
many
=
True
)
.
data
)
def
post
(
self
,
request
,
format
=
None
):
data
=
request
.
data
new_flavor
=
Flavor
.
create
(
name
=
data
[
"name"
],
description
=
data
[
"description"
],
ram
=
data
[
"ram"
],
vcpu
=
data
[
"vcpu"
],
initial_disk
=
data
[
"initial_disk"
],
priority
=
data
[
"priority"
])
return
Response
(
new_flavor
.
pk
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment