Add discovery on demand

If node introspection fails, there is no way to re-run the process
within the UI.  This patch adds a button to the maintenance tab
to allow a user to re-run the process.

Change-Id: I16645643de83f212e89f858a85589d425474c5cd
This commit is contained in:
Ryan Brady 2015-08-11 11:23:03 -04:00
parent 6bec389675
commit 64eeb59c72

View File

@ -128,6 +128,27 @@ class NodeFilterAction(tables.FilterAction):
return filter(comp, nodes)
class DiscoverNode(tables.BatchAction):
name = "discover_nodes"
action_present = _("Discover")
action_past = _("Discovered")
data_type_singular = _("Node")
data_type_plural = _("Nodes")
def allowed(self, request, obj=None):
if not obj:
# this is necessary because table actions use this function
# with obj=None
return True
return obj.state == api.node.MAINTENANCE_STATE
def action(self, request, obj_id):
if obj_id is None:
messages.error(request, _("Select some nodes to discover."))
return
api.node.Node.discover(request, [obj_id])
@memoized.memoized
def _get_role_link(role_id):
if role_id:
@ -242,7 +263,7 @@ class MaintenanceNodesTable(BaseNodesTable):
columns = ('node', 'cpus', 'memory_mb', 'local_gb', 'power_status',
'state')
table_actions = (NodeFilterAction, ActivateNode, SetPowerStateOn,
SetPowerStateOff, DeleteNode)
SetPowerStateOff, DiscoverNode, DeleteNode)
row_actions = (ActivateNode, SetPowerStateOn, SetPowerStateOff,
DeleteNode)
template = "horizon/common/_enhanced_data_table.html"