Fix volumes no attribute tenant_name error

Fix the volumes have no attribute tenant_name error,
when the volumes are in the creating/deleting/attaching status.

Closes-Bug: #1526199

Change-Id: I0085969bb8981e4ab50e4e45dbcddda19b95b6b7
This commit is contained in:
zhu.rong 2015-12-15 16:40:08 +08:00 committed by zhurong
parent bd189bc2e9
commit 3013b48f32

View File

@ -91,7 +91,8 @@ class VolumesTable(volumes_tables.VolumesTable):
verbose_name=_("Name"),
link="horizon:admin:volumes:volumes:detail")
host = tables.Column("os-vol-host-attr:host", verbose_name=_("Host"))
tenant = tables.Column("tenant_name", verbose_name=_("Project"))
tenant = tables.Column(lambda obj: getattr(obj, 'tenant_name', None),
verbose_name=_("Project"))
class Meta(object):
name = "volumes"