diff --git a/ironic_ui/api/ironic.py b/ironic_ui/api/ironic.py index a1d7164a..811ab7ce 100755 --- a/ironic_ui/api/ironic.py +++ b/ironic_ui/api/ironic.py @@ -171,6 +171,23 @@ def node_update(request, node_id, patch): ironicclient(request).node.update(node_id, patch) +def node_validate(request, node_id): + """Validate a specified node. + + :param request: HTTP request. + :param node_id: The id of the node. + :return: Dictionary of interface statuses + + http://docs.openstack.org/developer/python-ironicclient/api/ironicclient.v1.node.html#ironicclient.v1.node.NodeManager.validate + """ + node = ironicclient(request).node.validate(node_id) + result = {} + for interface, status in node.__dict__.iteritems(): + if isinstance(status, dict) and 'result' in status: + result[interface] = status + return result + + def driver_list(request): """Retrieve a list of drivers. diff --git a/ironic_ui/api/ironic_rest_api.py b/ironic_ui/api/ironic_rest_api.py index 32dd4ade..2dd6d0e4 100755 --- a/ironic_ui/api/ironic_rest_api.py +++ b/ironic_ui/api/ironic_rest_api.py @@ -188,6 +188,22 @@ class Maintenance(generic.View): return ironic.node_set_maintenance(request, node_id, 'off') +@urls.register +class Validate(generic.View): + + url_regex = r'ironic/nodes/(?P[0-9a-f-]+)/validate$' + + @rest_utils.ajax() + def get(self, request, node_id): + """Validate a specified node + + :param request: HTTP request. + :param node_id: Node name or uuid + :return: Dictionary of interface statuses + """ + return ironic.node_validate(request, node_id) + + @urls.register class Drivers(generic.View): diff --git a/ironic_ui/static/dashboard/admin/ironic/ironic.service.js b/ironic_ui/static/dashboard/admin/ironic/ironic.service.js index 4f91556a..911ef4c2 100755 --- a/ironic_ui/static/dashboard/admin/ironic/ironic.service.js +++ b/ironic_ui/static/dashboard/admin/ironic/ironic.service.js @@ -86,7 +86,8 @@ putNodeInMaintenanceMode: putNodeInMaintenanceMode, removeNodeFromMaintenanceMode: removeNodeFromMaintenanceMode, setNodeProvisionState: setNodeProvisionState, - updateNode: updateNode + updateNode: updateNode, + validateNode: validateNode }; return service; @@ -337,6 +338,31 @@ }); } + /** + * @description Validate the specified node + * + * http://docs.openstack.org/developer/ironic/webapi/v1.html# + * validate--v1-nodes + * + * @param {string} nodeIdent – UUID or logical name of a node. + * @return {promise} Promise + */ + function validateNode(nodeIdent) { + var data = { + node: nodeIdent + }; + return apiService.get('/api/ironic/nodes/' + nodeIdent + '/validate', + data) + .success(function() { + }) + .error(function(reason) { + var msg = gettext('Unable to validate node %s: %s'); + toastService.add( + 'error', + interpolate(msg, [nodeIdent, reason], false)); + }); + } + /** * @description Retrieve the list of Ironic drivers * diff --git a/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js b/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js index 0f02e98c..bd501448 100755 --- a/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js +++ b/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.js @@ -66,6 +66,7 @@ ]; ctrl.node = null; + ctrl.nodeValidation = {}; ctrl.ports = []; ctrl.portsSrc = []; ctrl.basePath = basePath; @@ -121,6 +122,9 @@ retrieveNode(uuid).then(function () { retrievePorts(uuid); + ironic.validateNode(uuid).then(function(response) { + ctrl.nodeValidation = response.data; + }); }); } diff --git a/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.spec.js b/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.spec.js index 778ca28a..0f5afd82 100755 --- a/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.spec.js +++ b/ironic_ui/static/dashboard/admin/ironic/node-details/node-details.controller.spec.js @@ -52,6 +52,10 @@ ports.push(createPort(uuid, i)); } return $q.when({data: {items: ports}}); + }, + + validateNode: function() { + return $q.when({}); } }; diff --git a/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html b/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html index 48a1e0d3..af9a6918 100644 --- a/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html +++ b/ironic_ui/static/dashboard/admin/ironic/node-details/sections/configuration.html @@ -11,8 +11,6 @@
{$ ctrl.node.chassis_uuid | noValue $}
Created At
{$ ctrl.node.created_at | date:'medium' | noValue $}
-
Extra
-
{$ ctrl.node.extra | noValue $}
@@ -67,13 +65,7 @@ - - - {$ port.address $} - - - + {$ port.address $} @@ -81,7 +73,12 @@
{$ id $}
-
+
+ + {$ value $} + +
+
{$ value $}

@@ -107,17 +104,6 @@
- -
-

Properties

-
-
-
- {$ propertyName $}
-
{$ propertyValue | noValue $}
-
-
-

Driver Info

@@ -126,13 +112,34 @@
Driver
{$ ctrl.node.driver | noValue $}
+
SSH Address
+
{$ ctrl.node.driver_info.ssh_address | noValue $}
SSH Port
{$ ctrl.node.driver_info.ssh_port | noValue $}
SSH Username
{$ ctrl.node.driver_info.ssh_username | noValue $}
+
SSH Key File
+
+ {$ ssh_key_filename | noValue $} +
+
SSH Password
+
+ {$ ssh_password | noValue $} +
+
SSH Key Contents
+
+ {$ ssh_key_contents | noValue $} +
+
SSH terminal port
+
{$ ctrl.node.driver_info.ssh_terminal_port | noValue $}
+
Virtualization Software
+
{$ ctrl.node.driver_info.ssh_virt_type | noValue $}
Deploy Kernel
- {$ ctrl.node.driver_info.deploy_kernel | noValue $} @@ -142,7 +149,7 @@
Deploy Ramdisk
- {$ ctrl.node.driver_info.deploy_ramdisk | noValue $} @@ -157,9 +164,60 @@
+ + +
+

Driver Validation

+
+ + + + + + + + + + + + + + + + +
+ Interface + + Valid + + Reason +
+ {$ interface $} + + + + + + {$ status.reason $} +
+
+ +
+

Properties

+
+
+
+ {$ propertyName $}
+
{$ propertyValue | noValue $}
+
+
+

Instance Info

@@ -180,6 +238,14 @@ {$ ctrl.node.instance_info.kernel | noValue $} +
Image Source
+
+ + {$ ctrl.node.instance_info.image_source | noValue $} + +
+
Root GB
+
{$ ctrl.node.instance_info.root_gb | noValue $}
{$ id $}
@@ -187,5 +253,17 @@
- + + +
+ +
+

Extra

+
+
+
+ {$ propertyName $}
+
{$ propertyValue | noValue $}
+
+