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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
edf318bc
authored
Aug 07, 2019
by
Chif Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add network_id field to template
parent
350011be
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
7 deletions
+31
-7
recircle/instance/models.py
+5
-6
recircle/instance/views.py
+1
-1
recircle/template/migrations/0007_basetemplate_network_id.py
+18
-0
recircle/template/models.py
+7
-0
No files found.
recircle/instance/models.py
View file @
edf318bc
...
...
@@ -143,12 +143,11 @@ class Instance(models.Model):
disks
,
networks
,
flavor
):
# TODO: attach disks when the remote instance created
try
:
remote_inst
=
interface
.
create_vm_from_template
(
params
[
"name"
],
template
.
image
.
remote_id
,
flavor
.
remote_id
,
networks
,
)
remote_id
=
remote_inst
.
id
remote_id
=
interface
.
create_vm_from_template
(
params
[
"name"
],
template
.
image
.
remote_id
,
flavor
.
remote_id
,
networks
,
)
new_inst
=
cls
.
create
(
lease
,
owner
,
flavor
,
template
,
remote_id
,
params
)
return
new_inst
...
...
recircle/instance/views.py
View file @
edf318bc
...
...
@@ -45,7 +45,7 @@ class InstanceViewSet(ViewSet):
"system"
:
data
[
"system"
],
},
lease
=
template
.
lease
,
networks
=
[{
"uuid"
:
"7485b41f-2524-4399-a20b-4b2c7ee9fd01"
}],
networks
=
[{
"uuid"
:
template
.
network_id
}],
template
=
template
,
flavor
=
template
.
flavor
,
owner
=
request
.
user
,
...
...
recircle/template/migrations/0007_basetemplate_network_id.py
0 → 100644
View file @
edf318bc
# Generated by Django 2.2.3 on 2019-08-07 12:19
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'template'
,
'0006_auto_20190719_1416'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'basetemplate'
,
name
=
'network_id'
,
field
=
models
.
CharField
(
blank
=
True
,
help_text
=
'The new instance will be in this network.'
,
max_length
=
100
,
null
=
True
,
verbose_name
=
'network_id'
),
),
]
recircle/template/models.py
View file @
edf318bc
...
...
@@ -44,6 +44,13 @@ class BaseTemplate(models.Model):
related_name
=
'templates'
)
lease
=
models
.
ForeignKey
(
Lease
,
on_delete
=
"CASCADE"
,
related_name
=
'templates'
)
network_id
=
models
.
CharField
(
max_length
=
100
,
verbose_name
=
"network_id"
,
help_text
=
"The new instance will be in this network."
,
null
=
True
,
blank
=
True
)
class
DiskTemplate
(
BaseTemplate
):
...
...
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