Dmitry Tantsur d2d80fa9ef Manage image ID's for node profile
Kernel and ramdisk image ID's are stored for each node profile
in nova keys and should be managed via UI.

Only image ID is displayed in node profile list. Though
somewhat unfriendly, this is better for now than making
2 calls to Glance for every row. Separate node details page
will be introduced in the next patch to fix this issue.

Also this patch introduce abstraction over flavor to ease
writing code specific to node profiles.

Change-Id: Ie76651536e2d8b90e14c9000da0226743db91e88
2014-02-27 06:29:27 -05:00

61 lines
2.4 KiB
Python

# -*- coding: utf8 -*-
#
# 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.
from django.utils.translation import ugettext_lazy as _
from horizon import tables
from openstack_dashboard.dashboards.admin.flavors \
import tables as flavor_tables
class CreateNodeProfile(flavor_tables.CreateFlavor):
verbose_name = _("New Node Profile")
url = "horizon:infrastructure:node_profiles:create"
class DeleteNodeProfile(flavor_tables.DeleteFlavor):
def __init__(self, **kwargs):
super(DeleteNodeProfile, self).__init__(**kwargs)
# NOTE(dtantsur): setting class attributes doesn't work
# probably due to metaclass magic in actions
self.data_type_singular = _("Node Profile")
self.data_type_plural = _("Node Profiles")
class NodeProfilesTable(tables.DataTable):
name = tables.Column('name', verbose_name=_('Node'))
arch = tables.Column('cpu_arch', verbose_name=_('Architecture'))
vcpus = tables.Column('vcpus', verbose_name=_('CPUs'))
ram = tables.Column(flavor_tables.get_size,
verbose_name=_('Memory'),
attrs={'data-type': 'size'})
disk = tables.Column(flavor_tables.get_disk_size,
verbose_name=_('Disk'),
attrs={'data-type': 'size'})
# FIXME(dtantsur): would be much better to have names here
kernel_image_id = tables.Column('kernel_image_id',
verbose_name=_('Deploy Kernel Image ID'))
ramdisk_image_id = tables.Column('ramdisk_image_id',
verbose_name=_('Deploy Ramdisk Image ID'))
class Meta:
name = "node_profiles"
verbose_name = _("Node Profiles")
table_actions = (CreateNodeProfile,
DeleteNodeProfile,
flavor_tables.FlavorFilterAction)
row_actions = (DeleteNodeProfile,)