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
fb2bd674
authored
Feb 23, 2015
by
Bach Dániel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: add ide bus support
parent
082389aa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
1 deletions
+27
-1
circle/dashboard/templates/dashboard/_disk-list-element.html
+2
-1
circle/storage/migrations/0002_disk_bus.py
+20
-0
circle/storage/models.py
+5
-0
No files found.
circle/dashboard/templates/dashboard/_disk-list-element.html
View file @
fb2bd674
...
...
@@ -25,5 +25,6 @@
<div
style=
"clear: both;"
></div>
{% if request.user.is_superuser %}
<small>
{% trans "File name" %}: {{ d.filename }}
</small>
<small>
{% trans "File name" %}: {{ d.filename }}
</small><br/>
<small>
{% trans "Bus" %}: {{ d.device_bus }}
</small>
{% endif %}
circle/storage/migrations/0002_disk_bus.py
0 → 100644
View file @
fb2bd674
# -*- coding: utf-8 -*-
from
__future__
import
unicode_literals
from
django.db
import
models
,
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'storage'
,
'0001_initial'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'disk'
,
name
=
'bus'
,
field
=
models
.
CharField
(
default
=
None
,
max_length
=
10
,
null
=
True
,
blank
=
True
,
choices
=
[(
'virtio'
,
'virtio'
),
(
'ide'
,
'ide'
),
(
'scsi'
,
'scsi'
)]),
preserve_default
=
True
,
),
]
circle/storage/models.py
View file @
fb2bd674
...
...
@@ -83,12 +83,15 @@ class Disk(TimeStampedModel):
"""
TYPES
=
[(
'qcow2-norm'
,
'qcow2 normal'
),
(
'qcow2-snap'
,
'qcow2 snapshot'
),
(
'iso'
,
'iso'
),
(
'raw-ro'
,
'raw read-only'
),
(
'raw-rw'
,
'raw'
)]
BUS_TYPES
=
((
'virtio'
,
'virtio'
),
(
'ide'
,
'ide'
),
(
'scsi'
,
'scsi'
))
name
=
CharField
(
blank
=
True
,
max_length
=
100
,
verbose_name
=
_
(
"name"
))
filename
=
CharField
(
max_length
=
256
,
unique
=
True
,
verbose_name
=
_
(
"filename"
))
datastore
=
ForeignKey
(
DataStore
,
verbose_name
=
_
(
"datastore"
),
help_text
=
_
(
"The datastore that holds the disk."
))
type
=
CharField
(
max_length
=
10
,
choices
=
TYPES
)
bus
=
CharField
(
max_length
=
10
,
choices
=
BUS_TYPES
,
null
=
True
,
blank
=
True
,
default
=
None
)
size
=
FileSizeField
(
null
=
True
,
default
=
None
)
base
=
ForeignKey
(
'self'
,
blank
=
True
,
null
=
True
,
related_name
=
'derivatives'
)
...
...
@@ -222,6 +225,8 @@ class Disk(TimeStampedModel):
def
device_bus
(
self
):
"""Returns the proper device prefix for different types of images.
"""
if
self
.
bus
:
return
self
.
bus
return
{
'qcow2-norm'
:
'virtio'
,
'qcow2-snap'
:
'virtio'
,
...
...
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