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
1b3e04f2
authored
Mar 26, 2020
by
Chif Gergő
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Little changes in Flavor model
parent
28d4e195
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
9 deletions
+61
-9
recircle/instance/migrations/0003_auto_20200326_1342.py
+53
-0
recircle/instance/models.py
+8
-9
No files found.
recircle/instance/migrations/0003_auto_20200326_1342.py
0 → 100644
View file @
1b3e04f2
# Generated by Django 3.0.4 on 2020-03-26 12:42
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'instance'
,
'0002_instance_template'
),
]
operations
=
[
migrations
.
AlterField
(
model_name
=
'flavor'
,
name
=
'initial_disk'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
),
),
migrations
.
AlterField
(
model_name
=
'flavor'
,
name
=
'name'
,
field
=
models
.
CharField
(
max_length
=
100
),
),
migrations
.
AlterField
(
model_name
=
'flavor'
,
name
=
'priority'
,
field
=
models
.
PositiveIntegerField
(
blank
=
True
,
null
=
True
),
),
migrations
.
AlterField
(
model_name
=
'flavor'
,
name
=
'ram'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
),
),
migrations
.
AlterField
(
model_name
=
'flavor'
,
name
=
'vcpu'
,
field
=
models
.
PositiveIntegerField
(
default
=
0
),
),
migrations
.
AlterField
(
model_name
=
'lease'
,
name
=
'delete_interval_in_sec'
,
field
=
models
.
IntegerField
(
default
=
7200
),
),
migrations
.
AlterField
(
model_name
=
'lease'
,
name
=
'name'
,
field
=
models
.
CharField
(
max_length
=
100
),
),
migrations
.
AlterField
(
model_name
=
'lease'
,
name
=
'suspend_interval_in_sec'
,
field
=
models
.
IntegerField
(
default
=
3600
),
),
]
recircle/instance/models.py
View file @
1b3e04f2
...
...
@@ -32,25 +32,25 @@ class Lease(models.Model):
After suspend interval the vm suspends and after delete it will be
destroyed
"""
name
=
models
.
CharField
(
blank
=
True
,
max_length
=
100
)
name
=
models
.
CharField
(
max_length
=
100
)
description
=
models
.
CharField
(
blank
=
True
,
max_length
=
100
)
suspend_interval_in_sec
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
)
delete_interval_in_sec
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
)
suspend_interval_in_sec
=
models
.
IntegerField
(
default
=
3600
)
delete_interval_in_sec
=
models
.
IntegerField
(
default
=
7200
)
class
Flavor
(
models
.
Model
):
""" Flavors are reasource packages, contains all information about
resources accociated with the virtual machine
"""
name
=
models
.
CharField
(
blank
=
Tru
e
,
max_length
=
100
)
name
=
models
.
CharField
(
blank
=
Fals
e
,
max_length
=
100
)
description
=
models
.
CharField
(
blank
=
True
,
max_length
=
200
)
remote_id
=
models
.
CharField
(
max_length
=
100
,
help_text
=
"ID of the instance on the backend"
)
ram
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
)
vcpu
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
)
initial_disk
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
)
priority
=
models
.
IntegerField
(
blank
=
True
,
null
=
True
)
ram
=
models
.
PositiveIntegerField
(
default
=
0
)
vcpu
=
models
.
PositiveIntegerField
(
default
=
0
)
initial_disk
=
models
.
PositiveIntegerField
(
default
=
0
)
priority
=
models
.
Positive
IntegerField
(
blank
=
True
,
null
=
True
)
@classmethod
def
create
(
cls
,
name
,
description
,
ram
=
0
,
vcpu
=
0
,
...
...
@@ -68,7 +68,6 @@ class Flavor(models.Model):
raise
ValueError
(
"Can't create Flavor in remote cloud."
)
def
delete
(
self
):
interface
=
OSVirtualMachineManager
(
settings
.
CONNECTION
)
try
:
interface
.
delete_flavor
(
self
.
remote_id
)
super
(
Flavor
,
self
)
.
delete
()
...
...
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