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
b81542de
authored
Sep 18, 2023
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
metadata cache update
parent
82fee5fc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
3 deletions
+18
-3
circle/dashboard/forms.py
+14
-0
circle/storage/models.py
+2
-1
circle/vm/operations.py
+2
-2
No files found.
circle/dashboard/forms.py
View file @
b81542de
...
...
@@ -92,12 +92,15 @@ class VmSaveForm(OperationForm):
help_text
=
_
(
'Human readable name of template.'
))
datastore
=
forms
.
ModelChoiceField
(
queryset
=
None
,
initial
=
0
,
empty_label
=
None
,
help_text
=
_
(
'Backing file location'
))
overlay_path
=
forms
.
ModelChoiceField
(
queryset
=
None
,
initial
=
0
,
empty_label
=
None
,
help_text
=
_
(
'Overlay image dir'
))
def
__init__
(
self
,
*
args
,
**
kwargs
):
default
=
kwargs
.
pop
(
'default'
,
None
)
clone
=
kwargs
.
pop
(
'clone'
,
False
)
super
(
VmSaveForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'datastore'
]
.
queryset
=
DataStore
.
objects
.
all
()
self
.
fields
[
'overlay_path'
]
.
queryset
=
DataStore
.
objects
.
all
()
if
default
:
self
.
fields
[
'name'
]
.
initial
=
default
if
clone
:
...
...
@@ -856,6 +859,10 @@ class VmCreateDiskForm(OperationForm):
help_text
=
_
(
'Size of disk to create in bytes or with units '
'like MB or GB.'
))
datastore
=
forms
.
ModelChoiceField
(
queryset
=
None
,
initial
=
0
,
empty_label
=
None
)
cache_size
=
forms
.
CharField
(
widget
=
FileSizeWidget
,
initial
=
(
1
<<
20
),
label
=
_
(
'Metadata cache size'
),
help_text
=
_
(
'Metadata cache size, '
'like KB, MB'
))
def
__init__
(
self
,
*
args
,
**
kwargs
):
default
=
kwargs
.
pop
(
'default'
,
None
)
...
...
@@ -871,6 +878,13 @@ class VmCreateDiskForm(OperationForm):
" GB or MB!"
))
return
size_in_bytes
def
clean_cache_size
(
self
):
size_in_kbytes
=
self
.
cleaned_data
.
get
(
"cache_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 @
b81542de
...
...
@@ -363,7 +363,8 @@ class Disk(TimeStampedModel):
'size'
:
self
.
size
,
'base_name'
:
self
.
base
.
filename
if
self
.
base
else
None
,
'type'
:
'snapshot'
if
self
.
base
else
'normal'
,
'cache_size'
:
self
.
cache_size
'cache_size'
:
self
.
cache_size
,
'base_dir'
:
self
.
base
.
datastore
.
path
if
self
.
base
else
None
,
}
def
get_remote_queue_name
(
self
,
queue_id
=
'storage'
,
priority
=
None
,
...
...
circle/vm/operations.py
View file @
b81542de
...
...
@@ -292,12 +292,12 @@ class CreateDiskOperation(InstanceOperation):
accept_states
=
(
'STOPPED'
,
'PENDING'
,
'RUNNING'
)
concurrency_check
=
False
def
_operation
(
self
,
user
,
size
,
activity
,
datastore
,
name
=
None
):
def
_operation
(
self
,
user
,
size
,
activity
,
datastore
,
name
=
None
,
cache_size
=
1024
):
from
storage.models
import
Disk
if
not
name
:
name
=
"new disk"
disk
=
Disk
.
create
(
size
=
size
,
name
=
name
,
datastore
=
datastore
.
name
,
type
=
"qcow2-norm"
)
disk
=
Disk
.
create
(
size
=
size
,
name
=
name
,
datastore
=
datastore
.
name
,
type
=
"qcow2-norm"
,
cache_size
=
cache_size
)
disk
.
full_clean
()
devnums
=
list
(
ascii_lowercase
)
for
d
in
self
.
instance
.
disks
.
all
():
...
...
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