2013-07-04 12:28:34 +02:00
|
|
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
|
|
|
|
|
|
# Copyright 2013 B1 Systems GmbH
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
# not use this file except in compliance with the License. You may obtain
|
|
|
|
# a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing permissions and limitations
|
|
|
|
# under the License.
|
|
|
|
|
2014-01-03 17:31:49 +01:00
|
|
|
from django.utils.translation import ugettext_lazy as _
|
2013-08-09 13:20:11 -07:00
|
|
|
|
2013-07-04 12:28:34 +02:00
|
|
|
from horizon import tables
|
2013-08-09 13:20:11 -07:00
|
|
|
from horizon.templatetags import sizeformat
|
2013-07-04 12:28:34 +02:00
|
|
|
|
|
|
|
|
|
|
|
class AdminHypervisorsTable(tables.DataTable):
|
2013-07-09 10:38:50 +02:00
|
|
|
hostname = tables.Column("hypervisor_hostname",
|
|
|
|
link=("horizon:admin:hypervisors:detail"),
|
2014-02-10 16:04:33 -08:00
|
|
|
attrs={'data-type': 'naturalSort'},
|
2013-07-09 10:38:50 +02:00
|
|
|
verbose_name=_("Hostname"))
|
2013-07-04 12:28:34 +02:00
|
|
|
|
|
|
|
hypervisor_type = tables.Column("hypervisor_type",
|
|
|
|
verbose_name=_("Type"))
|
|
|
|
|
|
|
|
vcpus = tables.Column("vcpus",
|
|
|
|
verbose_name=_("VCPUs (total)"))
|
|
|
|
|
|
|
|
vcpus_used = tables.Column("vcpus_used",
|
|
|
|
verbose_name=_("VCPUs (used)"))
|
|
|
|
|
2013-12-18 17:03:15 -05:00
|
|
|
memory = tables.Column('memory_mb',
|
2013-07-04 12:28:34 +02:00
|
|
|
verbose_name=_("RAM (total)"),
|
2013-12-18 17:03:15 -05:00
|
|
|
attrs={'data-type': 'size'},
|
|
|
|
filters=(sizeformat.mbformat,))
|
2013-07-04 12:28:34 +02:00
|
|
|
|
2013-12-18 17:03:15 -05:00
|
|
|
memory_used = tables.Column('memory_mb_used',
|
2013-07-04 12:28:34 +02:00
|
|
|
verbose_name=_("RAM (used)"),
|
2013-12-18 17:03:15 -05:00
|
|
|
attrs={'data-type': 'size'},
|
|
|
|
filters=(sizeformat.mbformat,))
|
2013-07-04 12:28:34 +02:00
|
|
|
|
2013-12-18 17:03:15 -05:00
|
|
|
local = tables.Column('local_gb',
|
2013-07-04 12:28:34 +02:00
|
|
|
verbose_name=_("Storage (total)"),
|
2013-12-18 17:03:15 -05:00
|
|
|
attrs={'data-type': 'size'},
|
|
|
|
filters=(sizeformat.diskgbformat,))
|
2013-07-04 12:28:34 +02:00
|
|
|
|
2013-12-18 17:03:15 -05:00
|
|
|
local_used = tables.Column('local_gb_used',
|
2013-07-04 12:28:34 +02:00
|
|
|
verbose_name=_("Storage (used)"),
|
2013-12-18 17:03:15 -05:00
|
|
|
attrs={'data-type': 'size'},
|
|
|
|
filters=(sizeformat.diskgbformat,))
|
2013-07-04 12:28:34 +02:00
|
|
|
|
|
|
|
running_vms = tables.Column("running_vms",
|
|
|
|
verbose_name=_("Instances"))
|
|
|
|
|
2013-07-09 10:38:50 +02:00
|
|
|
def get_object_id(self, hypervisor):
|
|
|
|
return hypervisor.hypervisor_hostname
|
|
|
|
|
2013-07-04 12:28:34 +02:00
|
|
|
class Meta:
|
|
|
|
name = "hypervisors"
|
|
|
|
verbose_name = _("Hypervisors")
|
2013-07-09 10:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
class AdminHypervisorInstancesTable(tables.DataTable):
|
|
|
|
name = tables.Column("name",
|
|
|
|
verbose_name=_("Instance Name"))
|
|
|
|
|
|
|
|
instance_id = tables.Column("uuid",
|
|
|
|
verbose_name=_("Instance ID"))
|
|
|
|
|
|
|
|
def get_object_id(self, server):
|
|
|
|
return server['uuid']
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
name = "hypervisor_instances"
|
|
|
|
verbose_name = _("Hypervisor Instances")
|