diff --git a/openstack_dashboard/api/placement.py b/openstack_dashboard/api/placement.py index 532d96465b..60c07d4ebe 100644 --- a/openstack_dashboard/api/placement.py +++ b/openstack_dashboard/api/placement.py @@ -95,16 +95,34 @@ def get_providers(request): p['usages'] = usages p['aggregates'] = resource_provider_aggregates(request, p['uuid']) p['traits'] = resource_provider_traits(request, p['uuid']) + p['vcpus_used'] = usages.get('VCPU') p['vcpus_reserved'] = vcpus['reserved'] if vcpus is not None else None + # The actual amount of the resource that the provider can accommodate p['vcpus'] = vcpus['total'] if vcpus is not None else None + # Overall capacity + p['vcpus_ar'] = vcpus['allocation_ratio'] \ + if vcpus is not None else None + p['vcpus_capacity'] = int(vcpus['allocation_ratio'] * vcpus['total']) \ + if vcpus is not None else None + p['pcpus_used'] = usages.get('PCPU') p['pcpus_reserved'] = pcpus['reserved'] if pcpus is not None else None p['pcpus'] = pcpus['total'] if pcpus is not None else None + p['pcpus_ar'] = pcpus['allocation_ratio'] \ + if pcpus is not None else None + p['pcpus_capacity'] = int(pcpus['allocation_ratio'] * pcpus['total']) \ + if pcpus is not None else None + p['memory_mb_used'] = usages['MEMORY_MB'] p['memory_mb_reserved'] = inventories['MEMORY_MB']['reserved'] p['memory_mb'] = inventories['MEMORY_MB']['total'] + p['memory_mb_ar'] = inventories['MEMORY_MB']['allocation_ratio'] + p['memory_mb_capacity'] = p['memory_mb_ar'] * p['memory_mb'] + p['disk_gb_used'] = usages['DISK_GB'] p['disk_gb_reserved'] = inventories['DISK_GB']['reserved'] p['disk_gb'] = inventories['DISK_GB']['total'] + p['disk_gb_ar'] = inventories['DISK_GB']['allocation_ratio'] + p['disk_gb_capacity'] = p['disk_gb_ar'] * p['disk_gb'] return providers diff --git a/openstack_dashboard/dashboards/admin/hypervisors/tables.py b/openstack_dashboard/dashboards/admin/hypervisors/tables.py index 83e35fb94b..696418e573 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/tables.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/tables.py @@ -72,41 +72,49 @@ class AdminProvidersTable(tables.DataTable): name = tables.WrappingColumn("name", verbose_name=_("Resource Provider Name")) vcpus_used = tables.Column("vcpus_used", - verbose_name=_("VCPUs (used)")) + verbose_name=_("VCPUs used")) vcpus_reserved = tables.Column("vcpus_reserved", - verbose_name=_("VCPUs (reserved)")) + verbose_name=_("VCPUs reserved")) vcpus = tables.Column("vcpus", - verbose_name=_("VCPUs (total)")) + verbose_name=_("VCPUs total")) + vcpus_ar = tables.Column("vcpus_ar", + verbose_name=_("VCPUs allocation ratio")) pcpus_used = tables.Column("pcpus_used", - verbose_name=_("PCPUs (used)")) + verbose_name=_("PCPUs used")) pcpus_reserved = tables.Column("pcpus_reserved", - verbose_name=_("PCPUs (reserved)")) + verbose_name=_("PCPUs reserved")) pcpus = tables.Column("pcpus", - verbose_name=_("PCPUs (total)")) - memory_used = tables.Column('memory_mb_used', - verbose_name=_("RAM (used)"), + verbose_name=_("PCPUs total")) + pcpus_ar = tables.Column("pcpus_ar", + verbose_name=_("PCPUs allocation ratio")) + memory_used = tables.Column("memory_mb_used", + verbose_name=_("RAM used"), attrs={'data-type': 'size'}, filters=(sizeformat.mb_float_format,)) - memory_reserved = tables.Column('memory_mb_reserved', - verbose_name=_("RAM (reserved)"), + memory_reserved = tables.Column("memory_mb_reserved", + verbose_name=_("RAM reserved"), attrs={'data-type': 'size'}, filters=(sizeformat.mb_float_format,)) - memory = tables.Column('memory_mb', - verbose_name=_("RAM (total)"), + memory = tables.Column("memory_mb", + verbose_name=_("RAM total"), attrs={'data-type': 'size'}, filters=(sizeformat.mb_float_format,)) - disk_used = tables.Column('disk_gb_used', - verbose_name=_("Storage (used)"), + memory_ar = tables.Column("memory_mb_ar", + verbose_name=_("RAM allocation ratio")) + disk_used = tables.Column("disk_gb_used", + verbose_name=_("Storage used"), attrs={'data-type': 'size'}, filters=(sizeformat.diskgbformat,)) - disk_reserved = tables.Column('disk_gb_reserved', - verbose_name=_("Storage (reserved)"), + disk_reserved = tables.Column("disk_gb_reserved", + verbose_name=_("Storage reserved"), attrs={'data-type': 'size'}, filters=(sizeformat.diskgbformat,)) - disk = tables.Column('disk_gb', - verbose_name=_("Storage (total)"), + disk = tables.Column("disk_gb", + verbose_name=_("Storage total"), attrs={'data-type': 'size'}, filters=(sizeformat.diskgbformat,)) + disk_ar = tables.Column("disk_gb_ar", + verbose_name=_("Storage allocation ratio")) def get_object_id(self, provider): return provider['uuid'] diff --git a/openstack_dashboard/dashboards/admin/hypervisors/templates/hypervisors/index.html b/openstack_dashboard/dashboards/admin/hypervisors/templates/hypervisors/index.html index 7b4f750895..8b5728ce55 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/templates/hypervisors/index.html +++ b/openstack_dashboard/dashboards/admin/hypervisors/templates/hypervisors/index.html @@ -27,38 +27,38 @@ {% for provider in providers %}