Adding bootable as a column in volumes table

Adding bootable as a column in volumes table

Change-Id: Ia9d491b98b731dd3e76ec35719bdd7d6f45dc609
Closes-Bug: #1319940
This commit is contained in:
Santiago Baldassin
2014-05-15 14:44:45 -03:00
parent 8314fb1367
commit 3fc60f4e64
4 changed files with 15 additions and 4 deletions

View File

@@ -81,6 +81,10 @@ class Volume(BaseCinderAPIResourceWrapper):
'os-vol-host-attr:host', 'os-vol-tenant-attr:tenant_id',
'metadata']
@property
def is_bootable(self):
return self.bootable == 'true'
class VolumeSnapshot(BaseCinderAPIResourceWrapper):

View File

@@ -59,7 +59,7 @@ class VolumesTable(project_tables.VolumesTable):
table_actions = (project_tables.DeleteVolume, VolumesFilterAction)
row_actions = (project_tables.DeleteVolume,)
columns = ('tenant', 'host', 'name', 'size', 'status', 'volume_type',
'attachments',)
'attachments', 'bootable')
class VolumeTypesTable(tables.DataTable):

View File

@@ -14,14 +14,13 @@
from django.core.urlresolvers import NoReverseMatch # noqa
from django.core.urlresolvers import reverse
from django.template.defaultfilters import title # noqa
from django.template import defaultfilters as filters
from django.utils import html
from django.utils.http import urlencode
from django.utils import safestring
from django.utils.translation import string_concat # noqa
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tables
@@ -254,7 +253,7 @@ class VolumesTableBase(tables.DataTable):
verbose_name=_("Size"),
attrs={'data-type': 'size'})
status = tables.Column("status",
filters=(title,),
filters=(filters.title,),
verbose_name=_("Status"),
status=True,
status_choices=STATUS_CHOICES)
@@ -283,6 +282,9 @@ class VolumesTable(VolumesTableBase):
verbose_name=_("Attached To"))
availability_zone = tables.Column("availability_zone",
verbose_name=_("Availability Zone"))
bootable = tables.Column('is_bootable',
verbose_name=_("Bootable"),
filters=(filters.yesno, filters.capfirst))
class Meta:
name = "volumes"

View File

@@ -82,6 +82,8 @@ def data(TEST):
'volume_type': None,
'bootable': 'true',
'attachments': []})
volume_v2.bootable = 'true'
TEST.cinder_volumes.add(api.cinder.Volume(volume_v2))
snapshot = vol_snaps.Snapshot(vol_snaps.SnapshotManager(None),
@@ -99,6 +101,9 @@ def data(TEST):
'status': 'available',
'volume_id': '31023e92-8008-4c8b-8059-7f2293ff1234'})
snapshot.bootable = 'true'
snapshot2.bootable = 'true'
TEST.cinder_volume_snapshots.add(api.cinder.VolumeSnapshot(snapshot))
TEST.cinder_volume_snapshots.add(api.cinder.VolumeSnapshot(snapshot2))