Add a reservable field of Hosts

Partially Implements: blueprint resource-monitoring
Depends-On: Id98c8d956f36ce5ae9fcecef9e1d181a208d3e3a

Change-Id: I76decd57003fec63feefd194f7f04003b280a66e
This commit is contained in:
Hiroaki Kobayashi 2017-12-07 13:45:28 +09:00
parent 14f738b23d
commit ec9345c1c5
4 changed files with 12 additions and 4 deletions

View File

@ -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)

View File

@ -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"

View File

@ -7,8 +7,11 @@
<dd>{{ host.hypervisor_hostname }}</dd>
<dt>{% trans "Id" %}</dt>
<dd>{{ host.id }}</dd>
<dt>{% trans "Reservable" %}</dt>
<dd>{{ host.reservable|yesno|capfirst }}</dd>
<dt>{% trans "Status" %}</dt>
<dd>{{ host.status }}</dd> <dt>{% trans "Created at" %}</dt>
<dd>{{ host.status }}</dd>
<dt>{% trans "Created at" %}</dt>
<dd>{{ host.created_at|parse_isotime|date:"Y-m-d H:i T"|default:"-" }}</dd>
<dt>{% trans "Updated at" %}</dt>
<dd>{{ host.updated_at|parse_isotime|date:"Y-m-d H:i T"|default:"-" }}</dd>

View File

@ -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
}