Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
5
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
63351c3f
authored
Sep 21, 2023
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rest api for disk cache and cluster size
parent
fb0eff7b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
circle/dashboard/serializers.py
+3
-1
circle/dashboard/views/vm.py
+7
-1
No files found.
circle/dashboard/serializers.py
View file @
63351c3f
...
@@ -72,7 +72,7 @@ class DiskSerializer(serializers.ModelSerializer):
...
@@ -72,7 +72,7 @@ class DiskSerializer(serializers.ModelSerializer):
class
Meta
:
class
Meta
:
model
=
Disk
model
=
Disk
fields
=
[
'id'
,
'name'
,
'filename'
,
'datastore'
,
'type'
,
'bus'
,
'size'
,
'base'
,
fields
=
[
'id'
,
'name'
,
'filename'
,
'datastore'
,
'type'
,
'bus'
,
'size'
,
'base'
,
'dev_num'
,
'destroyed'
,
'ci_disk'
,
'is_ready'
]
'dev_num'
,
'destroyed'
,
'ci_disk'
,
'is_ready'
,
'cache_size'
,
'cluster_size'
]
class
InstanceSerializer
(
serializers
.
ModelSerializer
):
class
InstanceSerializer
(
serializers
.
ModelSerializer
):
...
@@ -159,6 +159,8 @@ class CreateDiskSerializer(serializers.Serializer):
...
@@ -159,6 +159,8 @@ class CreateDiskSerializer(serializers.Serializer):
size
=
serializers
.
CharField
(
max_length
=
50
)
size
=
serializers
.
CharField
(
max_length
=
50
)
name
=
serializers
.
CharField
(
max_length
=
100
)
name
=
serializers
.
CharField
(
max_length
=
100
)
datastore
=
serializers
.
CharField
(
max_length
=
40
,
required
=
False
,
allow_blank
=
True
,
default
=
None
)
datastore
=
serializers
.
CharField
(
max_length
=
40
,
required
=
False
,
allow_blank
=
True
,
default
=
None
)
cache_size
=
serializers
.
IntegerField
(
required
=
False
,
allow_blank
=
True
,
default
=
1024
)
cluster_size
=
serializers
.
IntegerField
(
required
=
False
,
allow_blank
=
True
,
default
=
64
)
class
ResizeDiskSerializer
(
serializers
.
Serializer
):
class
ResizeDiskSerializer
(
serializers
.
Serializer
):
...
...
circle/dashboard/views/vm.py
View file @
63351c3f
...
@@ -136,7 +136,13 @@ class CreatePersistentDiskREST(APIView):
...
@@ -136,7 +136,13 @@ class CreatePersistentDiskREST(APIView):
datastore
=
'default'
datastore
=
'default'
if
'datastore'
in
data
:
if
'datastore'
in
data
:
datastore
=
data
[
'datastore'
]
datastore
=
data
[
'datastore'
]
disk
=
Disk
.
create
(
size
=
disk_size
,
name
=
disk_name
,
type
=
"qcow2-norm"
,
datastore
=
datastore
)
cache_size
=
1024
if
'cache_size'
in
data
:
cache_size
=
data
[
'cache_size'
]
cluster_size
=
64
if
'cluster_size'
in
data
:
cluster_size
=
data
[
'cluster_size'
]
disk
=
Disk
.
create
(
size
=
disk_size
,
name
=
disk_name
,
type
=
"qcow2-norm"
,
datastore
=
datastore
,
cache_size
=
cache_size
,
cluster_size
=
cluster_size
)
disk
.
full_clean
()
disk
.
full_clean
()
disk
.
dev_num
=
'f'
disk
.
dev_num
=
'f'
disk
.
save
()
disk
.
save
()
...
...
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