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
3eb04d1b
authored
Sep 18, 2023
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cluster size
parent
b81542de
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
2 deletions
+17
-2
circle/dashboard/forms.py
+11
-0
circle/storage/models.py
+5
-1
circle/vm/operations.py
+1
-1
No files found.
circle/dashboard/forms.py
View file @
3eb04d1b
...
...
@@ -863,6 +863,10 @@ class VmCreateDiskForm(OperationForm):
widget
=
FileSizeWidget
,
initial
=
(
1
<<
20
),
label
=
_
(
'Metadata cache size'
),
help_text
=
_
(
'Metadata cache size, '
'like KB, MB'
))
cluster_size
=
forms
.
CharField
(
widget
=
FileSizeWidget
,
initial
=
(
1
<<
14
),
label
=
_
(
'Cluster size'
),
help_text
=
_
(
'Disk cluster (block) size, '
'like KB'
))
def
__init__
(
self
,
*
args
,
**
kwargs
):
default
=
kwargs
.
pop
(
'default'
,
None
)
...
...
@@ -885,6 +889,13 @@ class VmCreateDiskForm(OperationForm):
" KB or MB!"
))
return
int
(
size_in_kbytes
)
/
1024
def
clean_cluster_size
(
self
):
size_in_kbytes
=
self
.
cleaned_data
.
get
(
"cluster_size"
)
if
not
size_in_kbytes
.
isdigit
()
and
len
(
size_in_kbytes
)
>
0
:
raise
forms
.
ValidationError
(
_
(
"Invalid format, you can use "
" KB or MB!"
))
return
int
(
size_in_kbytes
)
/
1024
class
VmDiskExportForm
(
OperationForm
):
exported_name
=
forms
.
CharField
(
max_length
=
100
,
label
=
_
(
'Filename'
))
...
...
circle/storage/models.py
View file @
3eb04d1b
...
...
@@ -150,6 +150,9 @@ class Disk(TimeStampedModel):
cache_size
=
IntegerField
(
default
=
1024
,
help_text
=
_
(
"Disk metadata cache max size (Kbyte)"
),
verbose_name
=
_
(
'cache size'
))
cluster_size
=
IntegerField
(
default
=
64
,
help_text
=
_
(
"Disk cluster (block) size (Kbyte)"
),
verbose_name
=
_
(
'cluster size'
))
class
Meta
:
ordering
=
[
'name'
]
...
...
@@ -350,7 +353,7 @@ class Disk(TimeStampedModel):
'target_device'
:
self
.
device_type
+
self
.
dev_num
,
'target_bus'
:
self
.
device_bus
,
'disk_device'
:
'cdrom'
if
self
.
type
==
'iso'
else
'disk'
,
'cache_size'
:
self
.
cache_size
'cache_size'
:
self
.
cache_size
,
}
def
get_disk_desc
(
self
):
...
...
@@ -365,6 +368,7 @@ class Disk(TimeStampedModel):
'type'
:
'snapshot'
if
self
.
base
else
'normal'
,
'cache_size'
:
self
.
cache_size
,
'base_dir'
:
self
.
base
.
datastore
.
path
if
self
.
base
else
None
,
'cluster_size'
:
self
.
cluster_size
}
def
get_remote_queue_name
(
self
,
queue_id
=
'storage'
,
priority
=
None
,
...
...
circle/vm/operations.py
View file @
3eb04d1b
...
...
@@ -292,7 +292,7 @@ class CreateDiskOperation(InstanceOperation):
accept_states
=
(
'STOPPED'
,
'PENDING'
,
'RUNNING'
)
concurrency_check
=
False
def
_operation
(
self
,
user
,
size
,
activity
,
datastore
,
name
=
None
,
cache_size
=
1024
):
def
_operation
(
self
,
user
,
size
,
activity
,
datastore
,
name
=
None
,
cache_size
=
1024
,
cluster_size
=
64
):
from
storage.models
import
Disk
if
not
name
:
...
...
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