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
01dd477c
authored
Jan 01, 2023
by
Karsa Zoltán István
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vm disk setup datastore
parent
d5d3e15b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
6 deletions
+13
-6
circle/dashboard/forms.py
+7
-0
circle/dashboard/templates/dashboard/storage/detail.html
+2
-2
circle/dashboard/urls.py
+1
-1
circle/vm/operations.py
+3
-3
No files found.
circle/dashboard/forms.py
View file @
01dd477c
...
@@ -851,10 +851,12 @@ class VmCreateDiskForm(OperationForm):
...
@@ -851,10 +851,12 @@ class VmCreateDiskForm(OperationForm):
widget
=
FileSizeWidget
,
initial
=
(
10
<<
30
),
label
=
_
(
'Size'
),
widget
=
FileSizeWidget
,
initial
=
(
10
<<
30
),
label
=
_
(
'Size'
),
help_text
=
_
(
'Size of disk to create in bytes or with units '
help_text
=
_
(
'Size of disk to create in bytes or with units '
'like MB or GB.'
))
'like MB or GB.'
))
datastore
=
forms
.
ModelChoiceField
(
queryset
=
None
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
default
=
kwargs
.
pop
(
'default'
,
None
)
default
=
kwargs
.
pop
(
'default'
,
None
)
super
(
VmCreateDiskForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
VmCreateDiskForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'datastore'
]
.
queryset
=
DataStore
.
objects
.
all
()
if
default
:
if
default
:
self
.
fields
[
'name'
]
.
initial
=
default
self
.
fields
[
'name'
]
.
initial
=
default
...
@@ -989,6 +991,11 @@ class VmImportDiskForm(OperationForm):
...
@@ -989,6 +991,11 @@ class VmImportDiskForm(OperationForm):
class
VmDownloadDiskForm
(
OperationForm
):
class
VmDownloadDiskForm
(
OperationForm
):
name
=
forms
.
CharField
(
max_length
=
100
,
label
=
_
(
"Name"
),
required
=
False
)
name
=
forms
.
CharField
(
max_length
=
100
,
label
=
_
(
"Name"
),
required
=
False
)
url
=
forms
.
CharField
(
label
=
_
(
'URL'
),
validators
=
[
URLValidator
(),
])
url
=
forms
.
CharField
(
label
=
_
(
'URL'
),
validators
=
[
URLValidator
(),
])
datastore
=
forms
.
ModelChoiceField
(
queryset
=
None
)
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
(
VmDownloadDiskForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
fields
[
'datastore'
]
.
queryset
=
DataStore
.
objects
.
all
()
def
clean
(
self
):
def
clean
(
self
):
cleaned_data
=
super
(
VmDownloadDiskForm
,
self
)
.
clean
()
cleaned_data
=
super
(
VmDownloadDiskForm
,
self
)
.
clean
()
...
...
circle/dashboard/templates/dashboard/storage/detail.html
View file @
01dd477c
...
@@ -16,11 +16,11 @@
...
@@ -16,11 +16,11 @@
<div
class=
"panel-body"
>
<div
class=
"panel-body"
>
{% for ds in stores %}
{% for ds in stores %}
{% if ds.name == name %}
{% if ds.name == name %}
<a
href=
"
#"
class=
"badge badge-success
"
>
<a
href=
"
{% url "
dashboard
.
views
.
storage
.
name
"
name=
ds.name
%}"
class=
"badge badge-dark
"
>
<i
class=
"fa fa-database"
></i>
{{ ds.hostname }}/{{ ds.name }}
<i
class=
"fa fa-database"
></i>
{{ ds.hostname }}/{{ ds.name }}
</a>
</a>
{% else %}
{% else %}
<a
href=
"
#
"
class=
"badge badge-primary"
>
<a
href=
"
{% url "
dashboard
.
views
.
storage
.
name
"
name=
ds.name
%}
"
class=
"badge badge-primary"
>
{{ ds.hostname }}/{{ ds.name }}
{{ ds.hostname }}/{{ ds.name }}
</a>
</a>
{% endif %}
{% endif %}
...
...
circle/dashboard/urls.py
View file @
01dd477c
...
@@ -300,7 +300,7 @@ urlpatterns = [
...
@@ -300,7 +300,7 @@ urlpatterns = [
url
(
r'^vm/opensearch.xml$'
,
OpenSearchDescriptionView
.
as_view
(),
url
(
r'^vm/opensearch.xml$'
,
OpenSearchDescriptionView
.
as_view
(),
name
=
"dashboard.views.vm-opensearch"
),
name
=
"dashboard.views.vm-opensearch"
),
url
(
r'^storage/(?P<name>[^/]+)/$'
,
StorageDetail
.
as_view
(),
url
(
r'^storage/(?P<name>[^/]+)/$'
,
StorageDetail
.
as_view
(),
name
=
"dashboard.views.storage"
),
name
=
"dashboard.views.storage
.name
"
),
url
(
r'^storage/'
,
StorageDetail
.
as_view
(),
url
(
r'^storage/'
,
StorageDetail
.
as_view
(),
name
=
"dashboard.views.storage"
),
name
=
"dashboard.views.storage"
),
url
(
r'^disk/(?P<pk>\d+)/$'
,
DiskDetail
.
as_view
(),
url
(
r'^disk/(?P<pk>\d+)/$'
,
DiskDetail
.
as_view
(),
...
...
circle/vm/operations.py
View file @
01dd477c
...
@@ -292,12 +292,12 @@ class CreateDiskOperation(InstanceOperation):
...
@@ -292,12 +292,12 @@ class CreateDiskOperation(InstanceOperation):
accept_states
=
(
'STOPPED'
,
'PENDING'
,
'RUNNING'
)
accept_states
=
(
'STOPPED'
,
'PENDING'
,
'RUNNING'
)
concurrency_check
=
False
concurrency_check
=
False
def
_operation
(
self
,
user
,
size
,
activity
,
name
=
None
):
def
_operation
(
self
,
user
,
size
,
activity
,
datastore
,
name
=
None
):
from
storage.models
import
Disk
from
storage.models
import
Disk
if
not
name
:
if
not
name
:
name
=
"new disk"
name
=
"new disk"
disk
=
Disk
.
create
(
size
=
size
,
name
=
name
,
type
=
"qcow2-norm"
)
disk
=
Disk
.
create
(
size
=
size
,
name
=
name
,
datastore
=
datastore
.
name
,
type
=
"qcow2-norm"
)
disk
.
full_clean
()
disk
.
full_clean
()
devnums
=
list
(
ascii_lowercase
)
devnums
=
list
(
ascii_lowercase
)
for
d
in
self
.
instance
.
disks
.
all
():
for
d
in
self
.
instance
.
disks
.
all
():
...
@@ -365,7 +365,7 @@ class DownloadDiskOperation(InstanceOperation):
...
@@ -365,7 +365,7 @@ class DownloadDiskOperation(InstanceOperation):
async_queue
=
"localhost.man.slow"
async_queue
=
"localhost.man.slow"
concurrency_check
=
False
# warning!!!
concurrency_check
=
False
# warning!!!
def
_operation
(
self
,
user
,
url
,
task
,
activity
,
name
=
None
):
def
_operation
(
self
,
user
,
url
,
task
,
activity
,
datastore
,
name
=
None
):
disk
=
Disk
.
download
(
url
=
url
,
name
=
name
,
task
=
task
)
disk
=
Disk
.
download
(
url
=
url
,
name
=
name
,
task
=
task
)
devnums
=
list
(
ascii_lowercase
)
devnums
=
list
(
ascii_lowercase
)
for
d
in
self
.
instance
.
disks
.
all
():
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