Merge "Add a reservable field of Hosts"

This commit is contained in:
Zuul 2018-02-27 11:05:26 +00:00 committed by Gerrit Code Review
commit 9310432b3c
4 changed files with 12 additions and 4 deletions

View File

@ -45,7 +45,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

@ -149,7 +149,8 @@ host_sample1 = {
"local_gb": 128,
"id": "1",
"trust_id": "dummy",
"ex1": "dummy"
"ex1": "dummy",
"reservable": True
}
host_sample2 = {
@ -166,7 +167,8 @@ host_sample2 = {
"local_gb": 128,
"id": "2",
"trust_id": "dummy",
"ex2": "dummy"
"ex2": "dummy",
"reservable": True
}