From ec9345c1c57656e46844049909656307a5cb900b Mon Sep 17 00:00:00 2001 From: Hiroaki Kobayashi Date: Thu, 7 Dec 2017 13:45:28 +0900 Subject: [PATCH] Add a reservable field of Hosts Partially Implements: blueprint resource-monitoring Depends-On: Id98c8d956f36ce5ae9fcecef9e1d181a208d3e3a Change-Id: I76decd57003fec63feefd194f7f04003b280a66e --- blazar_dashboard/api/client.py | 2 +- blazar_dashboard/content/hosts/tables.py | 3 +++ .../content/hosts/templates/hosts/_detail_overview.html | 5 ++++- blazar_dashboard/test/test_data/blazar_data.py | 6 ++++-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/blazar_dashboard/api/client.py b/blazar_dashboard/api/client.py index 44e3e26..88f787a 100644 --- a/blazar_dashboard/api/client.py +++ b/blazar_dashboard/api/client.py @@ -46,7 +46,7 @@ class Host(base.APIDictWrapper): _attrs = ['id', 'hypervisor_hostname', 'hypervisor_type', 'hypervisor_version', 'vcpus', 'cpu_info', 'memory_mb', 'local_gb', 'status', 'created_at', 'updated_at', - 'service_name', 'trust_id'] + 'service_name', 'trust_id', 'reservable'] def __init__(self, apiresource): super(Host, self).__init__(apiresource) diff --git a/blazar_dashboard/content/hosts/tables.py b/blazar_dashboard/content/hosts/tables.py index 2760ec5..6dafcea 100644 --- a/blazar_dashboard/content/hosts/tables.py +++ b/blazar_dashboard/content/hosts/tables.py @@ -10,6 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. +from django.template import defaultfilters as filters from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ungettext_lazy from horizon import tables @@ -68,6 +69,8 @@ class HostsTable(tables.DataTable): local_gb = tables.Column("local_gb", verbose_name=_("Local Storage"), filters=(sizeformat.diskgbformat,)) type = tables.Column("hypervisor_type", verbose_name=_("Hypervisor type")) + reservable = tables.Column("reservable", verbose_name=_("Reservable"), + filters=(filters.yesno, filters.capfirst)) class Meta(object): name = "hosts" diff --git a/blazar_dashboard/content/hosts/templates/hosts/_detail_overview.html b/blazar_dashboard/content/hosts/templates/hosts/_detail_overview.html index 14f134a..885803f 100644 --- a/blazar_dashboard/content/hosts/templates/hosts/_detail_overview.html +++ b/blazar_dashboard/content/hosts/templates/hosts/_detail_overview.html @@ -7,8 +7,11 @@
{{ host.hypervisor_hostname }}
{% trans "Id" %}
{{ host.id }}
+
{% trans "Reservable" %}
+
{{ host.reservable|yesno|capfirst }}
{% trans "Status" %}
-
{{ host.status }}
{% trans "Created at" %}
+
{{ host.status }}
+
{% trans "Created at" %}
{{ host.created_at|parse_isotime|date:"Y-m-d H:i T"|default:"-" }}
{% trans "Updated at" %}
{{ host.updated_at|parse_isotime|date:"Y-m-d H:i T"|default:"-" }}
diff --git a/blazar_dashboard/test/test_data/blazar_data.py b/blazar_dashboard/test/test_data/blazar_data.py index a0c809e..cb566d5 100644 --- a/blazar_dashboard/test/test_data/blazar_data.py +++ b/blazar_dashboard/test/test_data/blazar_data.py @@ -153,7 +153,8 @@ host_sample1 = { "local_gb": 128, "id": "1", "trust_id": "dummy", - "ex1": "dummy" + "ex1": "dummy", + "reservable": True } host_sample2 = { @@ -170,7 +171,8 @@ host_sample2 = { "local_gb": 128, "id": "2", "trust_id": "dummy", - "ex2": "dummy" + "ex2": "dummy", + "reservable": True }