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
c5df7cd4
authored
May 10, 2019
by
Belákovics Ádám
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add migration
parent
4358b986
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
8 deletions
+54
-8
recircle/instance/migrations/0003_auto_20190510_1307.py
+46
-0
recircle/instance/views.py
+8
-8
No files found.
recircle/instance/migrations/0003_auto_20190510_1307.py
0 → 100644
View file @
c5df7cd4
# Generated by Django 2.2.1 on 2019-05-10 13:07
from
django.db
import
migrations
,
models
import
django.utils.timezone
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'instance'
,
'0002_auto_20190502_1341'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'instance'
,
name
=
'deleted'
,
field
=
models
.
BooleanField
(
default
=
False
,
help_text
=
'Indicates if the instance is ready for garbage collection'
),
),
migrations
.
AddField
(
model_name
=
'instance'
,
name
=
'time_of_delete'
,
field
=
models
.
DateTimeField
(
default
=
django
.
utils
.
timezone
.
now
,
help_text
=
'After this point in time, the instance will be deleted!'
),
preserve_default
=
False
,
),
migrations
.
AddField
(
model_name
=
'instance'
,
name
=
'time_of_suspend'
,
field
=
models
.
DateTimeField
(
default
=
django
.
utils
.
timezone
.
now
,
help_text
=
'After this point in time, the instance will be suspended'
),
preserve_default
=
False
,
),
migrations
.
AlterField
(
model_name
=
'instance'
,
name
=
'access_method'
,
field
=
models
.
CharField
(
choices
=
[(
'rdp'
,
'Remote Desktop Protocol'
),
(
'ssh'
,
'Secure Shell'
)],
help_text
=
'Primary remote access method'
,
max_length
=
10
),
),
migrations
.
AlterField
(
model_name
=
'instance'
,
name
=
'lease'
,
field
=
models
.
CharField
(
choices
=
[(
'shortlab'
,
'Short laboratory'
),
(
'lab'
,
'Laboratory'
),
(
'project'
,
'Project'
)],
help_text
=
'Expiration method'
,
max_length
=
50
),
),
migrations
.
AlterField
(
model_name
=
'instance'
,
name
=
'password'
,
field
=
models
.
CharField
(
help_text
=
'Original password of the instance'
,
max_length
=
50
),
),
]
recircle/instance/views.py
View file @
c5df7cd4
...
@@ -22,14 +22,14 @@ class InstanceList(APIView):
...
@@ -22,14 +22,14 @@ class InstanceList(APIView):
return
Response
(
serializer
.
data
)
return
Response
(
serializer
.
data
)
def
post
(
self
,
request
,
format
=
None
):
def
post
(
self
,
request
,
format
=
None
):
serializer
=
InstanceSerializer
(
data
=
request
.
data
)
data
=
request
.
data
newId
=
0
# OpenStack
interface
=
OSVirtualMachineManager
(
conn
)
imageId
=
"da51253f-867c-472d-8ce0-81e7b7126d60"
if
serializer
.
is_valid
():
flavorId
=
{
"name"
:
1
}
serializer
.
save
()
networks
=
[{
"uuid"
:
"c03d0d4b-413e-4cc6-9ebe-c0b5ca0dac3a"
}]
return
Response
(
serializer
.
data
,
status
=
status
.
HTTP_201_CREATED
)
interface
.
create_vm_from_template
(
"Integration test vm 1"
,
imageId
,
flavorId
,
networks
)
return
Response
(
serializer
.
errors
,
status
=
status
.
HTTP_400_BAD_REQUEST
)
return
Response
(
newId
)
class
InstanceDetail
(
APIView
):
class
InstanceDetail
(
APIView
):
...
...
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