Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Paring down the syspanel instances table.
There was simply too much information in that table to be usable.
It probably still needs to lose more weight in favor of moving things
to a more admin-oriented detail page. However, we need to get real user
feedback on what data is critical for the overview vs. what can be in
a detail page.

Fixes bug 944506.

Change-Id: Iaad218bc6ed6647645c5943920467bec097a0a2d
  • Loading branch information
gabrielhurley committed Mar 19, 2012
1 parent 9ba9d97 commit 19ef513
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
4 changes: 4 additions & 0 deletions horizon/api/nova.py
Expand Up @@ -100,6 +100,10 @@ def image_name(self):
except glance_exceptions.NotFound:
return "(not found)"

@property
def internal_name(self):
return getattr(self, 'OS-EXT-SRV-ATTR:instance_name', "")

def reboot(self, hardness=REBOOT_HARD):
novaclient(self.request).servers.reboot(self.id, hardness)

Expand Down
17 changes: 10 additions & 7 deletions horizon/dashboards/syspanel/instances/tables.py
Expand Up @@ -21,10 +21,11 @@
from django.utils.translation import ugettext as _

from horizon import tables
from horizon.dashboards.nova.instances_and_volumes.instances.tables import \
(LaunchLink, TerminateInstance, EditInstance, ConsoleLink, LogLink,
SnapshotLink, TogglePause, ToggleSuspend, RebootInstance, get_size,
TerminateInstance, UpdateRow, get_ips, get_power_state)
from horizon.dashboards.nova.instances_and_volumes.instances.tables import (
TerminateInstance, EditInstance, ConsoleLink, LogLink, SnapshotLink,
TogglePause, ToggleSuspend, RebootInstance, get_size, UpdateRow,
get_ips, get_power_state)


LOG = logging.getLogger(__name__)

Expand All @@ -39,9 +40,11 @@ class SyspanelInstancesTable(tables.DataTable):
("error", False),
)
tenant = tables.Column("tenant_name", verbose_name=_("Tenant"))
user = tables.Column("user_id", verbose_name=_("User"))
internal_id = tables.Column("internal_identifier",
verbose_name=_("Instance ID"))
# NOTE(gabriel): Commenting out the user column because all we have
# is an ID, and correlating that at production scale using our current
# techniques isn't practical. It can be added back in when we have names
# returned in a practical manner by the API.
#user = tables.Column("user_id", verbose_name=_("User"))
host = tables.Column("OS-EXT-SRV-ATTR:host", verbose_name=_("Host"))
name = tables.Column("name", link="horizon:nova:instances_and_volumes:" \
"instances:detail",
Expand Down
31 changes: 18 additions & 13 deletions horizon/dashboards/syspanel/instances/views.py
Expand Up @@ -28,8 +28,8 @@
from horizon import exceptions
from horizon import tables
from horizon.dashboards.syspanel.instances.tables import SyspanelInstancesTable
from horizon.dashboards.nova.instances_and_volumes \
.instances.views import console, DetailView, vnc
from horizon.dashboards.nova.instances_and_volumes .instances.views import (
console, DetailView, vnc)


LOG = logging.getLogger(__name__)
Expand All @@ -47,20 +47,25 @@ def get_data(self):
exceptions.handle(self.request,
_('Unable to retrieve instance list.'))
if instances:
# Gather our flavors to correlate against IDs
try:
flavors = api.nova.flavor_list(self.request)
tenants = SortedDict([(str(tenant.id), tenant) for \
tenant in api.keystone.tenant_list(
self.request, admin=True)])
full_flavors = SortedDict([(str(flavor.id), flavor) for \
flavor in flavors])
for inst in instances:
inst.full_flavor = full_flavors[inst.flavor["id"]]
inst.internal_identifier = "%s (%s)" % (inst.id,
getattr(inst, 'OS-EXT-SRV-ATTR:instance_name'))
inst.tenant_name = "%s (%s)" % (inst.tenant_id,
tenants[inst.tenant_id].name)
except:
flavors = []
msg = _('Unable to retrieve instance size information.')
exceptions.handle(self.request, msg)
# Gather our tenants to correlate against IDs
try:
tenants = api.keystone.tenant_list(self.request, admin=True)
except:
tenants = []
msg = _('Unable to retrieve instance tenant information.')
exceptions.handle(self.request, msg)

full_flavors = SortedDict([(f.id, f) for f in flavors])
tenant_dict = SortedDict([(t.id, t) for t in tenants])
for inst in instances:
inst.full_flavor = full_flavors.get(inst.flavor["id"], None)
tenant = tenant_dict.get(inst.tenant_id, None)
inst.tenant_name = getattr(tenant, "name", None)
return instances

0 comments on commit 19ef513

Please sign in to comment.