Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
76a2a4a6
authored
Jan 27, 2021
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'store_fixes' into 'master'
Store and export updates See merge request
!420
parents
649c35f4
4c11f5b4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
8 deletions
+16
-8
circle/dashboard/forms.py
+4
-1
circle/dashboard/store_api.py
+9
-2
circle/storage/models.py
+1
-3
circle/vm/operations.py
+2
-2
No files found.
circle/dashboard/forms.py
View file @
76a2a4a6
...
...
@@ -824,6 +824,7 @@ class VmCreateDiskForm(OperationForm):
class
VmDiskExportForm
(
OperationForm
):
exported_name
=
forms
.
CharField
(
max_length
=
100
,
label
=
_
(
'Filename'
))
disk_format
=
forms
.
ChoiceField
(
choices
=
Disk
.
EXPORT_FORMATS
,
label
=
_
(
'Format'
))
...
...
@@ -850,7 +851,9 @@ class VmDiskExportForm(OperationForm):
HTML
(
_
(
"<label>Disk:</label>
%
s"
)
%
escape
(
self
.
disk
)),
css_class
=
"form-group"
,
),
Field
(
'disk'
),
Field
(
'disk_format'
)
Field
(
'disk'
),
Field
(
'exported_name'
),
Field
(
'disk_format'
)
)
return
helper
...
...
circle/dashboard/store_api.py
View file @
76a2a4a6
...
...
@@ -49,9 +49,16 @@ class Store(object):
def
__init__
(
self
,
user
,
default_timeout
=
0.5
):
self
.
store_url
=
settings
.
STORE_URL
if
not
self
.
store_url
or
not
user
.
profile
.
org_id
:
if
not
self
.
store_url
:
raise
NoStoreException
self
.
username
=
'u-
%
s'
%
user
.
profile
.
org_id
if
user
.
is_superuser
and
not
user
.
profile
.
org_id
:
self
.
username
=
'u-admin'
elif
not
user
.
profile
.
org_id
:
raise
NoStoreException
else
:
self
.
username
=
'u-
%
s'
%
user
.
profile
.
org_id
self
.
request_args
=
{
'verify'
:
settings
.
STORE_VERIFY_SSL
}
if
settings
.
STORE_SSL_AUTH
:
self
.
request_args
[
'cert'
]
=
(
settings
.
STORE_CLIENT_CERT
,
...
...
circle/storage/models.py
View file @
76a2a4a6
...
...
@@ -497,9 +497,7 @@ class Disk(TimeStampedModel):
disk
.
save
()
return
disk
def
export
(
self
,
disk_format
,
upload_link
,
task
):
exported_name
=
self
.
name
if
self
.
name
!=
''
else
self
.
filename
def
export
(
self
,
exported_name
,
disk_format
,
upload_link
,
task
):
queue_name
=
self
.
get_remote_queue_name
(
'storage'
,
priority
=
'slow'
)
remote
=
storage_tasks
.
export_disk
.
apply_async
(
kwargs
=
{
...
...
circle/vm/operations.py
View file @
76a2a4a6
...
...
@@ -389,10 +389,10 @@ class ExportDiskOperation(InstanceOperation):
except
NoStoreException
:
raise
PermissionDenied
def
_operation
(
self
,
user
,
disk
,
disk_format
,
task
):
def
_operation
(
self
,
user
,
disk
,
exported_name
,
disk_format
,
task
):
store
=
Store
(
user
)
upload_link
=
store
.
request_upload
(
'/'
)
disk
.
export
(
disk_format
,
upload_link
,
task
)
disk
.
export
(
exported_name
,
disk_format
,
upload_link
,
task
)
@register_operation
...
...
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